Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1454248rwi; Thu, 3 Nov 2022 05:36:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5ZQlvxH86pseoaMFxlj1LH6UownY05TSpBxTTtUMpHlfyq4jBYfS8He8qFHHEfAh80kVuJ X-Received: by 2002:a17:90a:f3d4:b0:213:959f:5a90 with SMTP id ha20-20020a17090af3d400b00213959f5a90mr34990924pjb.54.1667479000992; Thu, 03 Nov 2022 05:36:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667479000; cv=none; d=google.com; s=arc-20160816; b=fCvMOshtrDQTpecNxwt+x7Fvr/e6Nr5XwGeymOKMwwj5KWtu7o2Mp9x4ZRpQom6FFC cKbnKyEmqHpdTgBFXJQSCjT+C4ILBaueHaCpzCy+PWemENQKi3fxp/g2eXLaMeaypbtj KTYzsT9oV9Q44G9+ifTQ2sclo2xTcgSgoUe8FtH4lFXdy0QV0YYzof1xEdjz2P988S9H WqH4yoj8UD7khAQVAyCxj3bH7PsZQAb37BtIA/KFHhVTeJAVYNPEh8U8ZQNxUlsYPZZA +SN0X6kTGVb3OtUPh4JCoS2IEtgzbmWcGs/jg8KTFGTDDPI6pwDcZa49cqtF024GNZrM NLEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Hy3vS+2ditbsS3Mm+JaviChR3PX6CrD9PjMpbxfhzKw=; b=wbZA/wRtWF77nbfiXzhG+mtqc1wqzl4O0W6e7P/Q+POOVgwUmfGxETKjc+JtZdxD2y cOOfK+w7bgUZMUGz7ULJm8ijPkEnOhH+TAfKkWKngkdFs+ThZP9VdMy9Ais1JlHY4uDc NYmgU/oBih1A6eF+3PAshXPQScrjqCHhQaMgi2JZC4aYYNbs3A0j0RyIqPAGDznMJcQg NofFVtw+Tev+phRj7i5sw4MzYY67PM7/kJMN3q0T3FI2Jjwi6PHuiarvNhT65xAghvfM ImBe+T9SvExMEuIcL2Eu6XNpC06ysgQL9EEj0q4F5Nloo2dnz5h1ctdbvpF3bO3o3Dtq Rj/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=b0NSnWv3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y3-20020a17090a86c300b00208e05957c9si4727942pjv.20.2022.11.03.05.36.22; Thu, 03 Nov 2022 05:36:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=b0NSnWv3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230336AbiKCLTB (ORCPT + 97 others); Thu, 3 Nov 2022 07:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbiKCLTA (ORCPT ); Thu, 3 Nov 2022 07:19:00 -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 81FC8CE39 for ; Thu, 3 Nov 2022 04:18:59 -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=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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.