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 28B3DC433FE for ; Thu, 3 Nov 2022 14:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231512AbiKCOda (ORCPT ); Thu, 3 Nov 2022 10:33:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbiKCOd0 (ORCPT ); Thu, 3 Nov 2022 10:33:26 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456721023 for ; Thu, 3 Nov 2022 07:33:23 -0700 (PDT) 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=UhKkd6ywANb7xuG1OzsZSFZRIZlWynpywgjyOk4XnEk=; b=BfdjRXu35DSt6nbUHR87k6mqku yK0ofUBGJje8k3cOh2g/Z5pykZqh4H695EbOTw1xzMj8p8mqRY+lL1OWxN6eJRXYDeXo/9nzFaBDw HX02426ZqOpLIdp2vNTwCHYjw2lr3KMQewUFnGTWhPhS7XP+aPvHndoMqble/ZbacTEUCFRRZa2fB j1QhSMLrUAhWUwnNh8j1fwK0kw+vd/eaSQ7USX1LgRO33wm8QnpM7RCn9yhqFOmOt05Y6b7eNRnoS uLIJZP+uUONLGE7zEkRKS91XB1/MAKIhTlN7sJ4btDUfkeqZqZP9UlY3S8NygpNUCBlc94V6+xS0R /MNxNq8Q==; 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 1oqbH9-008hTa-SE; Thu, 03 Nov 2022 14:33:00 +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 139CF300130; Thu, 3 Nov 2022 15:32:58 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id F02BA20B250BE; Thu, 3 Nov 2022 15:32:57 +0100 (CET) Date: Thu, 3 Nov 2022 15:32:57 +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 v2] x86/traps: avoid KMSAN bugs originating from handle_bug() Message-ID: References: <20221103134515.1934867-1-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221103134515.1934867-1-glider@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 03, 2022 at 02:45:15PM +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. > > Cc: Andrew Morton > Cc: Borislav Petkov > Cc: Dave Hansen > Cc: Ingo Molnar > Cc: Peter Zijlstra (Intel) > Cc: Thomas Gleixner > Cc: x86@kernel.org > Signed-off-by: Alexander Potapenko > > --- > > v2: > - move the call to kmsan_unpoison_entry_regs() after the > instrumentation_begin(), as suggested by Peter Zijlstra Thanks! Acked-by: Peter Zijlstra (Intel)