Skip to content

Commit 87be553

Browse files
ajdlinuxtechflashYT
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: stable@vger.kernel.org # v3.19+ Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20190503075253.22798-1-ajd@linux.ibm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e699ebe commit 87be553

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
@@ -705,7 +705,10 @@ static ssize_t symbol_map_read(struct file *fp, struct kobject *kobj,
705705
bin_attr->size);
706706
}
707707

708-
static BIN_ATTR_RO(symbol_map, 0);
708+
static struct bin_attribute symbol_map_attr = {
709+
.attr = {.name = "symbol_map", .mode = 0400},
710+
.read = symbol_map_read
711+
};
709712

710713
static void opal_export_symmap(void)
711714
{
@@ -722,10 +725,10 @@ static void opal_export_symmap(void)
722725
return;
723726

724727
/* Setup attributes */
725-
bin_attr_symbol_map.private = __va(be64_to_cpu(syms[0]));
726-
bin_attr_symbol_map.size = be64_to_cpu(syms[1]);
728+
symbol_map_attr.private = __va(be64_to_cpu(syms[0]));
729+
symbol_map_attr.size = be64_to_cpu(syms[1]);
727730

728-
rc = sysfs_create_bin_file(opal_kobj, &bin_attr_symbol_map);
731+
rc = sysfs_create_bin_file(opal_kobj, &symbol_map_attr);
729732
if (rc)
730733
pr_warn("Error %d creating OPAL symbols file\n", rc);
731734
}

0 commit comments

Comments
 (0)