Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4136346rwb; Mon, 21 Nov 2022 04:17:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5uTdxOKF28zmCE90o+CH7/ZGkyVbTBsxkmWjtwbCb+Gv6Ou3p+MG7kVm/l0K9lCRUNLQDT X-Received: by 2002:a63:2306:0:b0:46f:918e:7339 with SMTP id j6-20020a632306000000b0046f918e7339mr232992pgj.429.1669033055698; Mon, 21 Nov 2022 04:17:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669033055; cv=none; d=google.com; s=arc-20160816; b=oRU+Y8JAh7jDJIdHr9X+lRz7IiPGqr3sTmgcZ3wq980BwClXkT2hYMbBPbzKbMhXti lu7E9gwylbzbflzwBMd/Rl7MuZz/J+bibSIkJqhpY1+++zOdNjX5KgM1hIZxEYqYsK29 KpHAXT4Mgc7NCJrcv10c4LEV6w6aTOuaCcihb50anjpaqKq1WkvNlj9htE+Ezk78vbkl OzRqq+6gGs0lzj4gBiBygftZJPxKh3wfbRy7Eqm+GEQV1HZ4MG0MLtAs5oYejJCa4ynO mLvbd7hgGj/nIRvhnHTTMdezLo/JWer6FwH2pm/P+Z6NkNDeLcYEd+yVuJXIDYuXflKE ZKWw== 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=xnc8nrimE8ZadiLzj8YpVfbtMkFptDEBBCizLKH9Aho=; b=HZqZlTzLkwO3fEh0VBMBVhEEsgd5BgPGKjdUN33ODuxKw+I0wfoEuP2PXzdH6dBj/8 gBqq1bBQxOKrfUdFT72jkGa9i0ZfhZvIQOHhxg0XzhaPD3lXca1+jNb9q8yKhdMOcrpa /+rchD9HBUZeSynNHg/kO2TWfPwRcfkYKkuego3LQOEAbOu1snRLt0zca0kco2Y6l+F0 SunkvP40Z9Yev+l8kBspbVQZB5sWPdWuph9nLAU73dLNZGR+VfRMMXWvSctur8mEbW2a O7kVwAL/4PJJ6c0LtRMsnrEK8nzPqkJr5SomFGg2XB8Y2DPQQ0zBNNuPqez8+6FNTA7H dwug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=VKlX+D3b; 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 u14-20020a170902e80e00b001868ef35f09si12556696plg.258.2022.11.21.04.17.22; Mon, 21 Nov 2022 04:17:35 -0800 (PST) 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=casper.20170209 header.b=VKlX+D3b; 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 S230109AbiKULj7 (ORCPT + 92 others); Mon, 21 Nov 2022 06:39:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbiKULjj (ORCPT ); Mon, 21 Nov 2022 06:39:39 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E85AA462 for ; Mon, 21 Nov 2022 03:38:24 -0800 (PST) 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=xnc8nrimE8ZadiLzj8YpVfbtMkFptDEBBCizLKH9Aho=; b=VKlX+D3bIqajcYrTsTiDrH8EJF p/weJ6/+0TBazPOjZ1tD6Pls1MPJFb4zg9qQJ2JwC0Ovt000qe1LmAIkxSaSJr6mARX6CgEgRJQA4 PDCVFgIqymgIwVmZf4rAch6927esOgcb6UpdHT/B5vSz/j5zk+M1glZbnyNY5xsUYsjvuo6bE4lFZ eGrpOL9x35u7XeJMbkZOjGFq0L1H7dOob63H0CzFF2jlDYEe+PcQssQZEVX9lfsHgs0f84jCw823a 5rki2s7jChJWtgLoiYaBIxaBTHI87+++nPdDCB2d75jpy0XFWWZCblcpF4iOomLx4MZBmtwGvaFli mvcTYUfQ==; 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 1ox57z-005APH-Lv; Mon, 21 Nov 2022 11:38:24 +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 50BF6300244; Mon, 21 Nov 2022 12:38:12 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 36098207A328C; Mon, 21 Nov 2022 12:38:12 +0100 (CET) Date: Mon, 21 Nov 2022 12:38:12 +0100 From: Peter Zijlstra To: Alexander Potapenko Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH] x86: suppress KMSAN reports in arch_within_stack_frames() Message-ID: References: <20221118172305.3321253-1-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 Mon, Nov 21, 2022 at 11:28:39AM +0100, Alexander Potapenko wrote: > > > +__no_kmsan_checks > > > static inline int arch_within_stack_frames(const void * const stack, > > > const void * const stackend, > > > const void *obj, unsigned long len) > > > > Seems OK; but now I'm confused as to the exact distinction between > > __no_sanitize_memory and __no_kmsan_checks. > > > > The comments there about seem to suggest __no_sanitize_memory ensures no > > instrumentation at all, and __no_kmsan_checks some instrumentation but > > doesn't actually check anything -- so what's left then? > > __no_sanitize_memory prohibits all instrumentation whatsoever, whereas > __no_kmsan_checks adds instrumentation that suppresses potential false > positives around this function. > > Quoting include/linux/compiler-clang.h: > > /* > * The __no_kmsan_checks attribute ensures that a function does not produce > * false positive reports by: > * - initializing all local variables and memory stores in this function; > * - skipping all shadow checks; > * - passing initialized arguments to this function's callees. > */ > > Does this answer your question? So I read that comment; and it didn't click. So you're explicitly initializing variables/arguments and explicitly not checking shadow state vs, not doing explicit initialization and checking shadow state? That is, it doesn't do the normal checks and adds explicit initialization to avoid triggering discontent in surrounding functions?