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 18989D1712B for ; Mon, 21 Oct 2024 19:36:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WYUvq4+M/P7zce4EpzCzLba5NZv+3tl1ba0OwmX3ESE=; b=k4QFLPwPyHw2+YCgpPLAJMQvKe t8nErFoRD/SzMR7Rk2XTzPDqtlqtmSD43AVFEXTyMY25UkMEGJqh6a0fyGj++JZUPGiHO5r60t4tC mtwwAyIFR5ULemfaLzECH3WI95Jn5XTVYwtt1uTaoMrYFHSWEr3wDmAJH8ZJW379mDnbEacvnUQmw 9fX2IY6kmlM2o/QSoXi1f/8rA5KrmeVKBrO//ApPRKESoAaUFw84GxgwQ/q4MbNL+e7PkXHVO/JiH oIaYG/PySj0pP1uaII2NexImV4sbkvRe7gdCZVQq0wfJyaR5LF2ue81Lx4tsN0Zi2EtFUj3EA3bWW psaHxCzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t2yCE-00000008Sj6-3yWo; Mon, 21 Oct 2024 19:36:07 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t2y9Y-00000008S1W-0Vsc for linux-arm-kernel@lists.infradead.org; Mon, 21 Oct 2024 19:33:22 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 5BFF75C5B0D; Mon, 21 Oct 2024 19:33:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64059C4CEC3; Mon, 21 Oct 2024 19:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1729539198; bh=WYUvq4+M/P7zce4EpzCzLba5NZv+3tl1ba0OwmX3ESE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=jytzcSwRc6jG7wRsBJDbl7VUOvNKHKJYh0Q2BJABujXo9TCn9vISva9iODu+q3n+s qW1C9G78Krm496Zzm0adV+/i46IwC9oSXL9GjUPpf+CfYPxx6XznazM5voc17W+8La DJaLakSsph9Tq4hJaJboXRr5KGtho4yxM1BQBlSOQVUiCJhRDkFXMY+yPMy5YxMTm3 gxKOUu40xcbCjO6Do69Cn8L2c7wZMVz7ccrzkmmE2rUPizKBg3zK5m/clVjYGSnLfd CSv/JrZtdmBdO0d9rey3pDd2r9NzWfJj4Jhy9y5z+XH7jLGJE4pVlU8CoNmIrMFGiT 780TkP4QLpi/A== From: Puranjay Mohan To: Xu Kuohai , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Alexei Starovoitov , Daniel Borkmann , Catalin Marinas , Will Deacon Subject: Re: [PATCH bpf] bpf, arm64: Fix stack frame construction for struct_ops trampoline In-Reply-To: <20241019092709.128359-1-xukuohai@huaweicloud.com> References: <20241019092709.128359-1-xukuohai@huaweicloud.com> Date: Mon, 21 Oct 2024 19:32:48 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241021_123320_307906_395A2DE5 X-CRM114-Status: GOOD ( 12.13 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --=-=-= Content-Type: text/plain Xu Kuohai writes: > From: Xu Kuohai > > The callsite layout for arm64 fentry is: > > mov x9, lr > nop > > When a bpf prog is attached, the nop instruction is patched to a call > to bpf trampoline: > > mov x9, lr > bl > > This passes two return addresses to bpf trampoline: the return address > for the traced function/prog, stored in x9, and the return address for > the bpf trampoline, stored in lr. To ensure stacktrace works properly, > the bpf trampoline constructs two fake function stack frames using x9 > and lr. > > However, struct_ops progs are used as function callbacks and are invoked > directly, without x9 being set as the fentry callsite does. Therefore, > only one stack frame should be constructed using lr for struct_ops. > > Fixes: efc9909fdce0 ("bpf, arm64: Add bpf trampoline for arm64") > Signed-off-by: Xu Kuohai Tested-by: Puranjay Mohan Thanks, Puranjay --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iIoEARYKADIWIQQ3wHGvVs/5bdl78BKwwPkjG3B2nQUCZxasYRQccHVyYW5qYXlA a2VybmVsLm9yZwAKCRCwwPkjG3B2nUh7AQC2H7MH73JWY+k4caiIVVmlb8l39jDH EJ2P5toCncJrqgD+Kzhb4XrubHzyTDJfmnXW6Owi3Qupk12E9yqaGhuwyA4= =nnrP -----END PGP SIGNATURE----- --=-=-=--