Skip to content

Commit 0e31027

Browse files
ajdlinuxgregkh
authored andcommitted
powerpc/powernv: Restrict OPAL symbol map to only be readable by root
commit e7de4f7 upstream. Currently the OPAL symbol map is globally readable, which seems bad as it contains physical addresses. Restrict it to root. Fixes: c8742f8 ("powerpc/powernv: Expose OPAL firmware symbol map") Cc: [email protected] # v3.19+ Suggested-by: Michael Ellerman <[email protected]> Signed-off-by: Andrew Donnellan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 154129a commit 0e31027

File tree

1 file changed

+7
-4
lines changed
  • arch/powerpc/platforms/powernv

1 file changed

+7
-4
lines changed

arch/powerpc/platforms/powernv/opal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,10 @@ static ssize_t symbol_map_read(struct file *fp, struct kobject *kobj,
579579
bin_attr->size);
580580
}
581581

582-
static BIN_ATTR_RO(symbol_map, 0);
582+
static struct bin_attribute symbol_map_attr = {
583+
.attr = {.name = "symbol_map", .mode = 0400},
584+
.read = symbol_map_read
585+
};
583586

584587
static void opal_export_symmap(void)
585588
{
@@ -596,10 +599,10 @@ static void opal_export_symmap(void)
596599
return;
597600

598601
/* Setup attributes */
599-
bin_attr_symbol_map.private = __va(be64_to_cpu(syms[0]));
600-
bin_attr_symbol_map.size = be64_to_cpu(syms[1]);
602+
symbol_map_attr.private = __va(be64_to_cpu(syms[0]));
603+
symbol_map_attr.size = be64_to_cpu(syms[1]);
601604

602-
rc = sysfs_create_bin_file(opal_kobj, &bin_attr_symbol_map);
605+
rc = sysfs_create_bin_file(opal_kobj, &symbol_map_attr);
603606
if (rc)
604607
pr_warn("Error %d creating OPAL symbols file\n", rc);
605608
}

0 commit comments

Comments
 (0)