Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3130976rwb; Mon, 15 Aug 2022 18:55:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR4VY6MD30ShUG56GO/Q/UuTlk82TwEjCGvn6/vzyemh0bJKP8pR7h+VrfmRggZ+sQPIk5C6 X-Received: by 2002:a17:90b:4a05:b0:1f5:62d5:4155 with SMTP id kk5-20020a17090b4a0500b001f562d54155mr21967352pjb.6.1660614912627; Mon, 15 Aug 2022 18:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660614912; cv=none; d=google.com; s=arc-20160816; b=ijL6M1PRpMRurjC5GQwV6ukB5rtLrsMS20BMncxKWL4aXVVa0yzmUOOVRo+JRjSWWr TwSnxwv9Pf6jU4/IOxPwSQ3iOB73//2pP7qmd08ZAp+9gJi/8LGVUyUQaUfLtsUUuK7v ZnWBAN8HO3daC73HR8F/W642i5Ujqodjbmhklfe4GGRfavmT4xY5mfu7mZC5VyOnUQlA oQheOyf9t124n/huX7PNMQ/wwcuz1OMaKugaweC8JDDs8IqwM5vCCIvfJvXwTPioVJ8Z mrSL9byX+/QPc3LJcjGe+RnHYJm3ni9h7O3GHorgFHvNnxlfVNNAgtoK3+EMoV/G5rP1 p6uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oU3Z8Iw6h1tX9ete8AqZorYui7avr362jjN/lnDTOQg=; b=oZDJ3GGrhD+2ACUT8z9BlXfuVDgbPbGxVkkMy1yD7LDWqgIhqW0BJl5KbPv6dJUULD pvQTz5p3jE7y+wSZYGa6i/Q3u5oM7D+3FJqw08Et1qLC6ri778FBjv2XN4CKouUSusjU ci7iVePhHczkKK2AykYLviRIclJfIUD1RzIxGEB9mOfENtAyGJcxrLb4+fdt8juudwGH lI4MKO6gCFRdftKev0K4D2Hqp/sbE/odcHyWfe9HeSIWFajgmBk4c9VjlU2V1BvtZToV bqvTJWbFmb7WAaKV+HF0q5Jm06WX3ERl6Fd0rRsb58BARZqL0cUQtchTC4lNjX2SOl+o 2eXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=geJ1bQXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 30-20020a630d5e000000b003fe22d6bdc4si12429507pgn.802.2022.08.15.18.55.01; Mon, 15 Aug 2022 18:55:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=geJ1bQXY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348198AbiHPBCI (ORCPT + 99 others); Mon, 15 Aug 2022 21:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344972AbiHPA4j (ORCPT ); Mon, 15 Aug 2022 20:56:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F9319ECB1; Mon, 15 Aug 2022 13:48:29 -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 02A19B811AE; Mon, 15 Aug 2022 20:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EB0CC433C1; Mon, 15 Aug 2022 20:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660596506; bh=7tARl1TSUtB1EY1AcMUAeuoi5nZ03zGTLEJW5dprqRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=geJ1bQXYzu5eMdJzT84KYmugScO1OLTUdCoIYaQFtZoM2Zv3FqnaNYQQnj5kOyu/E A+4QPZXte++NgFuuXlhzzwx2ntD7j+kc69mKwgXeZS6leSxdhJnAfzOJ0xI3gOqEXw c+10R6/0vgle3199arUALyltQ0HU5O8h2gkNap9g= 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.19 1101/1157] s390/unwind: fix fgraph return address recovery Date: Mon, 15 Aug 2022 20:07:37 +0200 Message-Id: <20220815180524.302933945@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 address 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 *state, unsigned long ip) { - ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, NULL); + ip = ftrace_graph_ret_addr(state->task, &state->graph_idx, ip, (void *)state->sp); if (is_kretprobe_trampoline(ip)) ip = kretprobe_find_ret_addr(state->task, (void *)state->sp, &state->kr_cur); return ip; -- 2.35.1