From patchwork Fri Mar 31 14:00:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cabaj X-Patchwork-Id: 1763793 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=hLV8XFBF; 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 4Pp2513Fq6z1yZ0 for ; Sat, 1 Apr 2023 01:01:09 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1piFJP-0002mj-IG; Fri, 31 Mar 2023 14:01:03 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1piFJA-0002Wt-Hu for kernel-team@lists.ubuntu.com; Fri, 31 Mar 2023 14:00:48 +0000 Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) (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-1.canonical.com (Postfix) with ESMTPS id 1A5DC3F235 for ; Fri, 31 Mar 2023 14:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1680271248; bh=XMICoqgIZIgIgu8Sbcgblii3jRjkW2/c6w+8FeNuYDU=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hLV8XFBFBrS54hjDY+izD8Q3nUAC3GwIr3/eFv87Gwv/woSCGGa0tKMJaYzEt2fGA g7dVv23h9zHb6gVX4QCL7/Yph4wbYfJ9u5M4SxyzewqFBMbjuh4xdPkiK211CQe3lU 5LfJnw7t+/T+8bplZgsTJzCkM3izTflFTtlnawns3U2geDkG/gAqVbK1luxn4p+I3R oWtggCFac9h0HD3Pttsjsp/qInZ8ZA8WwedEEqM47JVxOEKR1+mgsVA7C7mUjflqpw M28jeLmjE4YGPhOWMioUgI/3JyCN282Rr73JnP6DVZeLyt3vXW9iVCYbfVnTJEQVmN HI1V2WwuGKCWw== Received: by mail-yb1-f199.google.com with SMTP id 4-20020a251904000000b00b7f75c3cafdso6779148ybz.16 for ; Fri, 31 Mar 2023 07:00:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680271247; 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=2vJd5OsYALpfX+o3lkzMc4I/U2gVA5x6HluOT032GjqN1Kd+m4JwypMSrhipG4jlUX lH1JqwpVePx5GTjA47oy91UiitrwhaQmGUSA21KfNm4alZaXeCYBAsfgvZp1wa8JuPT2 zqYA0gsFrLBwjwJXUGbYHoq1qDyASmxa1JPBPuj3ipKZko/SpaD4zQcsO0jKNRfyOpoN wn0xDBtPfc723Cg0R8368yUr4BJ0RVJBv6KsYuz979g/RrP0G6fVuf62dhYX8nI4ytza c/EIs5oKpuGRWFKBOo3e2WTjw3d/AA4optrQ89hVbzCC4rcNcAtvc2GylRNVTwziwdBa CS5g== X-Gm-Message-State: AAQBX9csBcsrsT69iEUcqpGWuTw+f7GUQiq8oCEBBEXoMGzqjrASqf+m 9pmOJuZ0JmENiFjuhEbbP4pAAFLKFp501W/K9cZI7zD23/NewqdWdt81b1KP+5GS4sDXiBTfk6p KIjXsvrXwTdVKrAXsiH6QJub4iyDf0yctGrQtkwlpcHq+TDNRzA== X-Received: by 2002:a25:342:0:b0:b25:cef3:f98e with SMTP id 63-20020a250342000000b00b25cef3f98emr26539643ybd.4.1680271246851; Fri, 31 Mar 2023 07:00:46 -0700 (PDT) X-Google-Smtp-Source: AKy350Zs702I8Iui1Y48T1L9hEXK4rUzxbkiafzTm8dOqJ/hsfsFIYevFt70YqTrApl1f2BT+xaIOg== X-Received: by 2002:a25:342:0:b0:b25:cef3:f98e with SMTP id 63-20020a250342000000b00b25cef3f98emr26539608ybd.4.1680271246586; Fri, 31 Mar 2023 07:00:46 -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 a5-20020a256605000000b00b7e0d092f91sm584336ybc.18.2023.03.31.07.00.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 07:00:46 -0700 (PDT) From: John Cabaj To: kernel-team@lists.ubuntu.com Subject: [SRU][jammy][PATCH v2 5/5] s390/unwind: fix fgraph return address recovery Date: Fri, 31 Mar 2023 09:00:41 -0500 Message-Id: <20230331140041.2112510-6-john.cabaj@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230331140041.2112510-1-john.cabaj@canonical.com> References: <20230331140041.2112510-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;