linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: zhanglin <zhang.lin16@zte.com.cn>, 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
Subject: Re: [PATCH] kernel: Restrict permissions of /proc/iomem.
Date: Fri, 25 Oct 2019 14:38:56 -0700	[thread overview]
Message-ID: <f41c7a5c-4f75-a9ea-c360-3949d27eedd3@intel.com> (raw)
In-Reply-To: <1571993801-12665-1-git-send-email-zhang.lin16@zte.com.cn>

On 10/25/19 1:56 AM, zhanglin wrote:
> 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.

For me, running as non-root on 5.4.0-rc4, I see:

$ cat /proc/iomem
00000000-00000000 : Reserved
00000000-00000000 : System RAM
00000000-00000000 : Reserved
00000000-00000000 : PCI Bus 0000:00
00000000-00000000 : Video ROM
00000000-00000000 : pnp 00:00
00000000-00000000 : pnp 00:00
00000000-00000000 : pnp 00:00

All 0's since kernel/resource.c::r_show() does:

        if (file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN)) {
                start = r->start;
                end = r->end;
        } else {
                start = end = 0;
        }

Are you just looking at the file as root and assuming that users see the
same thing since they have read permissions?

      parent reply	other threads:[~2019-10-25 21:38 UTC|newest]

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

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=f41c7a5c-4f75-a9ea-c360-3949d27eedd3@intel.com \
    --to=dave.hansen@intel.com \
    --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 \
    --cc=zhang.lin16@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).