From nobody Fri Oct 24 20:20:08 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF1EFC2BB45 for ; Mon, 15 Aug 2022 23:32:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353299AbiHOXbh (ORCPT ); Mon, 15 Aug 2022 19:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245630AbiHOXZx (ORCPT ); Mon, 15 Aug 2022 19:25:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5332804BF; Mon, 15 Aug 2022 13:06:13 -0700 (PDT) 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 67A60B80EA9; Mon, 15 Aug 2022 20:06:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32AF3C433D6; Mon, 15 Aug 2022 20:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593971; bh=7tARl1TSUtB1EY1AcMUAeuoi5nZ03zGTLEJW5dprqRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAZ++Ns56R8X5/BFl89RKywzrcHgEWOAn1cWiPZIe6WiPFAhg2vSQVt0tttjss7/j 3n1bYFnxmKdv56EBthkFuoLm2IAQgtvp2FN0R694lhNmqkkeUoKSJ9N7Vkl/Rz2Anb MkdQr4GAnSA3ZjQM/rEJLyQBH+mfguKMymTwk3Mk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vasily Gorbik , Sumanth Korikkar , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.18 1036/1095] s390/unwind: fix fgraph return address recovery Date: Mon, 15 Aug 2022 20:07:15 +0200 Message-Id: <20220815180511.945321111@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sumanth Korikkar [ Upstream commit ded466e1806686794b403ebf031133bbaca76bb2 ] When HAVE_FUNCTION_GRAPH_RET_ADDR_PTR is defined, the return address to the fgraph caller is recovered by tagging it along with the stack pointer of ftrace stack. This makes the stack unwinding more reliable. When the fgraph return address is modified to return_to_handler, ftrace_graph_ret_addr tries to restore it to the original value using tagged stack pointer. Fix this by passing tagged sp to ftrace_graph_ret_addr. Fixes: d81675b60d09 ("s390/unwind: recover kretprobe modified return addres= s in stacktrace") Cc: # 5.18 Reviewed-by: Vasily Gorbik Signed-off-by: Sumanth Korikkar Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin --- arch/s390/include/asm/unwind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/include/asm/unwind.h b/arch/s390/include/asm/unwind.h index 0bf06f1682d8..02462e7100c1 100644 --- a/arch/s390/include/asm/unwind.h +++ b/arch/s390/include/asm/unwind.h @@ -47,7 +47,7 @@ struct unwind_state { static inline unsigned long unwind_recover_ret_addr(struct unwind_state *s= tate, unsigned long ip) { - ip =3D ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, NULL); + ip =3D ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *)= state->sp); if (is_kretprobe_trampoline(ip)) ip =3D kretprobe_find_ret_addr(state->task, (void *)state->sp, &state->k= r_cur); return ip; --=20 2.35.1