From nobody Tue Dec 2 00:04:10 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A627F329383; Tue, 25 Nov 2025 16:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764089080; cv=none; b=czXUmOYpjR6fLP/ZWFO21fCYz1cqZebZZf3leEmEznn857m/KdQe5h1Sd7U0takRrQuNXJLyBCDx+MOxkqro1o9i5O7N/ar8FmUdqFeG8LJc9Zt2yGrKlonJG0XJcFcWgLt38n3C/0XAi7HJ38GYMszTL54L77XtcP/665BPFH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764089080; c=relaxed/simple; bh=J4PyjTWZZy4AMR0cCiyLgwuuJeCOaxRSVWHewOd8ldY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JxwlZiUu+vwBkBuKK/OxoLl2N3l27Uhmfu7hoEnXIhKrxDSmnoSo6LqUY3Ywkhcu9rfKkYOnh89F+0yF5wYpnRbeu5Bit0FI4XBdtQG0kDhIgKFIPac8U+mEQajjqJ3KPa6IecPgfTMDVO8wOxo3QJck4zuy/t5+098OVX680u0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=HoQz9oOG; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="HoQz9oOG" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5APEUs1I031548; Tue, 25 Nov 2025 16:44:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=rpg5SPvkgel8a3b1b /FIgAvz7SBPHHvdD/JLyQb5oIY=; b=HoQz9oOGWHbuTGoVQdl6/yHDqmg5q9LhM tJZlkrpfqK2f1Hd6bul6IijAVG7PWlJbvHIbm2iGvX1dp0YmdjaKyworJFmH4bdQ uouc4sVbhE64P0gpEjb1YY/Ey7H+LEFrTtc7CORSzKLvyLlt98HV+hew7794fCfu SYZ/nL8EayrxRbDUWQ6N0vYKL4lKfDXItC/HuekYz9LEQdNTBVv8DU/bRC5LHJsw l1wd0uNo+AsepMA5GyMevtN1IF470w/r2eIltzymNMZw503wU/EnHM1MDcW6lkRZ tGVbBAgmGIXXoaD+Gc3c7mnxxTLI5WUBbJUIcE2xQPxsoj2b1MjRw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ak4phxvvg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Nov 2025 16:44:01 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5APFOj7p016406; Tue, 25 Nov 2025 16:43:59 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4aks0k50mf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Nov 2025 16:43:59 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5APGhtf728836336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Nov 2025 16:43:55 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDF8F2004B; Tue, 25 Nov 2025 16:43:55 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7874D2004D; Tue, 25 Nov 2025 16:43:55 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 25 Nov 2025 16:43:55 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, Steven Rostedt , Peter Zijlstra Cc: Jens Remus , Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Mathieu Desnoyers , Indu Bhagat , "Jose E. Marchesi" , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich Subject: [PATCH 1/3] unwind_user: Enhance comments on get CFA, FP, and RA Date: Tue, 25 Nov 2025 17:43:47 +0100 Message-ID: <20251125164349.2592874-2-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251125164349.2592874-1-jremus@linux.ibm.com> References: <20251125164349.2592874-1-jremus@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTIyMDAxNiBTYWx0ZWRfX1KXu6t2wPS0R A+0SmgvR1GoitXoFU4Br1S7HBPaHUG3FmF5e4049NZKCjY+jjlXUUNEH+2oP2fBIxQs6Z7uQeBo cBJGaZvFVou6fs5PRSWfQZ0osy+VWYDTtWotHEp35Y9aOi6VSOI1tOTCdRB/Goc2Ynj7nJOD4Py cDQUBkxHkhTRyIvGGKBz8T7dcAGiyNRMsgqygCk0yaSx7Dt24d427Kvb6bBFthCZhaTw6/i/y5A e20CBjxAxedu1IpaHp40bspODwVslVPNbXxn8oNYf8J2+bASxcb170LsqwdFaJfh5I4XxqP0kwR hEW1PPPrIRBJBsGP2wwo5cPoXxsQ1SBC0bl7jQbnyM+K/S56f7iqRPAqHsmOkEGvqs3JNkw8I8R Rs71FuKdAKaTlmT4ZLx+hoAshNM2cQ== X-Proofpoint-ORIG-GUID: NOzabWbe7hh2k-PNGaQXU5L6shDSOH-e X-Authority-Analysis: v=2.4 cv=CcYFJbrl c=1 sm=1 tr=0 ts=6925dcd1 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=GRZQj7fo7pb9Qcd1f_cA:9 X-Proofpoint-GUID: NOzabWbe7hh2k-PNGaQXU5L6shDSOH-e X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-25_02,2025-11-25_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 clxscore=1015 adultscore=0 spamscore=0 phishscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511220016 Content-Type: text/plain; charset="utf-8" Move the comment "Get the Canonical Frame Address (CFA)" to the top of the sequence of statements that actually get the CFA. Reword the comment "Find the Return Address (RA)" to "Get ...", as the statements actually get the RA. Add a respective comment to the statements that get the FP. This will be useful once future commits extend the logic to get the RA and FP. While at it align the comment on the "stack going in wrong direction" check to the following one on the "address is word aligned" check. Signed-off-by: Jens Remus --- kernel/unwind/user.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 39e270789444..0ca434f86e73 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -31,6 +31,7 @@ static int unwind_user_next_common(struct unwind_user_sta= te *state, { unsigned long cfa, fp, ra; =20 + /* Get the Canonical Frame Address (CFA) */ if (frame->use_fp) { if (state->fp < state->sp) return -EINVAL; @@ -38,11 +39,9 @@ static int unwind_user_next_common(struct unwind_user_st= ate *state, } else { cfa =3D state->sp; } - - /* Get the Canonical Frame Address (CFA) */ cfa +=3D frame->cfa_off; =20 - /* stack going in wrong direction? */ + /* Make sure that stack is not going in wrong direction */ if (cfa <=3D state->sp) return -EINVAL; =20 @@ -50,10 +49,11 @@ static int unwind_user_next_common(struct unwind_user_s= tate *state, if (cfa & (state->ws - 1)) return -EINVAL; =20 - /* Find the Return Address (RA) */ + /* Get the Return Address (RA) */ if (get_user_word(&ra, cfa, frame->ra_off, state->ws)) return -EINVAL; =20 + /* Get the Frame Pointer (FP) */ if (frame->fp_off && get_user_word(&fp, cfa, frame->fp_off, state->ws)) return -EINVAL; =20 --=20 2.51.0 From nobody Tue Dec 2 00:04:10 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4D561E98EF; Tue, 25 Nov 2025 16:44:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764089070; cv=none; b=OQQJkLTpSDKfEaYdFgZ+i3TFwoyNfI25newTPy2l1T4Vr2H+pl9pzq9WdpdreIadOB3Ynk2l5f9ly5Hw+WdoU2ne+l8Cj3HBesDm6aPglqzj6OQxiX/U/w4k5D8DS9i94zvG1eChMXgEPkJo6+sW6b2kujive7f5HBKQgE6K4jY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764089070; c=relaxed/simple; bh=R+98Nv6YH0BT1ZrSou0D7Pr6OskBNUtuqhn9NtWJ+SE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UN2wYdomi5rQFXJIF2FX/zwVKkgT5WiwuZINh+xEsLWasbGW7xsspTcd9sD2kbaBPpFcTKfRAa9pV+aUYQVhpmj4/mxfVkPOLF4WaiOirrDFSHbbaRRBp9PBwfn+Oh8wqvSTT/poHNROQwjuFpwYnzdi8qnjvwORBz5EQ+U4VDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=C8Ht9Vxg; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="C8Ht9Vxg" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5APEVeSi002195; Tue, 25 Nov 2025 16:44:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=CuGvhipiqVabDot0c Hsec6MRFiOsrQtODCKUg39f95Q=; b=C8Ht9Vxgc89zyguSbpj7MZKsd5UiDcW2a KB48FwpEs1irAsvlfm1exr46YN8pK4fnHF3ImHMwTUBPEdmmOmYRoW8tjyM7Telv oRw7tcP1uYAomzXZT1tv6clBWs2LbEzSwj+QrpLJ6k6uLaBYkuc7YCx+IhkQDLju 5BQ+6o4fh4R7yg1Fj1P/hOOrwWB6O9/0n9D/mXj9C5aSBqnPdatCwFRmsd7iXe3n wHY2lK69hnCbEDsAAoYS4qFngQYtEGauWLzL/226LOgPmoQ94BEhKU+ppw1psqzT 26dyP9OXfS5JyYObAH+ovHlB32O9qhgwgxgg72cDqoBZlpn5VOQww== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ak2kpxc5y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Nov 2025 16:44:00 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5APGKWRf025097; Tue, 25 Nov 2025 16:43:59 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4akt71csbb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Nov 2025 16:43:59 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5APGhuiP42729874 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Nov 2025 16:43:56 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 140AE20040; Tue, 25 Nov 2025 16:43:56 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C297320043; Tue, 25 Nov 2025 16:43:55 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 25 Nov 2025 16:43:55 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, Steven Rostedt , Peter Zijlstra Cc: Jens Remus , Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Mathieu Desnoyers , Indu Bhagat , "Jose E. Marchesi" , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich Subject: [PATCH 2/3] unwind_user/fp: Use dummies instead of ifdef Date: Tue, 25 Nov 2025 17:43:48 +0100 Message-ID: <20251125164349.2592874-3-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251125164349.2592874-1-jremus@linux.ibm.com> References: <20251125164349.2592874-1-jremus@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTIyMDAwMCBTYWx0ZWRfXzy2L3j4qIq3y OmhpjPD9pnsmO56v7NAc4RCuz64IvzZCAFuJwF18BhIN7MBlIXSlgjggxmHO0nFCY5Il723wbqN boMo8pWKMl0lmmOO3ryDaFKCXU+U/OTp98E6C3jngvj+M/ES/Rx2ciDvUftcVviVDa0Z3a1OQDf aXUIqHI/rx8Pw5YkOGlpwY8R3TggvZIMior+KeEJbBCGDF/gVQA178ifU+UFRrDWNuFr786CGWJ zkKKwgAjDuDBpiNpYVXF3QBAIOsBwBBgifeY+1AiQIxF7lmaYY/1OIZ015SATxVDrIHLmXAFoDW FV+moNSpFFqxNchhxQXCQ49m5CJM/uHJdTi9o1PIHUr4Uyk5+2ikIHzZ4uXZHxxzZTOTFJKW3oE YhBQBx0Hx/T5N9lSdKmfU2lDvRpxZQ== X-Authority-Analysis: v=2.4 cv=fJM0HJae c=1 sm=1 tr=0 ts=6925dcd0 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=rKYaUyGAOQbTNo1-z7kA:9 X-Proofpoint-GUID: quMiFihkcSSnyd0lqETBrY6UjcT5Tikg X-Proofpoint-ORIG-GUID: quMiFihkcSSnyd0lqETBrY6UjcT5Tikg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-25_02,2025-11-25_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511220000 Content-Type: text/plain; charset="utf-8" This simplifies the code. unwind_user_next_fp() does not need to return -EINVAL if config option HAVE_UNWIND_USER_FP is disabled, as unwind_user_start() will then not select this unwind method and unwind_user_next() will therefore not call it. Note that enabling the config option HAVE_UNWIND_USER_FP without defining ARCH_INIT_USER_FP_FRAME, ARCH_INIT_USER_FP_ENTRY_FRAME, and unwind_user_at_function_start() will result in a compile error, which is helpful when implementing support for unwind user fp in an architecture. Signed-off-by: Jens Remus --- include/linux/unwind_user.h | 14 +++++++++++--- kernel/unwind/user.c | 4 ---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/include/linux/unwind_user.h b/include/linux/unwind_user.h index 7f7282516bf5..c3ff690a43e2 100644 --- a/include/linux/unwind_user.h +++ b/include/linux/unwind_user.h @@ -5,9 +5,17 @@ #include #include =20 -#ifndef ARCH_INIT_USER_FP_FRAME - #define ARCH_INIT_USER_FP_FRAME -#endif +#ifndef CONFIG_HAVE_UNWIND_USER_FP + +#define ARCH_INIT_USER_FP_FRAME +#define ARCH_INIT_USER_FP_ENTRY_FRAME + +static inline bool unwind_user_at_function_start(struct pt_regs *regs) +{ + return false; +} + +#endif /* !CONFIG_HAVE_UNWIND_USER_FP */ =20 int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries); =20 diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 0ca434f86e73..90ab3c1a205e 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -67,7 +67,6 @@ static int unwind_user_next_common(struct unwind_user_sta= te *state, =20 static int unwind_user_next_fp(struct unwind_user_state *state) { -#ifdef CONFIG_HAVE_UNWIND_USER_FP struct pt_regs *regs =3D task_pt_regs(current); =20 if (state->topmost && unwind_user_at_function_start(regs)) { @@ -81,9 +80,6 @@ static int unwind_user_next_fp(struct unwind_user_state *= state) ARCH_INIT_USER_FP_FRAME(state->ws) }; return unwind_user_next_common(state, &fp_frame); -#else - return -EINVAL; -#endif } =20 static int unwind_user_next(struct unwind_user_state *state) --=20 2.51.0 From nobody Tue Dec 2 00:04:10 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0770F1E98EF; Tue, 25 Nov 2025 16:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764089081; cv=none; b=q01VFr2+st4ZGQa4e2ojglE02PnyxB6ss+zvUeuOSDodNaeCQhYQFl0Nxmab9xYDgilY+wA4RXFSujWIaDKS2/GK+gMmaFsxbQPru7gaENmckDwvJbGtG1hia8H/QwGa3ja5WnhfKo7J82pL0TUb18bdfEUk/XJfmDKS7+lIV40= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764089081; c=relaxed/simple; bh=0mRriTaFoP70OQc8yqQ+ND2TAs25kKeuFOBJJ7uoEiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=haY59IGCDaqi83PxKSW7q4GuABowh2hg6rY27PsB4n9oY71Do0qLstrUINq4tHZar2pJ6nMDHH2uqX0eBl2P673DYO/WfjryzScF3+OhYFoa7seWGQNBRkvGfanUafrwl0BKkDX9kccpVHilQ0IcV+uSMb77aouEzteQRpKZ2WY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=jROLtr5l; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jROLtr5l" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5APDQMUa014484; Tue, 25 Nov 2025 16:44:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QxqDNurIdSF3zjDDc lZ+vL6ghkNAs5JJUL00xCyjypU=; b=jROLtr5lkW3G5z2xtYM/OyuVK4b8vx832 SXKytld6WKwqux+MoRjR3bHB5yM+UQOAu4IW/BRW3OepFcnrboeD65yXImcTImzi /bKkC40Wn3kha7RXtV9B0aQKYTRYCME1GrdVMCenIqONo5eaB28xkH7fekWWY8bC F4Dlbyxbwq2Zv9p/5uAu+a4nHuiA5vMkuPxg4dr5Gh2xTCholnN0A0XG+7EhPrG7 rtutkc+ooJLl4ZoRcfleZjENtTUBo5/nuD6Kk6pAfMSYqwewuerNXs12ARO2jjM8 3MU4I4nMyXujDQImEIjIri0LgNG++r9zu1zyxV5wggwJsWPTz0XNA== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4ak4phxvvk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Nov 2025 16:44:01 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5APFB3E0013916; Tue, 25 Nov 2025 16:44:00 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4akrgn53qj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 25 Nov 2025 16:44:00 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5APGhuIB42729876 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Nov 2025 16:43:56 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5D49E20040; Tue, 25 Nov 2025 16:43:56 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A28A2004B; Tue, 25 Nov 2025 16:43:56 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 25 Nov 2025 16:43:56 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, Steven Rostedt , Peter Zijlstra Cc: Jens Remus , Josh Poimboeuf , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Mathieu Desnoyers , Indu Bhagat , "Jose E. Marchesi" , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich Subject: [PATCH 3/3] x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER Date: Tue, 25 Nov 2025 17:43:49 +0100 Message-ID: <20251125164349.2592874-4-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251125164349.2592874-1-jremus@linux.ibm.com> References: <20251125164349.2592874-1-jremus@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTIyMDAxNiBTYWx0ZWRfX0rPNKNTPbC7g buq3OMbvF+IOL0sr/pFQhb9mXcU2AXgVvJmdA9qgv4pJAK4zhHi0SUYj5HdO4fkathO0FaRkHzf YHlZIL19Lch7UGi0+tkPRS1dkhD5+RnNqDRcWnlUW2XaSjDBTkuioKhaIVn6FV85PRbaUzriEtM LhPq0JrFmI62O2xaU2/nAHwsyEp8u2RmLSK3XPxXPGEK9DfmEUbUgaQwlUzb7uEvtNqczvlqRjV 3n6Cc6iYNEq6MMm78n/zfaClq1MURsG9DEsvGHDV0fRyhNpB0cE/abY4v4NaDm49n2wWnHgFV7L HMVkX3vqDKW9y9BzfxDoCeZC3YqdTZAOEqcr15vseOO1K+Hbp6PQLcKr49SycRyeOez+Th95OIE m0+fnxjJgkVj632b8pNPQbNdCMidBQ== X-Proofpoint-ORIG-GUID: mzODBbdxDN-9AkXQRubUgownfjMy10xa X-Authority-Analysis: v=2.4 cv=CcYFJbrl c=1 sm=1 tr=0 ts=6925dcd1 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=LIcl9UMsB3m1Xa-0CCYA:9 X-Proofpoint-GUID: mzODBbdxDN-9AkXQRubUgownfjMy10xa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-25_02,2025-11-25_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 clxscore=1015 adultscore=0 spamscore=0 phishscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511220016 Content-Type: text/plain; charset="utf-8" The unwind user framework in general requires an architecture-specific implementation of unwind_user_word_size() to be present for any unwind method, whether that is fp or a future other method, such as potentially sframe. Guard unwind_user_word_size() by the availability of the UNWIND_USER framework instead of the specific HAVE_UNWIND_USER_FP method. This facilitates to selectively disable HAVE_UNWIND_USER_FP on x86 (e.g. for test purposes) once a new unwind method is added to unwind user. Signed-off-by: Jens Remus --- arch/x86/include/asm/unwind_user.h | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwi= nd_user.h index 12064284bc4e..77d776c7fca9 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -2,6 +2,22 @@ #ifndef _ASM_X86_UNWIND_USER_H #define _ASM_X86_UNWIND_USER_H =20 +#ifdef CONFIG_UNWIND_USER + +static inline int unwind_user_word_size(struct pt_regs *regs) +{ + /* We can't unwind VM86 stacks */ + if (regs->flags & X86_VM_MASK) + return 0; +#ifdef CONFIG_X86_64 + if (!user_64bit_mode(regs)) + return sizeof(int); +#endif + return sizeof(long); +} + +#endif /* CONFIG_UNWIND_USER */ + #ifdef CONFIG_HAVE_UNWIND_USER_FP =20 #include @@ -19,18 +35,6 @@ .fp_off =3D 0, \ .use_fp =3D false, =20 -static inline int unwind_user_word_size(struct pt_regs *regs) -{ - /* We can't unwind VM86 stacks */ - if (regs->flags & X86_VM_MASK) - return 0; -#ifdef CONFIG_X86_64 - if (!user_64bit_mode(regs)) - return sizeof(int); -#endif - return sizeof(long); -} - static inline bool unwind_user_at_function_start(struct pt_regs *regs) { return is_uprobe_at_func_entry(regs); --=20 2.51.0