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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 595A8C4332F for ; Wed, 2 Nov 2022 12:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231192AbiKBMxA (ORCPT ); Wed, 2 Nov 2022 08:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbiKBMw4 (ORCPT ); Wed, 2 Nov 2022 08:52:56 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C449E23391 for ; Wed, 2 Nov 2022 05:52:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Yd6e4en4bklJiNM6GZtjiZJXoygCKmqjbRziwSCUFLo=; b=LIf40PV0usRaztBevGb7nX492e hhtBZxHKfhiRkLI0CBRbf6fjMMIDRX92fnziwCt/JoLZ+rDMnIrVmPz4/58pSD/LaqFJUbAnZSjiV Hk3/UbcUOvTzMMfsci0clnbu9pyUco6r4e1U2VyzXO21eYdnXux8DDiEPjoycLrF1aq28mQ9G3wMa jeOmqp0MsTC8sn+U8IDER4tH6VTDIfT1j/kk25p1ptfVb3T/Hy/DK28WPgsSoskHbLqt/5fNES2FN UnldtqvI1ql9mqp/bXjUyi+sfFkXtxgCvVin3BKiyOGomKUym9eOhPFxGI/elofK+iLpX25RYo3Py qfcF5w0g==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqDEg-005WUS-Ex; Wed, 02 Nov 2022 12:52:50 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3D082300454; Wed, 2 Nov 2022 13:52:45 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2E3D020B1E7E2; Wed, 2 Nov 2022 13:52:45 +0100 (CET) Date: Wed, 2 Nov 2022 13:52:45 +0100 From: Peter Zijlstra To: Alexander Potapenko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Dave Hansen , Kees Cook , x86@kernel.org Subject: Re: [PATCH 2/5] x86/uaccess: instrument copy_from_user_nmi() Message-ID: References: <20221102110611.1085175-1-glider@google.com> <20221102110611.1085175-2-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221102110611.1085175-2-glider@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 02, 2022 at 12:06:08PM +0100, Alexander Potapenko wrote: > Make sure usercopy hooks from linux/instrumented.h are invoked for > copy_from_user_nmi(). > This fixes KMSAN false positives reported when dumping opcodes for a > stack trace. > > Cc: Andrew Morton > Cc: Dave Hansen > Cc: Kees Cook > Cc: Peter Zijlstra (Intel) > Cc: x86@kernel.org > Signed-off-by: Alexander Potapenko Acked-by: Peter Zijlstra (Intel) > --- > arch/x86/lib/usercopy.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/x86/lib/usercopy.c b/arch/x86/lib/usercopy.c > index f1bb186171562..24b48af274173 100644 > --- a/arch/x86/lib/usercopy.c > +++ b/arch/x86/lib/usercopy.c > @@ -6,6 +6,7 @@ > > #include > #include > +#include > > #include > > @@ -44,7 +45,9 @@ copy_from_user_nmi(void *to, const void __user *from, unsigned long n) > * called from other contexts. > */ > pagefault_disable(); > + instrument_copy_from_user_before(to, from, n); > ret = raw_copy_from_user(to, from, n); > + instrument_copy_from_user_after(to, from, n, ret); > pagefault_enable(); > > return ret; > -- > 2.38.1.273.g43a17bfeac-goog >