powerpc/powernv: Restrict OPAL symbol map to only be readable by root
Subsystems (2)
PATCH 1/1 powerpc/powernv: Restrict OPAL symbol map to only be readable by root
Currently the OPAL symbol map is globally readable, which seems bad as it contains physical addresses.
Restrict it to root.
Suggested-by Michael Ellerman <[email protected]>
Cc Jordan Niethe <[email protected]>
Cc Stewart Smith <[email protected]>
Fixes c8742f85125d ("powerpc/powernv: Expose OPAL firmware symbol map")
Signed-off-by Andrew Donnellan <[email protected]>
--- arch/powerpc/platforms/powernv/opal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
arch/powerpc/platforms/powernv/opal.c +7 -4
@@ -681,7 +681,10 @@ static ssize_t symbol_map_read(struct file *fp, struct kobject *kobj, bin_attr->size); } -static BIN_ATTR_RO(symbol_map, 0); +static struct bin_attribute symbol_map_attr = { + .attr = {.name ="symbol_map" , .mode =0400 }, + .read = symbol_map_read +};static void opal_export_symmap (void ) {
@@ -698,10 +701,10 @@ static void opal_export_symmap(void)return ;/* Setup attributes */ - bin_attr_symbol_map.private =__va (be64_to_cpu (syms[0 ])); - bin_attr_symbol_map.size =be64_to_cpu (syms[1 ]); + symbol_map_attr.private =__va (be64_to_cpu (syms[0 ])); + symbol_map_attr.size =be64_to_cpu (syms[1 ]); - rc =sysfs_create_bin_file (opal_kobj, &bin_attr_symbol_map); + rc =sysfs_create_bin_file (opal_kobj, &symbol_map_attr);if (rc)pr_warn ("Error %d creating OPAL symbols file\n" , rc); }
Signature · 1 line
2.20.1
Greg KH
maintainerQuoted 32 lines · Andrew Donnellan
Currently the OPAL symbol map is globally readable, which seems bad as it contains physical addresses.
Restrict it to root.
Suggested-by Michael Ellerman <[email protected]>Cc Jordan Niethe <[email protected]>Cc Stewart Smith <[email protected]>Fixes c8742f85125d ("powerpc/powernv: Expose OPAL firmware symbol map")Signed-off-by Andrew Donnellan <[email protected]>--- arch/powerpc/platforms/powernv/opal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)arch/powerpc/platforms/powernv/opal.c +4
-1@@ -681,7 +681,10 @@ static ssize_t symbol_map_read(struct file *fp, struct kobject *kobj, bin_attr->size); } -static BIN_ATTR_RO(symbol_map, 0); +static struct bin_attribute symbol_map_attr = { + .attr = {.name ="symbol_map" , .mode =0400 }, + .read = symbol_map_read +};static void opal_export_symmap (void ) {
arch/powerpc/platforms/powernv/opal.c static void opal_export_symmap(void) · line 704
Quoted 6 lines
arch/powerpc/platforms/powernv/opal.c +1
-2@@ -698,10 +701,10 @@ static void opal_export_symmap(void)return ;/* Setup attributes */ - bin_attr_symbol_map.private =__va (be64_to_cpu (syms[0 ])); - bin_attr_symbol_map.size =be64_to_cpu (syms[1 ]); + symbol_map_attr.private =__va (be64_to_cpu (syms[0 ]));
no tab?
checkpatch.pl is your friend :)
Quoted 4 lines · Greg KH
no tab?
checkpatch.pl is your friend :)
Ughhhhhhhhhh.
Sadly our CI is currently down ;)
Respun.
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited