[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210203195024.GK13819@zn.tnic>
Date: Wed, 3 Feb 2021 20:50:24 +0100
From: Borislav Petkov <bp@...en8.de>
To: Andy Lutomirski <luto@...nel.org>
Cc: x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Yonghong Song <yhs@...com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 10/11] x86/fault: Don't run fixups for SMAP violations
On Sun, Jan 31, 2021 at 09:24:41AM -0800, Andy Lutomirski wrote:
> A SMAP-violating kernel access is not a recoverable condition. Imagine
> kernel code that, outside of a uaccess region, dereferences a pointer to
> the user range by accident. If SMAP is on, this will reliably generate
> as an intentional user access. This makes it easy for bugs to be
> overlooked if code is inadequately tested both with and without SMAP.
>
> We discovered this because BPF can generate invalid accesses to user
> memory, but those warnings only got printed if SMAP was off. With this
> patch, this type of error will be discovered with SMAP on as well.
>
> Cc: Yonghong Song <yhs@...com>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Alexei Starovoitov <ast@...nel.org>
> Cc: Daniel Borkmann <daniel@...earbox.net>
> Signed-off-by: Andy Lutomirski <luto@...nel.org>
> ---
> arch/x86/mm/fault.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 04cc98ec2423..d39946ad8a91 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -1242,7 +1242,11 @@ void do_user_addr_fault(struct pt_regs *regs,
> !(error_code & X86_PF_USER) &&
> !(regs->flags & X86_EFLAGS_AC)))
> {
^
Might wanna fix that opening brace too.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists