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 09B9FC4332F for ; Thu, 3 Nov 2022 11:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiKCLSh (ORCPT ); Thu, 3 Nov 2022 07:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiKCLSe (ORCPT ); Thu, 3 Nov 2022 07:18:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB9D10FCC for ; Thu, 3 Nov 2022 04:18:30 -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=6ppk5oqLzoieKopIKN99v9d97TdoVzFTkLUKC1+8UAY=; b=EPeqifQDlgwfu5GqvfAuXMVRtt 5MSxrXQq09orPef5fLujxhR6G99DLQbE2LlqeLIoesg4knHwIRJGFtUAejxG+8uQGUym8kTVNhOKo lK+HNoJeQyleFEFmMz0snOEFooxmv8Iediv6I056lC9mosXeF/cTGtPmQJvMJvo+Xr0v/uKEgYUeb 7Ikiuu9eneZrqGDc4fJh1UsKk0/G809MeKFUsli3tX4uK483ckAX0kKJDL3I4zrGOKZ5Ep5eZGwx8 G/jBWYumJPtTAszLfzqVsVPbHH0Oe2DpA0UTK7vATqZ9vRjULMyQJ7PZXEXKWO2AGU/tcquHW96EQ jrbrN8WA==; 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 1oqYEn-006PUB-CG; Thu, 03 Nov 2022 11:18:21 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A140930012F; Thu, 3 Nov 2022 12:18:14 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 89B1320424903; Thu, 3 Nov 2022 12:18:14 +0100 (CET) Date: Thu, 3 Nov 2022 12:18:14 +0100 From: Peter Zijlstra To: Alexander Potapenko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Borislav Petkov , Dave Hansen , Ingo Molnar , Thomas Gleixner , x86@kernel.org Subject: Re: [PATCH 5/5] x86/traps: avoid KMSAN bugs originating from handle_bug() Message-ID: References: <20221102110611.1085175-1-glider@google.com> <20221102110611.1085175-5-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221102110611.1085175-5-glider@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 02, 2022 at 12:06:11PM +0100, Alexander Potapenko wrote: > diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c > index 178015a820f08..d3fdec706f1d2 100644 > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -301,6 +302,12 @@ static noinstr bool handle_bug(struct pt_regs *regs) > { > bool handled = false; > > + /* > + * Normally @regs are unpoisoned by irqentry_enter(), but handle_bug() > + * is a rare case that uses @regs without passing them to > + * irqentry_enter(). > + */ > + kmsan_unpoison_entry_regs(regs); > if (!is_valid_bugaddr(regs->ip)) > return handled; > Should we place this kmsan_unpoison_entry_regs() after the instrumentation_begin() ?