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 32E6CC433F5 for ; Thu, 14 Oct 2021 10:32:26 +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 EDF2C60295 for ; Thu, 14 Oct 2021 10:32:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EDF2C60295 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com 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=/XhN0Ue/dbp9PlH+rts3neSlLLXyWPlRtWUB35VhDgA=; b=uFehCxf43pD5bQ I546nIiJNFaeddhX1c6tl8ERV/l/zG6sNOdGUti91et3lQGinlgO68tTX0vQcZJVPz409l7xZ/v+O c4mwwNOGRzyV/mUsiNcHB5dSFbjfpvGrXO/zhhO+97Hjfp34zm1rfgUvqJKhVJvVROz5yITTSLlpM 4AIfuwzbH0AWIXEds8ZqyR4VYIlhyV/eZtkc+pF9V5dCTkf8itvYGMWJUmiYr78XNi5skcnR9kv3p jdMaQtrN44m6za4zdLcAIsBqoFRYWS3Y2gqz8qvsCECy58CNPcRI2jGZbilZ+OyRn3W3rkRftftg1 wt4L+QyAIVkNbPyZXClQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1maxze-002a4o-Gu; Thu, 14 Oct 2021 10:29:47 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1maxxC-002YpW-3A for linux-arm-kernel@lists.infradead.org; Thu, 14 Oct 2021 10:27:15 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E7D6611D4; Thu, 14 Oct 2021 03:27:07 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.73.197]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8C1D93F66F; Thu, 14 Oct 2021 03:27:05 -0700 (PDT) Date: Thu, 14 Oct 2021 11:27:02 +0100 From: Mark Rutland To: Masami Hiramatsu Cc: Steven Rostedt , "Naveen N . Rao" , Ananth N Mavinakayanahalli , Ingo Molnar , linux-kernel@vger.kernel.org, Sven Schnelle , Catalin Marinas , Will Deacon , Russell King , Nathan Chancellor , Nick Desaulniers , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 3/8] arm64: kprobes: Record frame pointer with kretprobe instance Message-ID: <20211014102702.GB13770@C02TD0UTHF1T.local> References: <163369609308.636038.15295764725220907794.stgit@devnote2> <163369611948.636038.11552166777773804729.stgit@devnote2> <20211013100126.GA3187@C02TD0UTHF1T.local> <20211014170405.f59d287b30086efe7dd7f4d9@kernel.org> <20211014091332.GA13770@C02TD0UTHF1T.local> <20211014190155.3fdc7cf7c42e44ee75c43a9d@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211014190155.3fdc7cf7c42e44ee75c43a9d@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211014_032714_266132_A64030E6 X-CRM114-Status: GOOD ( 25.03 ) 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 14, 2021 at 07:01:55PM +0900, Masami Hiramatsu wrote: > On Thu, 14 Oct 2021 10:13:32 +0100 > Mark Rutland wrote: > > > On Thu, Oct 14, 2021 at 05:04:05PM +0900, Masami Hiramatsu wrote: > > > On Wed, 13 Oct 2021 11:01:39 +0100 > > > Mark Rutland wrote: > > > > > > > On Fri, Oct 08, 2021 at 09:28:39PM +0900, Masami Hiramatsu wrote: > > > > > Record the frame pointer instead of stack address with kretprobe > > > > > instance as the identifier on the instance list. > > > > > Since arm64 always enable CONFIG_FRAME_POINTER, we can use the > > > > > actual frame pointer (x29). > > > > > > > > Just to check, why do we need to use the FP rather than SP? It wasn't > > > > clear to me if that's necessary later in the series, or if I'm missing > > > > something here. > > > > > > Actually, this is for finding correct return address from the per-task > > > kretprobe instruction list (suppose it as a shadow stack) when it will > > > be searched in stack-backtracing. At that point, the framepointer will > > > be a reliable key. > > > > Sure, my question was more "why isn't the SP a reliable key?", because both > > the SP and FP should be balanced at function-entry and function-return > > time. I'm asking because I think I'm missing a subtlety. > > Ah, because SP is not used while unwinding frame. For the kretprobe, > either FP or SP is OK. But for the stacktrace.c, I can not use SP > and is easy to change to use FP. :) Ah, so this is just so that stacktrace can match the address. For clarity, would you be happy to add a sentence to the commit message like: | This will allow the stacktrace code to find the original return | address from the FP alone. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel