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 88931C433FE for ; Thu, 3 Nov 2022 14:33:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DEF36B0072; Thu, 3 Nov 2022 10:33:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 08E106B0073; Thu, 3 Nov 2022 10:33:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EBEF76B0074; Thu, 3 Nov 2022 10:33:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id DAA7D6B0072 for ; Thu, 3 Nov 2022 10:33:09 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B3DF2401F9 for ; Thu, 3 Nov 2022 14:33:09 +0000 (UTC) X-FDA: 80092373298.17.0A130F8 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf02.hostedemail.com (Postfix) with ESMTP id 7EF8380007 for ; Thu, 3 Nov 2022 14:33:06 +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=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> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667485987; a=rsa-sha256; cv=none; b=5HGi82BLaqgClRJf+V1MJs5ELKWHdHb4neAn9Y6/KwMGJ1USRViow0pYIdxYM0LhkZYZBJ TzbnsJLxlg8xKl66xuI+GIsQhHkdmL87EoLamKxs+H2HLqiX/wAka5qw4TGs2UxsVSaa9a 1VM0AdDxU9XgGPHgj/GpAB4ewrAmz9o= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=BfdjRXu3; dmarc=none; spf=none (imf02.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667485987; 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=UhKkd6ywANb7xuG1OzsZSFZRIZlWynpywgjyOk4XnEk=; b=DURc9LyKZOSrI2zdb36tiDA+YMh12N2braFE8DXNQk/+WTnf7m7jl0RQkxq+E83bHektvM fhZGrg+zHvFWXmXjS3wJBJ9B8vWqAlQOm34vwqMaJvOIC0x6W5/gzf4V34kyhp6eX+spO5 7slRgpV4OG9YS3GXXzDfJivxAeQIwQ8= X-Stat-Signature: gqy8y544hrj7f3f8khgpzp4o3se3bort X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7EF8380007 X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=BfdjRXu3; dmarc=none; spf=none (imf02.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org X-HE-Tag: 1667485986-182768 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 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)