Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3115557rwb; Mon, 15 Aug 2022 18:29:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR7wCCqxk+57V057gPzFnbr3Ikmt9+5aKQ1TqTGFYLo7a464v9WHxkIZs1SDqEheXT+npbVr X-Received: by 2002:a17:902:ea0b:b0:16d:d268:e4c5 with SMTP id s11-20020a170902ea0b00b0016dd268e4c5mr19472671plg.152.1660613388029; Mon, 15 Aug 2022 18:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660613388; cv=none; d=google.com; s=arc-20160816; b=XsAOwLqOWJOnrqUXZPwtZKuMCo7r0wIPtyaKK1NbmJH4ZfMOvz7lSZGqsnhoEvkLg8 qZemsGLqGB1Q2iHD+38THzfSQKLOfZxIRoz9tWyHg6hcabIAdy3WdQA+DYpajpzVwQEE NAAmco3eBOjeW6BE/33+mxExJr9e4ROLaHqnygJJwzRDDhHz5JwTYNfMyOIUN8iGKf7L sMkyN7rgTF7Zk3PAECIHM3I4APGfvUAxCXrCFdxu/539COGnFTmj5LSoTUyvJixtVG2i vkt2lW4uTxG4VhGBUZglClMQXNzKOpnqnvFiNV+S85ayD1kN+NEPU1Evev3YUYD4QcFj E/jQ== 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=bS6CXiKtZuwjM9pvi4eKcT5vUYD5Vk/iC3OlQbtLhzRXqSbR6kis8HeiLA92WGifFT e1Uof4OV+phF8vta+VnA8Xqle6PH++v8WuINazA+hCvvxduPJzzkTBh5ZQAjUSPl0kT+ DxgjOT4BdGmgzPokJoTf3v7slOvsJub1jbKm7Ctis8CkqjhJfti8PTTdozirjObllXNo FT6pDL4Id8zmKQ3MQhcdoHxkjLXO02o0B9JpRzhrT0J37PmLamlxf4BP3hmoWLr3PPsC Zwlg/oUFXpXZgmUudz7KSbFhPYOiRYdwB2zkJLjSomtuC5OF+uOczrfIgywYh/0YeQFd CoKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HAZ++Ns5; 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 j23-20020a17090a841700b001f3e1e8f91fsi11359145pjn.22.2022.08.15.18.29.36; Mon, 15 Aug 2022 18:29:48 -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=HAZ++Ns5; 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 S1353251AbiHOXbg (ORCPT + 99 others); Mon, 15 Aug 2022 19:31:36 -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-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