From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-17.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by gnuweeb.org (Postfix) with ESMTPS id 0A0AC7ED9F for ; Thu, 16 Jun 2022 17:32:52 +0000 (UTC) Authentication-Results: gnuweeb.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=HH6FOscT; dkim-atps=neutral Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-3176b6ed923so20432167b3.11 for ; Thu, 16 Jun 2022 10:32:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=55Cn1sEgSzXcQdM8QrLwAm9bELIxP5xfzUniTUdbstU=; b=HH6FOscTmQ7MBP31vrErimU/eo4KKSffaXGDeed4hNDrAKFeKAIQ1raAD1WAvvwMp/ bc0m9RKAD1+XHhQ7WfmPgTD8FKCrczYw6lBKkD2r9ONy2hXuUCE9ak7mcHoHJy3ctBE7 WO5WMr7v59yvfoGdax11rMai9J/qux/jNHmz1oa5eiC+0SKkaB3kJEJ9blPQGOlCfdE8 aBU4Ro5Wstq7yemMAwgjwT4O3CAehJSUjQukGj94B7ysxrPoPt2R9moPZacISQq6vAlq jwGc6MkDf2b9lLFZEGMXzUOvMBld+h/57R5UgDiQJx6ciAAXH6PsjHeAnJZaN3bVEF5T 0Qfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=55Cn1sEgSzXcQdM8QrLwAm9bELIxP5xfzUniTUdbstU=; b=sSOSvwIlZbHmej/mwhsanMizCzOAwsVf7O6WkCuIFjw1tfWIGd/dNpknK4DzYCwhvc cMiTs6k7E9FnUoueEnREE6iz7t/nFaOYFFqxNef4B2cuP49eHGZKWkRrKCj6dk79ZSI8 a0ZSdhDPEO5jFKL5q+R60u90w0BSh2bpZCCnSZtZ1rDuBPZH6BbDjnLhy3oiEkzokadC wcJBQ5UogvGSaYqAedQVAFFxTRpi0TRiug46RQxdBFCEHD6MYxkg6FiOoLdMLM8uaHlZ kuBcixwjKrAC6EviuezD37rWRjoec3TNCsainN5NVBQyOpKZVHCL2ydGpwWxEae/+tN3 Nnhw== X-Gm-Message-State: AJIora9Cveq8Y4NB9xWCAus8+Yd6W90BtOykpppat2587t0nCBI544Cl QjEi0vi5DadmyUXHy6JkbRyeQjr+8mKromLBfpoQeQ== X-Google-Smtp-Source: AGRyM1tTdpKuPdJcXoffkkKOJK/nvenMrG6oAb6SqfL0kfxu1KAA+GrGfr+7rpz+rRM/re9AiuFoQ8RFg/7Ku3DwxFQ= X-Received: by 2002:a81:574c:0:b0:317:7c3a:45be with SMTP id l73-20020a81574c000000b003177c3a45bemr1023782ywb.316.1655400770724; Thu, 16 Jun 2022 10:32:50 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <20220616164416.GA2130702@paulmck-ThinkPad-P17-Gen-1> From: Marco Elver Date: Thu, 16 Jun 2022 19:32:14 +0200 Message-ID: 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 To: paulmck@kernel.org Cc: kernel test robot , Frederic Weisbecker , kbuild-all@lists.01.org, "GNU/Weeb Mailing List" , linux-kernel@vger.kernel.org, dvyukov@google.com Content-Type: text/plain; charset="UTF-8" List-Id: 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. 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. Reviewed-by: Marco Elver > 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 >