From patchwork Thu Apr 6 15:12:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cabaj X-Patchwork-Id: 1766197 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=sHWnVpjc; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PslP44wRsz1yZN for ; Fri, 7 Apr 2023 01:12:55 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pkRI5-0008C8-03; Thu, 06 Apr 2023 15:12:45 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pkRI0-0008AR-RO for kernel-team@lists.ubuntu.com; Thu, 06 Apr 2023 15:12:40 +0000 Received: from mail-yb1-f198.google.com (mail-yb1-f198.google.com [209.85.219.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 9C5943F19A for ; Thu, 6 Apr 2023 15:12:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1680793960; bh=XMICoqgIZIgIgu8Sbcgblii3jRjkW2/c6w+8FeNuYDU=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sHWnVpjcgEj43XbxxNY9SgsAc99IRYmLRIM6d5I/dBSk+WgJnBT29fb9hcERCje0C vWD5v8Ih0IrEuS8ym9W6bycNqm1u7z0KuG3bCx8NF40+Rs6ZrVHw/k6eK3CXu11JG6 PAViOsaBaZLkRjBOFuBBY1CVMiQjHiFrb3CSq90eBsTL3ZvatZA8IWBgTz/FCXQ6eG x1bLrMghwsxtZnxaRCwX2KG9WOvEvL7DWNFEB36PhyJS3/qvG0ALPgdhhYxScxL9er z5cwjDheUfkWojZ/dqnTqKzoe55EzhiA7mqlcgiwkRMCXPOLSCdWOcJfiubFmeRQgM qj8CldvgWOujA== Received: by mail-yb1-f198.google.com with SMTP id 186-20020a2510c3000000b00b880000325bso12487047ybq.3 for ; Thu, 06 Apr 2023 08:12:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680793959; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XMICoqgIZIgIgu8Sbcgblii3jRjkW2/c6w+8FeNuYDU=; b=dPiHsBOsBEPV/xThF+MPEv9UxI5n1vc9Zj0p1N7Q2J0fXLSv/3xLKwM7X1xERX1DJx OVGyX2/BkumOgUd8UxZFrCaxcbpIcaG3+hwtHWB7+JiU8aMuRnCXxLm1wpQC/6P1TqVN A+j8pTETmThi/63ggUfO39VMzBRrmAc3H3F2qrXgVKqPh4ZX0PR8uhgv74HQ6Wr/quWJ rxaR+Cdy9wHXV2GlRiBN1tXCZ9DBtWjcrIx5/OfjAJZHibQ2DtLOUhjS7P9H0fu4kQJe SkXqRok2MRnezLWOm6hYnsLHWz8R/IwhTALuJAnarqKKp+Wn/e4MV2MGpyMkzyJB2RND J6vg== X-Gm-Message-State: AAQBX9c98fy5I9E6Xy2YzX+bCJBKCIUZvyvXFvAUXk7Z3YBcjWn+trx2 dVK5U0QyVxEvUEldQDWP2vr3mPGNJE+6ec+gWlhHeXg41GaQBWHpWKPsTIVRjsjqxvFKi4y5wzX dQ/jumBuVfyKjybNUuF2BIQhCw1lUgFDVHFbPV9Y3eHaFK0XOOg== X-Received: by 2002:a81:a1c9:0:b0:541:8b50:fa2e with SMTP id y192-20020a81a1c9000000b005418b50fa2emr5316116ywg.22.1680793959480; Thu, 06 Apr 2023 08:12:39 -0700 (PDT) X-Google-Smtp-Source: AKy350aJC3RrOK234zEMgmy8YSH4+x7TpHLwW3GE+tS622ZMBnGh0jogx0ChpGbQU7OCN5RSRusqXQ== X-Received: by 2002:a81:a1c9:0:b0:541:8b50:fa2e with SMTP id y192-20020a81a1c9000000b005418b50fa2emr5316099ywg.22.1680793959181; Thu, 06 Apr 2023 08:12:39 -0700 (PDT) Received: from smtp.gmail.com (h69-130-246-116.mdtnwi.broadband.dynamic.tds.net. [69.130.246.116]) by smtp.gmail.com with ESMTPSA id 80-20020a811453000000b00545a0818480sm373564ywu.16.2023.04.06.08.12.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 08:12:38 -0700 (PDT) From: John Cabaj To: kernel-team@lists.ubuntu.com Subject: [SRU][jammy][PATCH v3 5/5] s390/unwind: fix fgraph return address recovery Date: Thu, 6 Apr 2023 10:12:33 -0500 Message-Id: <20230406151233.405626-6-john.cabaj@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230406151233.405626-1-john.cabaj@canonical.com> References: <20230406151233.405626-1-john.cabaj@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Sumanth Korikkar BugLink: https://bugs.launchpad.net/bugs/2013603 (Kernel livepatch ftrace graph fix) 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 (cherry picked from commit ded466e1806686794b403ebf031133bbaca76bb2) Signed-off-by: John Cabaj --- 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;