From: Andrew Donnellan <ajd@linux.ibm.com> To: linuxppc-dev@lists.ozlabs.org Cc: Michael Ellerman <mpe@ellerman.id.au>, Jordan Niethe <jniethe5@gmail.com>, Stewart Smith <stewart@linux.ibm.com>, stable@vger.kernel.org Subject: [PATCH v2] powerpc/powernv: Restrict OPAL symbol map to only be readable by root Date: Fri, 3 May 2019 17:52:53 +1000 [thread overview] Message-ID: <20190503075253.22798-1-ajd@linux.ibm.com> (raw) Currently the OPAL symbol map is globally readable, which seems bad as it contains physical addresses. Restrict it to root. Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Cc: Jordan Niethe <jniethe5@gmail.com> Cc: Stewart Smith <stewart@linux.ibm.com> Fixes: c8742f85125d ("powerpc/powernv: Expose OPAL firmware symbol map") Cc: stable@vger.kernel.org Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> --- v1->v2: - fix tabs vs spaces (Greg) --- arch/powerpc/platforms/powernv/opal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 2b0eca104f86..0582a02623d0 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -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); } -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Donnellan <ajd@linux.ibm.com> To: linuxppc-dev@lists.ozlabs.org Cc: stable@vger.kernel.org, Stewart Smith <stewart@linux.ibm.com>, Jordan Niethe <jniethe5@gmail.com> Subject: [PATCH v2] powerpc/powernv: Restrict OPAL symbol map to only be readable by root Date: Fri, 3 May 2019 17:52:53 +1000 [thread overview] Message-ID: <20190503075253.22798-1-ajd@linux.ibm.com> (raw) Currently the OPAL symbol map is globally readable, which seems bad as it contains physical addresses. Restrict it to root. Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Cc: Jordan Niethe <jniethe5@gmail.com> Cc: Stewart Smith <stewart@linux.ibm.com> Fixes: c8742f85125d ("powerpc/powernv: Expose OPAL firmware symbol map") Cc: stable@vger.kernel.org Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> --- v1->v2: - fix tabs vs spaces (Greg) --- arch/powerpc/platforms/powernv/opal.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c index 2b0eca104f86..0582a02623d0 100644 --- a/arch/powerpc/platforms/powernv/opal.c +++ b/arch/powerpc/platforms/powernv/opal.c @@ -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); } -- 2.20.1
next reply other threads:[~2019-05-03 7:53 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-03 7:52 Andrew Donnellan [this message] 2019-05-03 7:52 ` [PATCH v2] powerpc/powernv: Restrict OPAL symbol map to only be readable by root Andrew Donnellan 2019-05-03 7:59 ` Greg KH 2019-05-03 7:59 ` Greg KH 2019-05-03 8:27 ` Andrew Donnellan 2019-05-03 8:27 ` Andrew Donnellan 2019-05-03 8:35 ` Greg KH 2019-05-03 8:35 ` Greg KH 2019-05-03 8:50 ` Andrew Donnellan 2019-05-03 8:50 ` Andrew Donnellan 2019-07-31 1:44 ` Andrew Donnellan 2019-07-31 1:44 ` Andrew Donnellan 2019-07-31 11:43 ` Michael Ellerman 2019-07-31 11:43 ` Michael Ellerman 2019-08-10 10:20 ` Michael Ellerman 2019-08-10 10:20 ` Michael Ellerman
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190503075253.22798-1-ajd@linux.ibm.com \ --to=ajd@linux.ibm.com \ --cc=jniethe5@gmail.com \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=mpe@ellerman.id.au \ --cc=stable@vger.kernel.org \ --cc=stewart@linux.ibm.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.