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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45A97C433F5 for ; Thu, 21 Oct 2021 10:16:40 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id F2A4F60F5D for ; Thu, 21 Oct 2021 10:16:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2A4F60F5D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+7TNkguTrUBsHpoF0rRRj8HgUUMMm50on6oYRVJK67I=; b=Z8GOlAgDFn5cXl 1KnrbBlTlteLHfvwbhoYGPTCU+ls6el6UrRYJfuUHLYpd0dh7Ac2BgrkjJZsT7YBDTiW6aVfvigzE la0RpiJfjrS1UuE9aGtgCw7lacUCr143v0sawT6H/5Np63O/M90ZrwGsea3K/DaaNMzbwSYsraELA 9fcfFTqF6cRQbzc1kH1yB6Aa/axTDI73vbWydFIXcaKbkmKgAwWy8Z1pV2xbrtnd/tvCPcH8DyUS+ piRMmA6O/LLGGgzjHZc904fs0JHrlqoK4PjnuYZ/zrstlXP36d02oCaPUSegs88ZzH5eD6FK0tGZu ruqh4Bcv/0xC/g5Em3HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdV6Y-007Bby-Hk; Thu, 21 Oct 2021 10:15:22 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdV6U-007Bax-JJ for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 10:15:19 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 337EA60F5D; Thu, 21 Oct 2021 10:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634811318; bh=3KefFL9wea8DymntAjOwwZ1IuPc4DgkYtD4ihJq/Jg4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UAuJ1gP781Re1GFx0uf+8Six0abPXdp+RqIPiZT4Fp4TTOW+do9UYc9J+0eDBoWc/ r7K2iFyLkcQjqurZnrX8meqfVLV0YjbTi3JQyKUfBmYyaN+UMHDH7o3w+HhhSsRkJL EcJdrgy5kpWIPgUGK2I+49v6f84EJoQ6VdBUgSKJ/3SdY3uZGej/3Yjk1+aExRzf07 MREitKO4Ez+0MhENJ7+W6vK/LkSFRGlwOd7pIbsvHUZqr1duatR4NIzMvcOsowfppE FyL2Z179gYlqHPk4X/vQmbiy+FL2JHgC/Npzv30jkZJEYlMRnv54E/55UQvS/41GSK Ur3Yo0plHKhQQ== Date: Thu, 21 Oct 2021 11:15:12 +0100 From: Will Deacon To: Masami Hiramatsu Cc: Steven Rostedt , "Naveen N . Rao" , Ananth N Mavinakayanahalli , Ingo Molnar , linux-kernel@vger.kernel.org, Sven Schnelle , Catalin Marinas , Russell King , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v3 6/9] arm64: Recover kretprobe modified return address in stacktrace Message-ID: <20211021101512.GA16485@willie-the-truck> References: <163477765570.264901.3851692300287671122.stgit@devnote2> <163477770935.264901.1772964361191833681.stgit@devnote2> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <163477770935.264901.1772964361191833681.stgit@devnote2> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211021_031518_683943_1CE276A5 X-CRM114-Status: GOOD ( 18.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 On Thu, Oct 21, 2021 at 09:55:09AM +0900, Masami Hiramatsu wrote: > Since the kretprobe replaces the function return address with > the kretprobe_trampoline on the stack, stack unwinder shows it > instead of the correct return address. > > This checks whether the next return address is the > __kretprobe_trampoline(), and if so, try to find the correct > return address from the kretprobe instance list. For this purpose > this adds 'kr_cur' loop cursor to memorize the current kretprobe > instance. > > With this fix, now arm64 can enable > CONFIG_ARCH_CORRECT_STACKTRACE_ON_KRETPROBE, and pass the > kprobe self tests. > > Signed-off-by: Masami Hiramatsu > --- > Changes in v2: > - Add comment for kr_cur. > - Make the kretprobe related code depends on CONFIG_KRETPROBES. > - Initialize "kr_cur" directly in start_backtrace() instead > of clearing "frame" data structure by memset(). > --- > arch/arm64/Kconfig | 1 + > arch/arm64/include/asm/stacktrace.h | 4 ++++ > arch/arm64/kernel/stacktrace.c | 7 +++++++ > 3 files changed, 12 insertions(+) Acked-by: Will Deacon I'm not sure how you're planning to merge this, so please let me know if you want me to queue any of the arm64 bits. Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel