From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECB38C433DB for ; Wed, 3 Feb 2021 19:51:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 975D064DE7 for ; Wed, 3 Feb 2021 19:51:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231335AbhBCTvK (ORCPT ); Wed, 3 Feb 2021 14:51:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbhBCTvE (ORCPT ); Wed, 3 Feb 2021 14:51:04 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1542AC061573 for ; Wed, 3 Feb 2021 11:50:24 -0800 (PST) Received: from zn.tnic (p200300ec2f0c84001e2b7e52dd5f0f2b.dip0.t-ipconnect.de [IPv6:2003:ec:2f0c:8400:1e2b:7e52:dd5f:f2b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 9599A1EC0257; Wed, 3 Feb 2021 20:50:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1612381822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=N8guk8HFEpl0w+erO6vrJ6FO0v8tWc63A8/S5JJBFRQ=; b=B23t0B4fqLjLTHmEI/t3gQerOfhB5fyrHEyy+UCbaTrZZ+PHbqlHzwJ4VzI2uuyaS4Z3fU mMkP+35nrlEejNFdFRkKOaa9DALiIAP7ilKEm5FYM384WkdYHdah1bV6ghKnmMfYuZ7ZGo lqJjlg73M5j8/RNdkRKb2qtqZyIquvI= Date: Wed, 3 Feb 2021 20:50:24 +0100 From: Borislav Petkov To: Andy Lutomirski Cc: x86@kernel.org, LKML , Dave Hansen , Alexei Starovoitov , Daniel Borkmann , Yonghong Song , Masami Hiramatsu , Peter Zijlstra Subject: Re: [PATCH 10/11] x86/fault: Don't run fixups for SMAP violations Message-ID: <20210203195024.GK13819@zn.tnic> References: <416aa53570523f2659edf9e39d553160cb253c5f.1612113550.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <416aa53570523f2659edf9e39d553160cb253c5f.1612113550.git.luto@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Dave Hansen > Cc: Peter Zijlstra > Cc: Alexei Starovoitov > Cc: Daniel Borkmann > Signed-off-by: Andy Lutomirski > --- > 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