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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94F14C433EF for ; Thu, 11 Nov 2021 11:35:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F9F461241 for ; Thu, 11 Nov 2021 11:35:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4F9F461241 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DA8A46B0088; Thu, 11 Nov 2021 06:35:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D56F66B0089; Thu, 11 Nov 2021 06:35:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C460A6B008A; Thu, 11 Nov 2021 06:35:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id B82C36B0088 for ; Thu, 11 Nov 2021 06:35:12 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7BDA1184B3576 for ; Thu, 11 Nov 2021 11:35:12 +0000 (UTC) X-FDA: 78796443264.02.534F846 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf27.hostedemail.com (Postfix) with ESMTP id CE12B70000B3 for ; Thu, 11 Nov 2021 11:35:11 +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=PnbX+gQU93tJ4Oopo9HMKbJdOiep79gIINOH60lEP+Q=; b=Y25YDRrKPguEKSeTtTUSYmFzie uXPhh8AI174gyUJEzYFhj0TJ/dQg6+lsaH86PhNMqeKZlJuXDKlKV8xN9vLccNk8ghuixW/20cCad mETlQ138dCBSEHPY65HbPbce25H4Hg8mJfvqq8GMsLa+L8snnlf0rKMSFg5vK/1LwUXTY/Wrh877q 4tOU+2QExR/CFrHWKAwsF778j6LUSvHP9QElOM7qMWcNRzlrB3x/AZgY+QiPgUog3NU9pP0H4Z5x7 HvHZBFwWf4Gly6gVTeieIsXJU8hXwfb6plEGA8NLU78c06J7L8FEnQvfrFySib8nSCOFqDzHQOTW4 YSpqFf0Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ml8MA-00FSKN-3e; Thu, 11 Nov 2021 11:35:02 +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 (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id F07A930001B; Thu, 11 Nov 2021 12:35:00 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DB9E6203BF719; Thu, 11 Nov 2021 12:35:00 +0100 (CET) Date: Thu, 11 Nov 2021 12:35:00 +0100 From: Peter Zijlstra To: Marco Elver Cc: "Paul E . McKenney" , Alexander Potapenko , Boqun Feng , Borislav Petkov , Dmitry Vyukov , Ingo Molnar , Josh Poimboeuf , Mark Rutland , Thomas Gleixner , Waiman Long , Will Deacon , kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org Subject: Re: [PATCH -rcu/kcsan 23/23] objtool, kcsan: Remove memory barrier instrumentation from noinstr Message-ID: References: <20211005105905.1994700-1-elver@google.com> <20211005105905.1994700-24-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=Y25YDRrK; spf=none (imf27.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-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: CE12B70000B3 X-Stat-Signature: sdx69ci8giqxek136qr94y3bn3mswhu4 X-HE-Tag: 1636630511-589921 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 11, 2021 at 11:11:00AM +0100, Marco Elver wrote: > On Tue, 5 Oct 2021 at 17:13, Marco Elver wrote: > > So this is where I'd like to hear if the approach of: > > > > | #if !defined(CONFIG_ARCH_WANTS_NO_INSTR) || defined(CONFIG_STACK_VALIDATION) > > | ... > > | #else > > | #define kcsan_noinstr noinstr > > | static __always_inline bool within_noinstr(unsigned long ip) > > | { > > | return (unsigned long)__noinstr_text_start <= ip && > > | ip < (unsigned long)__noinstr_text_end; Provided these turn into compile time constants this stands a fair chance of working I suppose. Once this needs data loads things get a *lot* more tricky. > > | } > > | #endif > > > > and then (using the !STACK_VALIDATION definitions) > > > > | kcsan_noinstr void instrumentation_may_appear_in_noinstr(void) > > | { > > | if (within_noinstr(_RET_IP_)) > > | return; > > > > works for the non-x86 arches that select ARCH_WANTS_NO_INSTR. > > > > If it doesn't I can easily just remove kcsan_noinstr/within_noinstr, and > > add a "depends on !ARCH_WANTS_NO_INSTR || STACK_VALIDATION" to the > > KCSAN_WEAK_MEMORY option. > > > > Looking at a previous discussion [1], however, I was under the > > impression that this would work. > > > > [1] https://lkml.kernel.org/r/CANpmjNMAZiW-Er=2QDgGP+_3hg1LOvPYcbfGSPMv=aR6MVTB-g@mail.gmail.com > > I'll send v2 of this series after 5.16-rc1. So far I think we haven't > been able to say the above doesn't work, which means I'll assume it > works on non-x86 architectures with ARCH_WANTS_NO_INSTR until we get > evidence of the opposite. Fair enough.