Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1666237iog; Thu, 16 Jun 2022 11:03:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ujzcCfP9VEbZoYOeqcHjEnyh0n6XmjpTUUKrW0hV5iyIOHte1JpWTOWaYHOcvkX7bCT4pP X-Received: by 2002:a50:ec89:0:b0:42d:cc7f:abbe with SMTP id e9-20020a50ec89000000b0042dcc7fabbemr7976662edr.381.1655402613763; Thu, 16 Jun 2022 11:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655402613; cv=none; d=google.com; s=arc-20160816; b=XYU38wZFALhqjbkKjUSbfHrBnQXPxrjYSfhTA7ZUFNQsG3Ij+JDgX5syQFfR6Vxsvx Vpejgw8I0Wn2dTj+1gMxPUghZb3qvAh3EftaIa/A1pX1na65lmToeUO0KYJC4ZLdUWHZ L9QrHvhe0o8nMcEa/CUHKO9DJE2ierj+at3+wuq846MqWjMuFng3ES+ONE1uYcnOyfrA Yd28ZIo8UL4iKUW/11XUB2Sv4/lfqfvWkk+UmTsvSUgCwQzvqs8yI0CD9c77pLztqkib TKGAE59pEJuFG5XoQAdEryiijhnJq7BqGASZzx09nAfdesGRagAbHNUrVCBrm6wSMdLm N2Yg== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jusCbzqYHrRIHMBHN1H2gaQZshdt0ppP5ys6fzb9qck=; b=04rTZ02fNwT5hNXADg38jnx7sIQ/UGgnziZZ+GWR55dUDPu484C+MOP4hX8lBd5RJ9 bndeYcZwhuyojaCvwonkeLObUVTATbsbsT0usESnTtejDGsS1eb5w8M9cz+ECun29ueh V1AJ/tP4W8uKnkm3hei713JdktHeKen6c0LiSej20ZBr2KlWNmjeKeuk/hnOq2925yD3 Yep0Onwocmt/jlu3Chk79Cwb63xBT5zT/rX2IZg4nZmE23un+2vNjFlRY5Hpcfhkw3E4 GQh1TvAA4xiZEVzEkuMF9umVUMEaAb+TZTl+fQh8M/vXn/omGNX5Il87H75c2UVP+g1C tmDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pfDQHgzm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn9-20020a1709070d0900b006e7d38a8843si3179676ejc.443.2022.06.16.11.03.03; Thu, 16 Jun 2022 11:03:33 -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=@kernel.org header.s=k20201202 header.b=pfDQHgzm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245545AbiFPRuR (ORCPT + 99 others); Thu, 16 Jun 2022 13:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243248AbiFPRuF (ORCPT ); Thu, 16 Jun 2022 13:50:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC93C4CD54 for ; Thu, 16 Jun 2022 10:49:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE507618E8 for ; Thu, 16 Jun 2022 17:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 497A1C34114; Thu, 16 Jun 2022 17:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655401779; bh=jp1i6DksrsdnGuY6hAh7dLb7WYttM9+yqrIKrAy/6uE=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=pfDQHgzmtWaBJKpDvwlmP1yzyxM5SWS61HqtJm3N3UJpsz67Tj9NYlEsuiXWCAUY9 nAv9iSGsY3Duygyt2kbPm/womtj8NXdaeaepILarnRrSfKIC6RFUnP3XuGG9ZbS7u+ gWG1eb1TJ9v9jXCLLnCPeIz/HR+6CFbjiunK5rFraJcFqORYiwTlpumQDnttPM05ds G3mX9xDcZA2UEoG80sC1FKyC9doKe/MkSNFi8T2V3wE8b3Q/KTeMDovBJoivL71LiD XQN3f+LdlQnniIp3wmAEKu1hmHS8ysa3Fg0+ASs5LTKSBYE3A4tHDS8aq+FckhI63Z yJm3Te9ouN4eg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id AFB135C0531; Thu, 16 Jun 2022 10:49:38 -0700 (PDT) Date: Thu, 16 Jun 2022 10:49:38 -0700 From: "Paul E. McKenney" To: Marco Elver Cc: kernel test robot , Frederic Weisbecker , kbuild-all@lists.01.org, GNU/Weeb Mailing List , linux-kernel@vger.kernel.org, dvyukov@google.com Subject: Re: [ammarfaizi2-block:paulmck/linux-rcu/pmladek.2022.06.15a 133/140] vmlinux.o: warning: objtool: __ct_user_exit+0x41: call to __kasan_check_read() leaves .noinstr.text section Message-ID: <20220616174938.GR1790663@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <202206160411.v3iL3YC0-lkp@intel.com> <20220615204039.GI1790663@paulmck-ThinkPad-P17-Gen-1> <20220615211717.GA972937@paulmck-ThinkPad-P17-Gen-1> <20220616134021.GP1790663@paulmck-ThinkPad-P17-Gen-1> <20220616164416.GA2130702@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Thu, Jun 16, 2022 at 07:32:14PM +0200, Marco Elver wrote: > On Thu, 16 Jun 2022 at 18:44, Paul E. McKenney wrote: > [...] > > > > > > > >> vmlinux.o: warning: objtool: __ct_user_exit+0x41: call to __kasan_check_read() leaves .noinstr.text section > > > > > > > >> vmlinux.o: warning: objtool: __ct_user_enter+0x7f: call to __kasan_check_read() leaves .noinstr.text section > [...] > > > > It's due to the atomic_read()s within the noinstr function. Within > > > > noinstr you can use arch_atomic_read() to avoid the instrumentation. > > > > > > Thank you, will fix! > > > > And please see below for an alleged fix. > > Looks good, if this made the above warnings go away. Here is hoping! I will see if I can reproduce locally. ;-) > Btw, it's not just KASAN, but arch_atomic_read() also disables KCSAN > checking. A similar warning would have been generated in a KCSAN > config. Good to know, thank you! Additional local-reproduce opportunities. > Reviewed-by: Marco Elver Applied, thank you! Thanx, Paul > > ------------------------------------------------------------------------ > > > > commit 81e24ca26ee9933bcacf67a61e3f6ae41a025442 > > Author: Paul E. McKenney > > Date: Thu Jun 16 09:30:37 2022 -0700 > > > > context_tracking: Use arch_atomic_read() in __ct_state for KASAN > > > > Context tracking's __ct_state() function can be invoked from noinstr state > > where RCU is not watching. This means that its use of atomic_read() > > causes KASAN to invoke the non-noinstr __kasan_check_read() function > > from the noinstr function __ct_state(). This is problematic because > > someone tracing the __kasan_check_read() function could get a nasty > > surprise because of RCU not watching. > > > > This commit therefore replaces the __ct_state() function's use of > > atomic_read() with arch_atomic_read(), which KASAN does not attempt to > > add instrumention to. > > > > Signed-off-by: Paul E. McKenney > > Cc: Frederic Weisbecker > > Cc: Marco Elver > > > > diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h > > index 0aecc07fb4f50..81c51e5f03143 100644 > > --- a/include/linux/context_tracking_state.h > > +++ b/include/linux/context_tracking_state.h > > @@ -49,7 +49,7 @@ DECLARE_PER_CPU(struct context_tracking, context_tracking); > > > > static __always_inline int __ct_state(void) > > { > > - return atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK; > > + return arch_atomic_read(this_cpu_ptr(&context_tracking.state)) & CT_STATE_MASK; > > } > > #endif > >