From patchwork Thu Mar 30 19:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cabaj X-Patchwork-Id: 1763413 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=pb5tlkDN; 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 4PnY1T3bHpz1yYr for ; Fri, 31 Mar 2023 06:11:25 +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 1phxg6-00035Y-IA; Thu, 30 Mar 2023 19:11:18 +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 1phxfv-0002wD-FC for kernel-team@lists.ubuntu.com; Thu, 30 Mar 2023 19:11:07 +0000 Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) (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 320043F200 for ; Thu, 30 Mar 2023 19:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1680203467; bh=IxAqmg1GbnwwSR3ODCdl4jDJVbcSk50ZhtKOBWTpnrU=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=pb5tlkDNuPkO4vy9NnXDPbWqKGJpE7EA9ogNMSFpFVgC4EmIfXTfJfp5rZbyGspoB aDwEACKgAKDJ/cAhjQIb+ugE4UTyVeDp5gTJG3805q3+0hTOSBtGHoNt4ox6lijsPx D9tamRmJp1ultuoUxN48+qRMhLY4ssZ115boFZMb6gEovHpDUH5LTVS/rAzIiFn5SY 1lx1UsjlnqsWvsmndygGNARw2p5RTUfULFtqCNzMX7uh8gMPt7bZi/H6QYNx8W3qFF XvUURXfR5KXXhnQ5TKjdaPA+PISEPauF3fbPy7kE2q53HNmFgNtBpAZmUelL4fF5Sf vtpcxFVSGxFKA== Received: by mail-yb1-f200.google.com with SMTP id x15-20020a25accf000000b00b3b4535c48dso19652159ybd.7 for ; Thu, 30 Mar 2023 12:11:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680203466; 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=IxAqmg1GbnwwSR3ODCdl4jDJVbcSk50ZhtKOBWTpnrU=; b=hb6dJC5g/AoDiQ3bZthsmqQibAUlwA7seLwa2/UtRBhe7eN6UZXEHkC9WebLOERl/o HMVQVz2EypwxlValbW2aWE+u5TpSRakWh29mltsjySBdicffhtJDLXAHWvlSsmh8BG5d 9g0a4aHQE6Py2txWmDhSqyJAT3Fc+MKDoTtQ31fdrubvNdnxLwXNs3oypavGwuC232OX xOoXUXnakpp/ONf+WZpdq6v7idZiuLvni4JnEb8UbH1UNq4boTD9U4WvQvjKMaehUO0q MlOUq6u9RInKS+Z9FWIK8ihA3DZZIn0z+iFv7k+33Df6WC/ZWrMA9TURuQzSp5ys4djj rxHw== X-Gm-Message-State: AAQBX9c6Tik7zxv39PF9xF5w9xvk7yTSKM6Wd9ligD+wcgJ+eS4U7Qs9 /ayAkEmcy4GroEmKErvUzmUJNRKNwLDxQJBrQdAhlgvHyi94KrhzLa8jaeeKtG/dfjRSfNo+3VE pCULOFCgY66RwvRZ2fxJItA5dznZuEbkioxZOvL0BcySwjmjZjg== X-Received: by 2002:a0d:d88b:0:b0:541:8c8f:ec14 with SMTP id a133-20020a0dd88b000000b005418c8fec14mr24474689ywe.14.1680203465983; Thu, 30 Mar 2023 12:11:05 -0700 (PDT) X-Google-Smtp-Source: AKy350alLpRbQTKrS55tBAqp1pBLZaKEZ9JS2g07m0gyyK0jhdM8mNZaWnUDsVQPY+O8aKHHnaToFw== X-Received: by 2002:a0d:d88b:0:b0:541:8c8f:ec14 with SMTP id a133-20020a0dd88b000000b005418c8fec14mr24474680ywe.14.1680203465684; Thu, 30 Mar 2023 12:11:05 -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 k10-20020a81ff0a000000b00545a0818473sm42251ywn.3.2023.03.30.12.11.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 12:11:05 -0700 (PDT) From: John Cabaj To: kernel-team@lists.ubuntu.com Subject: [SRU][jammy][PATCH 5/5] s390/unwind: fix fgraph return address recovery Date: Thu, 30 Mar 2023 14:11:01 -0500 Message-Id: <20230330191101.2034512-6-john.cabaj@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330191101.2034512-1-john.cabaj@canonical.com> References: <20230330191101.2034512-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/1639924 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;