Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp253785pxm; Wed, 2 Mar 2022 14:40:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYXaYh07NM4LkkdYhOgQjMvZXg8+XFoCT4Lpy1DPObzjQTe5AlLyZo48jgI8LEBdQXg4Ku X-Received: by 2002:a63:2314:0:b0:370:5429:84ed with SMTP id j20-20020a632314000000b00370542984edmr28169339pgj.469.1646260826021; Wed, 02 Mar 2022 14:40:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646260826; cv=none; d=google.com; s=arc-20160816; b=kD+ES+ahspZG0nvo8oYiedl81OY9iskVmhhVnDoS8cECNVivYVxzx+RKKNjruJpjSf VK91K5OOhJMN3VPTun81BEphbz5QKawvYmspjzARpgncJnaPff/BPNcYfzrLCe0eZLJS 0vQLo4N6KVF4pssyW+gp34ineJbbViFiMpniwL0vCbgjMuL7SwYOUwC26MzMiFP9DDG5 BcDXK/DV2ofdtDJxmU9EqGzUPCddY/LzO7jeVag1pAoB0daZEury535YEPUGl1hx2JeF 1SchU1gtwn9iho2mIHQ9VuC9t3pMfdD3EdBPA0wYJ1uHLIZ6y8DX0FWMj9Pq4oQy2XAP OOrw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=JEEYQR28aCloRRLqefUizpnHK6W5GlhdIkcq9mPHcXs=; b=PyyhLeDjbR/R8cU7H0TAQ9xGTIEFzQS19wo/IiE7HWhpkp42zbN0Q52eeyuH+hpA0a oYTizJRDzOldIshgLHrmOM60yLgJh2/slB8ncRk6uQHFO5FEuI0HRICRRIchvWbr0MpQ 12JjKnNE0MhzwmXGWi12lz0DKiGNjDGDWfprCRj6wXaP/t/2aHh9WEv0MVUB2LAVzCgL DRtmLeBQODeKNvkMPIUeYsNnEUcxNWRkrhtrSvr/d8H8t0DFpORQDzwaDAg9ysuF/rGZ eFQKVEOoWk9C8dDQY+y1wbsmQEX8PVMmpgaZOGCNMzFwWkOA6tIWe4LP3h0O3JuBAior CydQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k2XRyMYJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w18-20020a170902e89200b001518e753a1fsi339096plg.374.2022.03.02.14.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:40:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k2XRyMYJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4209CFEB37; Wed, 2 Mar 2022 14:36:10 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241881AbiCBMo1 (ORCPT + 99 others); Wed, 2 Mar 2022 07:44:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241885AbiCBMoZ (ORCPT ); Wed, 2 Mar 2022 07:44:25 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213F58F9A6 for ; Wed, 2 Mar 2022 04:43:39 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id n14so2591491wrq.7 for ; Wed, 02 Mar 2022 04:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=JEEYQR28aCloRRLqefUizpnHK6W5GlhdIkcq9mPHcXs=; b=k2XRyMYJYkEP6XEKB7cdLJ190JESykZzXQvhU7bLNl2lsG+FShKBlnpYNjnFRV5uIM ybmlj5Mq94zokFwdLPnfSKkuLZH0kHgNTkvcPeQI2Fa2CBS5MTCIrmCBe0+Fsiik3pQ3 3etb05nh4EnOywFVJhKPKLLnbV7GzJR8rb4KoDUjj0H6EvZ14j4ZVLwpHMT7CNw4uEDA hy5VOljLrASupWEybrn6diB65BXkrQ3OcKTfLN938fTHNP9HwvM4V92lx20H0xChCAuV Sq7cldj2nTylq6SJGiiXNb84qpcbAM5Oqr1vxdPSzQ4reX7hdqLRBsK1eec0bqE3pnbo rrdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=JEEYQR28aCloRRLqefUizpnHK6W5GlhdIkcq9mPHcXs=; b=dqjYtYLJSocIt1d4IYXh/xKIOhUmI24K8Uu5gl4Wc4BQwOEBIVjG2EIpzIDFelTUOj eqgfDfUNGRRbvTyZMvGtUWpFMDvjesGV5qtdsQzz99geYYDLrlNArsAs0RvOPnPv95qJ 38XmtE56xO2u3SexOVyVN5TGwW8RdiujnL+iZUjdXGD3As9FwkcEYrfyedcKb7OHDkuH b8mRXTuU//b5ylD8ca9B2wBAi5T2i6ppy9uQkdwtPeISJJxZcax0NJNYfN+CLfb7y1F1 1xcayI5oygCLN8wf/RuqNs8g6qSIK3sugc4UB8wfdsJqPlcuAW6WLgjTSNwtqQBT5AtW 5iEg== X-Gm-Message-State: AOAM531HO+sUi5kjKJva7phxq5JNTBUf8vx5oKvAIy6nAq/8mmQhvCBR cFMVc7nchZ7kYTiwPkY+ArY= X-Received: by 2002:a05:6000:188b:b0:1f0:46f4:a494 with SMTP id a11-20020a056000188b00b001f046f4a494mr967528wri.259.1646225018457; Wed, 02 Mar 2022 04:43:38 -0800 (PST) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id e4-20020a05600c218400b003818133ab4dsm5412044wme.14.2022.03.02.04.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 04:43:38 -0800 (PST) Date: Wed, 2 Mar 2022 13:43:35 +0100 From: Corentin Labbe To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ARM: return_address: disable again for CONFIG_ARM_UNWIND=y Message-ID: References: <20220302113201.1864406-1-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220302113201.1864406-1-ardb@kernel.org> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Le Wed, Mar 02, 2022 at 12:32:01PM +0100, Ard Biesheuvel a ?crit : > Commit 41918ec82eb6 ("ARM: ftrace: enable the graph tracer with the EABI > unwinder") removed the dummy version of return_address() that was > provided for the CONFIG_ARM_UNWIND=y case, on the assumption that the > removal of the kernel_text_address() call from unwind_frame() in the > preceding patch made it safe to do so. > > However, this turns out not to be the case: Corentin reports warnings > about suspicious RCU usage and other strange behavior that seems to > originate in the stack unwinding that occurs in return_address(). > > Given that the function graph tracer (which is what these changes were > enabling for CONFIG_ARM_UNWIND=y builds) does not appear to care about > this distinction, let's revert return_address() to the old state. > > Cc: Corentin Labbe > Fixes: 41918ec82eb6 ("ARM: ftrace: enable the graph tracer with the EABI unwinder") > Signed-off-by: Ard Biesheuvel > --- > arch/arm/include/asm/ftrace.h | 18 ++++++++++++++++++ > arch/arm/kernel/Makefile | 5 ++++- > 2 files changed, 22 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h > index 5358aad67831..7e9251ca29fe 100644 > --- a/arch/arm/include/asm/ftrace.h > +++ b/arch/arm/include/asm/ftrace.h > @@ -35,8 +35,26 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr) > > #ifndef __ASSEMBLY__ > > +#if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) > +/* > + * return_address uses walk_stackframe to do it's work. If both > + * CONFIG_FRAME_POINTER=y and CONFIG_ARM_UNWIND=y walk_stackframe uses unwind > + * information. For this to work in the function tracer many functions would > + * have to be marked with __notrace. So for now just depend on > + * !CONFIG_ARM_UNWIND. > + */ > + > void *return_address(unsigned int); > > +#else > + > +static inline void *return_address(unsigned int level) > +{ > + return NULL; > +} > + > +#endif > + > #define ftrace_return_address(n) return_address(n) > > #define ARCH_HAS_SYSCALL_MATCH_SYM_NAME > diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile > index 5cebb8d5a1d6..56511856ff9d 100644 > --- a/arch/arm/kernel/Makefile > +++ b/arch/arm/kernel/Makefile > @@ -25,7 +25,10 @@ obj-y := elf.o entry-common.o irq.o opcodes.o \ > KASAN_SANITIZE_stacktrace.o := n > KASAN_SANITIZE_traps.o := n > > -obj-y += return_address.o > +ifneq ($(CONFIG_ARM_UNWIND),y) > +obj-$(CONFIG_FRAME_POINTER) += return_address.o > +endif > + > obj-$(CONFIG_ATAGS) += atags_parse.o > obj-$(CONFIG_ATAGS_PROC) += atags_proc.o > obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += atags_compat.o > -- > 2.30.2 > This patch remove the RCU warning and the boot is now clean. Reported-by: Corentin Labbe Tested-by: Corentin Labbe Thanks!