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 2B97EC433EF for ; Tue, 1 Mar 2022 22:07:03 +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=StDejYYf/14N5tHUAVmH4tlBCIVbFtXvqLTc2384c0o=; b=lU8INc1tiDCdW/ 1DYLv9JGmS/osVCu0TFzzcedGmDSFaI6PB9HTGNIa92ESca8Wo0gftKGk8CudnpxYf7ai1mjHmu4c mitZ4nKWWLotmSmUgxGGDfmtRKhUnmGCtXXXf7bgFgOjvcPYXtPEfgyLe19FWXRi2s8X7PEZ9ky7a kFqD8yPxvxAUffwAgRkld9nNggacBJHyHFTHhTsWYOKKmgTwsVevGknLP6cHKY9R8e124Tsq1BCfD ByAtT6RCfwyHs/R0nqUPOyLHEZTlhRAtXewJo8wBWKwvfnYlps7637GIZWjBXFWihTfh4z844wk5o eIG6SA0puFFYqVJ77GPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPAd3-000j6R-UY; Tue, 01 Mar 2022 22:05:58 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPAd0-000j5g-0i for linux-arm-kernel@lists.infradead.org; Tue, 01 Mar 2022 22:05:55 +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 9DAD9B81E53; Tue, 1 Mar 2022 22:05:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5D89C340F1; Tue, 1 Mar 2022 22:05:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646172350; bh=AzSHCJ3xPtnNnWyMaMLEZ7IehclGTOLbYe+DKx3fOOM=; h=From:To:Cc:Subject:Date:From; b=EnUR0+eUpeT4kcW+IaqTetrxgeW2ZeyL/rJ9721M8W1FKt8UHl6Q8vJ2c0cV9xlG4 ylOkZxJ+TiS8/Vp2P6n20zm56okM5Pif3qnp1+BoCzVSxBhZfTOKzRl6wnwMOuB+1s LJvuYTEVnQezCVVHjRqRRRj7QAaHCSgBrssRV3n6kjsxlDhg5TZmK1IZXGSBfgOYLS sprm3CHGPsfN6sixKAb7RoukXU7ay1c4sQOKrF55EBXo0duYdGd3oYSRX25dZi9j7Q +52vO0YqmQ8VC8EBW4fX33oJbokiEaSebkQPcyA8JcEaGkDgNseUKmmqjSlgXQ8I8+ 14+KpQNo1q9JQ== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux@armlinux.org.uk Cc: Ard Biesheuvel , Corentin Labbe Subject: [PATCH] ARM: unwind: avoid spurious warnings on bogus code addresses Date: Tue, 1 Mar 2022 23:05:36 +0100 Message-Id: <20220301220536.1302898-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=2059; h=from:subject; bh=AzSHCJ3xPtnNnWyMaMLEZ7IehclGTOLbYe+DKx3fOOM=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBiHpivRWvLu8W2xAanJWLrKG9i9XaaVq9ZQqXYEUE9 V0M3WBeJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYh6YrwAKCRDDTyI5ktmPJOlTDA CDoNyJ3e6naPF2VFR6YW3pE3TET8kENs98X2mNQhMkhAxrq2SAuFNsQ+hiQBCs56wOGlVdXJWi+mUG UwBlJ+nZ8oWd+M9DMeqvy7ymyIFGEmyLOZpmHV5YEtdMm9JwhP8ifH415Dy/WqW2KkkW8YnINjJe5X z/CWlmgIGXtLSyrLQGHkFVBWBhb/J8VxyxBviE69244mCG36slN3OOmRE+wYpbNowssBSvn2vLBKzO P6Lg7JpPjQHTeF+sLNupiIpH5ejppDjxI5ImfN6spI9jeS9vagWzpfMIfUtZlEo2SJbAy91F1f2bQ5 70rHcgeouOrfZ9diZnJrkYkCALs/K3ELUFMzoEhqRbjuIA627SeBAGWoh7vIsGhzisV1fE57+rRGaq KymMxXwBRg2xOm44P+mFI4dhDfsqG1t1+M90Q/hHHjdKBBdfZ19UTj8kbicySAqxJ8Oqw5u0YD0mSe PoKGBBkifmpUIcvVWO3yFNm+147NN/QmxnkwsXM0IDb0M= 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-20220301_140554_374391_1BAC8A54 X-CRM114-Status: GOOD ( 16.64 ) 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 Corentin reports that since commit 538b9265c063 ("ARM: unwind: track location of LR value in stack frame"), numerous spurious warnings are emitted into the kernel log: [ 0.000000] unwind: Index not found c0f0c440 [ 0.000000] unwind: Index not found 00000000 [ 0.000000] unwind: Index not found c0f0c440 [ 0.000000] unwind: Index not found 00000000 This is due to the fact that the commit in question removes a check whether the PC value in the unwound frame is actually a kernel text address, on the assumption that such an address will not be associated with valid unwind data to begin with, which is checked right after. The reason for removing this check was that unwind_frame() will be called by the ftrace graph tracer code, which means that it can no longer be safely instrumented itself, or any code that it calls, as it could cause infinite recursion. In order to prevent the spurious diagnostics, let's add back the call to kernel_text_address(), but this time, only call it if no unwind data could be found for the address in question. This is more efficient for the common successful case, and should avoid any unintended recursion, considering that kernel_text_address() will only be called if no unwind data was found. Cc: Corentin Labbe Fixes: 538b9265c063 ("ARM: unwind: track location of LR value in stack frame") Signed-off-by: Ard Biesheuvel --- arch/arm/kernel/unwind.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index b4e468a7674b..04ccff9d9793 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c @@ -400,7 +400,8 @@ int unwind_frame(struct stackframe *frame) idx = unwind_find_idx(frame->pc); if (!idx) { - pr_warn("unwind: Index not found %08lx\n", frame->pc); + if (frame->pc && kernel_text_address(frame->pc)) + pr_warn("unwind: Index not found %08lx\n", frame->pc); return -URC_FAILURE; } -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel