linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zhanglin <zhang.lin16@zte.com.cn>
To: dan.j.williams@intel.com
Cc: akpm@linux-foundation.org, jgg@ziepe.ca, mingo@kernel.org,
	dave.hansen@linux.intel.com, namit@vmware.com, bp@suse.de,
	christophe.leroy@c-s.fr, rdunlap@infradead.org,
	osalvador@suse.de, richardw.yang@linux.intel.com,
	linux-kernel@vger.kernel.org, xue.zhihong@zte.com.cn,
	wang.yi59@zte.com.cn, jiang.xuexin@zte.com.cn,
	zhanglin <zhang.lin16@zte.com.cn>
Subject: [PATCH] kernel: Restrict permissions of /proc/iomem.
Date: Fri, 25 Oct 2019 16:56:41 +0800	[thread overview]
Message-ID: <1571993801-12665-1-git-send-email-zhang.lin16@zte.com.cn> (raw)

The permissions of /proc/iomem currently are -r--r--r--. Everyone can
see its content. As iomem contains information about the physical memory
content of the device, restrict the information only to root.

Signed-off-by: zhanglin <zhang.lin16@zte.com.cn>
---
 kernel/resource.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/resource.c b/kernel/resource.c
index 30e1bc6..844456e 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -139,7 +139,8 @@ static int __init ioresources_init(void)
 {
 	proc_create_seq_data("ioports", 0, NULL, &resource_op,
 			&ioport_resource);
-	proc_create_seq_data("iomem", 0, NULL, &resource_op, &iomem_resource);
+	proc_create_seq_data("iomem", S_IRUSR, NULL, &resource_op,
+			&iomem_resource);
 	return 0;
 }
 __initcall(ioresources_init);
-- 
2.15.2


             reply	other threads:[~2019-10-25  8:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-25  8:56 zhanglin [this message]
2019-10-25 21:32 ` [PATCH] kernel: Restrict permissions of /proc/iomem Andrew Morton
2019-10-28 19:16   ` Kees Cook
2019-10-29 11:05     ` Christian Kujau
2019-10-25 21:38 ` Dave Hansen

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=1571993801-12665-1-git-send-email-zhang.lin16@zte.com.cn \
    --to=zhang.lin16@zte.com.cn \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=christophe.leroy@c-s.fr \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jgg@ziepe.ca \
    --cc=jiang.xuexin@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namit@vmware.com \
    --cc=osalvador@suse.de \
    --cc=rdunlap@infradead.org \
    --cc=richardw.yang@linux.intel.com \
    --cc=wang.yi59@zte.com.cn \
    --cc=xue.zhihong@zte.com.cn \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).