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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B6D2C4332F for ; Thu, 3 Nov 2022 11:18:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3E10A6B0071; Thu, 3 Nov 2022 07:18:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 369316B0072; Thu, 3 Nov 2022 07:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 209E26B0073; Thu, 3 Nov 2022 07:18:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 12E0E6B0071 for ; Thu, 3 Nov 2022 07:18:54 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id DFA481405B0 for ; Thu, 3 Nov 2022 11:18:53 +0000 (UTC) X-FDA: 80091883746.23.F45C42F Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf10.hostedemail.com (Postfix) with ESMTP id 0C795C0007 for ; Thu, 3 Nov 2022 11:18:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=Hy3vS+2ditbsS3Mm+JaviChR3PX6CrD9PjMpbxfhzKw=; b=b0NSnWv3NFvikrWqpnsogGD7LG thYHDDiOkzPbCw3YfB8jDdmCbljkQRqvSyb+VepL7xJfoPxQkcGKksBjRXmzARf1u7o7C7Sp9Vxo3 yJ5AuviNzUExDAf3MOBBoJ/JFdS2gwOiOuY1yKld7MVh4qa9R+l3tYtQoQNTU3/O0Me+4xXjFAhT8 jakrRivL42x4E0Qyy1wp368NkygA1N1CzZXX4euuVe9jHBLjPC2qXSNWpKMWJqRt9XUdz5Dm6ko53 /21DFbzF/w26EQEnLKHaIuLBvNSu8edEXFKF2duPMg+nkEZVFFQK+zEXej1MVz6LGQRxo/Ed3EvLI E4mgohOw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqYF9-008fOB-RI; Thu, 03 Nov 2022 11:18:44 +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 B3E9230026A; Thu, 3 Nov 2022 12:18:41 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A409120B250A8; Thu, 3 Nov 2022 12:18:41 +0100 (CET) Date: Thu, 3 Nov 2022 12:18:41 +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: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667474332; h=from:from:sender: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:dkim-signature; bh=Hy3vS+2ditbsS3Mm+JaviChR3PX6CrD9PjMpbxfhzKw=; b=NXEE4kIlRjW/BxxKU47JprBe1nJRWb2kKErAV9HKDVYNx82mi84/aRg9FifXtEFioYaK0o k0Kz0qKPgi8/fJHJQkZcpu/XsHyw6Fsf09n90ZXAOrf21idn14GskcHy+hGmJyJEF2w75n kRbLY/0aU9VgxsWg68pQC7IeGYqGfv8= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=b0NSnWv3; spf=none (imf10.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667474332; a=rsa-sha256; cv=none; b=v0uGje8LDHMhrvtBaMRxk/vlPdqfmjAqhj//EupBxPSoRK1PWjoMDccpkv3uxIauo8GZDG KjaRVC5cLDsnls32j4/UYUhKunY7edPu/4RzrOQjVWGxpErLYZA1m22g9Tr47hFHDmAj9p 9ovlHTazQOqypzoiqHIvRAu4snAOQwE= Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=b0NSnWv3; spf=none (imf10.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none X-Stat-Signature: bg1hef4dm3iz9cm9c9xmbwgm5nfpspb4 X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 0C795C0007 X-HE-Tag: 1667474331-746768 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Nov 02, 2022 at 02:37:19PM +0100, Alexander Potapenko wrote: > On Wed, Nov 2, 2022 at 1:51 PM Peter Zijlstra wrote: > > > > On Wed, Nov 02, 2022 at 12:06:11PM +0100, Alexander Potapenko wrote: > > > There is a case in exc_invalid_op handler that is executed outside the > > > irqentry_enter()/irqentry_exit() region when an UD2 instruction is used > > > to encode a call to __warn(). > > > > > > In that case the `struct pt_regs` passed to the interrupt handler is > > > never unpoisoned by KMSAN (this is normally done in irqentry_enter()), > > > which leads to false positives inside handle_bug(). > > > > > > Use kmsan_unpoison_entry_regs() to explicitly unpoison those registers > > > before using them. > > > > As does poke_int3_handler(); does that need fixing up too? OTOH look > > *very very* carefully at the contraints there. > > Fortunately poke_int3_handler() is a noinstr function, so KMSAN > doesn't add any checks to it. > It also does not pass regs to other instrumented functions, at least > for now, so we're good. Ah indeed; because it is fully noinstr, nothing will trigger the lack of annotation.