Linux-Security-Module Archive on lore.kernel.org
 help / color / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Kees Cook <keescook@chromium.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Zhang Xiaoxu <zhangxiaoxu5@huawei.com>,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	tyhicks@canonical.com, colin.king@canonical.com,
	linux-security-module@vger.kernel.org,
	Matthew Garrett <mjg59@google.com>
Subject: Re: [PATCH] x86/mtrr: Require CAP_SYS_ADMIN for all access
Date: Tue, 19 Nov 2019 11:07:53 +0100
Message-ID: <20191119100753.GA27787@zn.tnic> (raw)
In-Reply-To: <201911181308.63F06502A1@keescook>

On Mon, Nov 18, 2019 at 01:09:21PM -0800, Kees Cook wrote:
> Zhang Xiaoxu noted that physical address locations for MTRR were
> visible to non-root users, which could be considered an information
> leak. In discussing[1] the options for solving this, it sounded like
> just moving the capable check into open() was the first step. If this
> breaks userspace, then we will have a test case for the more conservative
> approaches discussed in the thread. In summary:
> 
> - MTRR should check capabilities at open time (or retain the
>   checks on the opener's permissions for later checks).
> 
> - changing the DAC permissions might break something that expects to
>   open mtrr when not uid 0.
> 
> - if we leave the DAC permissions alone and just move the capable check
>   to the opener, we should get the desired protection. (i.e. check
>   against CAP_SYS_ADMIN not just the wider uid 0.)
> 
> - if that still breaks things, as in userspace expects to be able to
>   read other parts of the file as non-uid-0 and non-CAP_SYS_ADMIN, then
>   we need to censor the contents using the opener's permissions. For
>   example, as done in other /proc cases, like commit 51d7b120418e
>   ("/proc/iomem: only expose physical resource addresses to privileged
>   users").
> 
> [1] https://lore.kernel.org/lkml/201911110934.AC5BA313@keescook/
> 
> Reported-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/x86/kernel/cpu/mtrr/if.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)

Yap, LGTM, thanks!

Reviewed-by: Borislav Petkov <bp@suse.de>

However, as it has a user-visible impact and it is not an urgent thing
to have in the tree, I'd not queue this now but after the merge window
is done so that we have a maximum time of exposure in linux-next and we
can have ample time to addres fallout.

/me puts it on the list for after the merge window.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18 21:09 Kees Cook
2019-11-19 10:07 ` Borislav Petkov [this message]
2019-11-20 20:24   ` James Morris
2019-12-09  8:51 ` [tip: x86/mtrr] " tip-bot2 for Kees Cook

Reply instructions:

You may reply publically 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=20191119100753.GA27787@zn.tnic \
    --to=bp@alien8.de \
    --cc=colin.king@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=mjg59@google.com \
    --cc=tglx@linutronix.de \
    --cc=tyhicks@canonical.com \
    --cc=x86@kernel.org \
    --cc=zhangxiaoxu5@huawei.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: link

Linux-Security-Module Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-security-module/0 linux-security-module/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-security-module linux-security-module/ https://lore.kernel.org/linux-security-module \
		linux-security-module@vger.kernel.org
	public-inbox-index linux-security-module

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-security-module


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git