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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C47AC433F5 for ; Wed, 2 Mar 2022 11:33:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=EvpdwKWIcWPEIQJVPriB4cG3eN9v0wJKNiLTEc/TcGs=; b=G54xssWj2Ex3kz Md8DBcXuj14MMMhqlQCnnTEb5s+PuCY6NmPwIOTB934sDAEDeOIeHCoPzbEKBGZs3668zBFzTdT76 quvydg6B58pJZT0GkqSoN6ZjK1RexXHa1um7GPk+b3zcDOhJCfvCncwznzqalC48zTGDDTcGNgB7Z 2lyoqcWOF6kdTRP4QedtHqyalCWERLI5n1f3MQp4HQsaakrKeCHLiE8Y+UL/+2PIEqvAmu/6PaPwl T3SiZS+gTlVHTKoRjGe3zl6mhqhBmMhqyTIebcUcJFgaVlGiJpTwlfmuVCIMDZCe1dX1f2mUefk6d Z7hRLNIEeX4yFU5CLe7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPNDR-002UHg-6l; Wed, 02 Mar 2022 11:32:21 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPNDN-002UH2-J3 for linux-arm-kernel@lists.infradead.org; Wed, 02 Mar 2022 11:32:19 +0000 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 ams.source.kernel.org (Postfix) with ESMTPS id 35A88B81EFE; Wed, 2 Mar 2022 11:32:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F4084C004E1; Wed, 2 Mar 2022 11:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646220735; bh=5SFlsIEQq1XcLQx2ZDtTE8QhmdDZj+1FUalS83aYHhw=; h=From:To:Cc:Subject:Date:From; b=czEvFi+FbZTpJzEnLvhieVL8053Wl3rI5Wl52qRVRz4RoB/vWN/bttxBK82Q5qqHf Y4/BRNWQk5HZn/KoKwVMfB4VFeFN+fdnus6JgwYs2NhFyIciFQQ/Cidp4/jyYD9rdL 32hfyRDlyq7RqhqpzR5UMCBTNVMqM4uSS1Hx/b9haaleRzaQPUY/TZUx1mDRLWVtwt xplFtwDmqyCDHFZQ7GDSVsRoEvQQU4B0/5DpcVt0J1QnJsYkRSgz9z00Xipx0BJ10k TNYFFxlxgv/TkwliBLiQtpt3MJNrIntzJ/G6cC/rLFdGy4SpRIl6/C99rAqAdMlxuW /UzVkqR/T0uvw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Corentin Labbe Subject: [PATCH] ARM: return_address: disable again for CONFIG_ARM_UNWIND=y Date: Wed, 2 Mar 2022 12:32:01 +0100 Message-Id: <20220302113201.1864406-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2630; h=from:subject; bh=5SFlsIEQq1XcLQx2ZDtTE8QhmdDZj+1FUalS83aYHhw=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBiH1WwAK/FiwFf7eTCALOltWHRiJa+Mky0Pf5inZBJ T+MeUnaJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYh9VsAAKCRDDTyI5ktmPJE03C/ 97hXx7l/vzuDlSXdaPWlRM6I+cesK2IYrHcVA+ncBgyTMaqcTTtLScjh9YuGKugYMMM+c3IpZPIk46 No8UMwQjErfutfDGaMWH6zYR9b3dp3Hmble3FXSutsK0tzEBj2VGiXZInGQeJLxIM0zDqmu2RX4UL8 e2rfSFiIjz84Y+xBcYyOC/5M1SNHi6kw3PojHVvNXq5PWUmzR6z3xCM8G79iGVAeu0MxlnAXowLp+R auUtR5jVOdh4vnkQc3ULxClyMIVK1YbjLDyQs7q3JIQ2NVdNpEE11gluM2CxlbSlvyv5NDTVWCmswT CXxA4zwk/CQyiHlPWoltwB7fhUiWSoQW/qPukFZMcAuNKM7QagcozrmORBk4ol12TERBOOIDTto5c8 Dv4dXJRvKm7IF8u4SP13LoYyveI/kSC8TTnx4piHC4S5GTEIQPILdbgLMVRdRCISadVRlzLCD52kzO JW1St3wwJhJzRFPBrIvpECddvmcpvtLikSEsM2BpvqNEQ= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220302_033217_956312_F7B43454 X-CRM114-Status: GOOD ( 15.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel