From nobody Sun Feb 8 01:31:00 2026 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 D6DEC21D59B; Tue, 2 Dec 2025 15:08:57 +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=1764688139; cv=none; b=GPUz631nYDWjUity506pNMFMpuofLliNo6zs8seJGHAD3aR7EAS6ZFRkHpK8TFh/qGlW9YEuhksVEtIG7bwm5k8NXkDutL1UzryCdt4ffSlGjdWDVwUeQwU6fGzVXHOFA/jLxfnawYfeD8fFe90/8ptdZSX0jNMuI+Ut3TwL0MA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764688139; c=relaxed/simple; bh=J4PyjTWZZy4AMR0cCiyLgwuuJeCOaxRSVWHewOd8ldY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oKzJWR0zgla8+sl0AKeWwxhZ5RwQPH5e849oandkt0sFKs5itttLNmkKjfactFxXNAywERNOzKRB55STt0sD746uqA6DfpGHmG1ZsIZQD8m5Q4kEexjkjkNRTv0NxfdJZim2FpUap1FU2toMCGBAh7mt/IS0uz8LS+DXVBEYiig= 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=OxtyIOMx; 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="OxtyIOMx" 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 5B25hdan008240; Tue, 2 Dec 2025 15:08:20 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=OxtyIOMxesdbRGJu7vXa3Wy1/20afJwZs olQkhpFrY6wOKx7yj76zagKof5CBChIFOb/aD84aYG+YcW4FHcgtvjX/drO5vvoW 4t321Ip8N0cM74wMnbtBlaauLe0WzUJ1mICaQ/luoN0QevBShAl0NsmlanbRah8W M43Y/00HOuaYfQ+XH7shb2cCFqHkIbG/szoYcUkZO/DVpyx71M3hsQkru+1Z0GPm uyoopqKHhZFWtISRED3b985j4wuFwrDyq2iIWn9ejGBClUkqg0rDA9U2HrEbxHkX iiX/Fea0fkhnTPlIWXjTrmt3BJv4WFlbodj1gL+i4r8zBPxJjtQaA== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aqrbg5t3m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 15:08:20 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5B2DGx1n024045; Tue, 2 Dec 2025 15:08:19 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4arb5sd6b4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 15:08:19 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5B2F8FZL49348974 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Dec 2025 15:08:15 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C97CD20040; Tue, 2 Dec 2025 15:08:15 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 98B7D2004D; Tue, 2 Dec 2025 15:08:15 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 2 Dec 2025 15:08:15 +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 v3 1/3] unwind_user: Enhance comments on get CFA, FP, and RA Date: Tue, 2 Dec 2025 16:08:11 +0100 Message-ID: <20251202150814.3505869-2-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251202150814.3505869-1-jremus@linux.ibm.com> References: <20251202150814.3505869-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-ORIG-GUID: SVlJ4mMwXMYe1KhvuK4Dv1EETDjg7mqa X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTI5MDAxNiBTYWx0ZWRfX5FXSDTJFfssB 3Gm4oRmzAvmt0WuAIJafFXZ5kLI905Zhl/vKNaCOFhCgl9KUklHQEFBl56E1fKQXeea+L/4PAJX SaaI8mwdtVdjuOhwNCcnxb37jFn1gf1l8L5qK49eOxbvfrwe/IzjiQtTeoCNEOqINn3H70cz3lD +CpxjToMgw0B8IcSBQYzv57T5y9TTthj3cNJFUkrUJcBCzQPN61aS6QTKHrU4Ko6zydquJKmg4H HOl4vPQXYkwbHnY7fkHK5EnQPVbdUNfRH3vBDIL+xw+dERyDRJnGdC3MJIRALx+PVy51tzfRu/a 4AA7cT/TI5ALV84cyhTn5Ou3bdYeVCNFwnwUWmrniZyHa7QT00mYn8NTkpTS2KPU4zseSKPyBld 492cIFlxdeHK786c/JOe0dzNQk4sFg== X-Authority-Analysis: v=2.4 cv=UO7Q3Sfy c=1 sm=1 tr=0 ts=692f00e4 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=GRZQj7fo7pb9Qcd1f_cA:9 X-Proofpoint-GUID: SVlJ4mMwXMYe1KhvuK4Dv1EETDjg7mqa 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-12-01_01,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511290016 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 Sun Feb 8 01:31:00 2026 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 242901EB193; Tue, 2 Dec 2025 15:08:46 +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=1764688128; cv=none; b=pu69KlhhdRdVJ0k9D8LMJwfyYebxawz2eh2WRaNoEELL0/upwTAZBW8ytpagzaDk95n/dyPeOsHRjSla0OHyFQofrH83OJvslLBvKFDKuC1X73//DMdMzKZED8yRjKUK35sUIjkzbv664gRzCS9BJtbeHhPKwOMzVpCSYXpbNwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764688128; c=relaxed/simple; bh=9SUoB5P3+wbu/VC/ee1idmz9XakdYQShJohl162A928=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BUuA+NakRRKkdM8CVBjEUeGCT1xTiAuGd9Lcl/keHBSSpvqhxtFRpXTqbpXzblaWCVGMuVi3kbSDzFpkz2Qk0oI87CIEYTvpQyjFIOFXypx7dwKk8V/jfunMiMbfWcjeS3C26x9XsCcNUT4/8MrirzNBGhszeDVn/8QXwWRPiNU= 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=ZcV/MvmD; 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="ZcV/MvmD" 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 5B2A0EUL027811; Tue, 2 Dec 2025 15:08:21 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=S397CtIQ2BgwPo3+H 9k4MdgUl5dyw5002+960yfKThM=; b=ZcV/MvmDlkeAXiF79f8SHv9VGWDj0F9Dn nwxQAxnTkAu+EpYk+LUdNamMOMyuAv64c5knIeXtNwHp2y0z0QDVejIeZQ1DXAir tqjJJwRVeI+ZS992RWkIT2rlLDjZmGoRzQyajIbjYZmIdXLaqxPWXpyLv5V8Omjg F9QIDTivz4sLw5/ChGWKw3bn6QqxrEtJvBBqj8yT6/gBEsMYRHZi9RfCrMYjDJcS CW5m/qeVyu19bMgc4v3fBlM995bOG1uHwbtocq2tH9GzY3MZkJVEvH2o9XB2hxgg S8E582KSp5gt+K/TKYw3Xl3nb6i3IV40NRBk9lDc7HSxE8rPl3r4w== 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 4aqp8pwn15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 15:08:20 +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 5B2E0LGj008636; Tue, 2 Dec 2025 15:08:20 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4arc5mw0k4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 15:08:19 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5B2F8GlQ40960452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Dec 2025 15:08:16 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 08E1620040; Tue, 2 Dec 2025 15:08:16 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CDEBF20043; Tue, 2 Dec 2025 15:08:15 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 2 Dec 2025 15:08:15 +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 v3 2/3] unwind_user/fp: Use dummies instead of ifdef Date: Tue, 2 Dec 2025 16:08:12 +0100 Message-ID: <20251202150814.3505869-3-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251202150814.3505869-1-jremus@linux.ibm.com> References: <20251202150814.3505869-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: AW1haW4tMjUxMTI5MDAwMCBTYWx0ZWRfX33vziMGAWTQI h3mBjZrDRsMhn3gEa3RGNWrGIbhjlyHo1t20jCbzozKwKs3DFMiSZAQPvWl2dSH0padsQN0P7K0 bZ2BshulEceOTwtsRVb70OlVNZOHeN1Q+tkzy4bJ/EX6v6EEKqfmEbILfdFUlYD9UHH0eKZWmgM RS/hbIGaijxbVnStcuBTCR9wy0Y+diAymUX+knXtoDKDs6wm2v66xrNsNx+4gBdhpodsDGu+nBm R7o6YJ2MlhdI15FgB8IejXQw8wOukSin+1hUTYDwqbVsQl3JKsTZt0RZdJdPte1nvb8NajBlF+o OUOeDvt/vEI0pA9C7UqgRdFejNiqJiDLz20+93qrZn7zYKsKaZUzhvj7s8k7H88IzTSwFL/GYbL guyIPsXsmn4bD1bliEvcz/FzEOfRDA== X-Authority-Analysis: v=2.4 cv=dIerWeZb c=1 sm=1 tr=0 ts=692f00e4 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=pRS0VBzutSDFB64YrXgA:9 X-Proofpoint-ORIG-GUID: 8Uz1VdbT6pU3NAQq-HDWEqCXlEGE7c5G X-Proofpoint-GUID: 8Uz1VdbT6pU3NAQq-HDWEqCXlEGE7c5G 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-12-01_01,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511290000 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. Provide (1) a dummy definition of ARCH_INIT_USER_FP_FRAME, if the unwind user method HAVE_UNWIND_USER_FP is not enabled, (2) a common fallback definition of unwind_user_at_function_start() which returns false, and (3) a common dummy definition of ARCH_INIT_USER_FP_ENTRY_FRAME. Note that enabling the config option HAVE_UNWIND_USER_FP without defining ARCH_INIT_USER_FP_FRAME triggers a compile error, which is helpful when implementing support for this unwind user method in an architecture. Enabling the config option when providing an arch- specific unwind_user_at_function_start() definition makes it necessary to also provide an arch-specific ARCH_INIT_USER_FP_ENTRY_FRAME definition. Signed-off-by: Jens Remus --- Notes (jremus): Changes in v3: - Remove comment on #endif. (Ingo) =20 Changes in v2: - Add parameter ws to ARCH_INIT_USER_{FP_FRAME|FP_ENTRY_FRAME}. - Provide common fallback of unwind_user_at_function_start(). - Provide common dummy of ARCH_INIT_USER_FP_ENTRY_FRAME. - Reword commit message accordingly. arch/x86/include/asm/unwind_user.h | 1 + include/linux/unwind_user.h | 18 ++++++++++++++++-- kernel/unwind/user.c | 4 ---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwi= nd_user.h index 12064284bc4e..971ffe937d50 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -35,6 +35,7 @@ static inline bool unwind_user_at_function_start(struct p= t_regs *regs) { return is_uprobe_at_func_entry(regs); } +#define unwind_user_at_function_start unwind_user_at_function_start =20 #endif /* CONFIG_HAVE_UNWIND_USER_FP */ =20 diff --git a/include/linux/unwind_user.h b/include/linux/unwind_user.h index 7f7282516bf5..64618618febd 100644 --- a/include/linux/unwind_user.h +++ b/include/linux/unwind_user.h @@ -5,8 +5,22 @@ #include #include =20 -#ifndef ARCH_INIT_USER_FP_FRAME - #define ARCH_INIT_USER_FP_FRAME +#ifndef CONFIG_HAVE_UNWIND_USER_FP + +#define ARCH_INIT_USER_FP_FRAME(ws) + +#endif + +#ifndef ARCH_INIT_USER_FP_ENTRY_FRAME +#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) +#endif + +#ifndef unwind_user_at_function_start +static inline bool unwind_user_at_function_start(struct pt_regs *regs) +{ + return false; +} +#define unwind_user_at_function_start unwind_user_at_function_start #endif =20 int unwind_user(struct unwind_stacktrace *trace, unsigned int max_entries); 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 Sun Feb 8 01:31:00 2026 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 242FB1FA272; Tue, 2 Dec 2025 15:08:46 +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=1764688128; cv=none; b=Lxo7X/wX9+MlBVk/ArkX37n5pZqMILCenoo924mPFyK0ny2uAIMrrafvtVz1yz1c/uKqLskQHBFuyGBKKWQXMacnnOzvkkSz9rQFmUkZRj5YXuzHODg7Ynhm52NzKkaGTX8AkjIt5vq6VDPeVrGwKCbREpCMCO5qqdV6/lSt0P0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764688128; c=relaxed/simple; bh=jkg8tRwFsBh4lQCKIUPxTfTkJTsnZ3FRJaagjPpOxBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jH1y2ybN16qZskx4AICvIWHCkfIjZTU4LYogW6psnDr2e2DmqwP3PUIQPxZPh7A94X/udcSKR/OxJEFAKkWlZ4iM6zHMH9ukHHDKhjABAnx2/LBo8g7kH8Dv6hkFH/PW290ra181Beuq39bwZHs+Fl0Bq+MA82xI4usu1qQztqE= 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=VA9i/mAf; 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="VA9i/mAf" 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 5B2AFZYD007787; Tue, 2 Dec 2025 15:08:21 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=cQBdhMIcp6DAZi9Zx Vexr6Oh5CmqajUNW2WLiVkcNP8=; b=VA9i/mAfBk24XoqWqmzk8p8SUdlxP5M+B Dn/Lj0Iva3ndZfMJ6WDjYkzN8lYuZt4U+tGMu/FHnID/xb2mwC21YabG/RG7q59X IkfE8w/QgLlEGs3XADqqM7YzDLG5fDh8Kcwe8YyZO44kZAb3xkCP95gp7l0Xzz6L dRmb83AyFOzX6ih/nhSLYKlE6uvo32OmW3nbJecITd7Sg49nvg3Oa7Tk+BWWuF/T P15Hhf3MZ1rYwnybqb1+I5Ij5YFHvoS+5eTlOSBn3wUMuQMbnPa0P8L4ScaI23IG 6btzC8GGSxvhQm/lg8wkFnUgKgJm18LNssDT9qfudMEIU1Ch8osSQ== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aqp8pwn17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 15:08:21 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5B2E2o0r019133; Tue, 2 Dec 2025 15:08:20 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4arbhxw35x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Dec 2025 15:08:20 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5B2F8GVl44302716 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 2 Dec 2025 15:08:16 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3C25520040; Tue, 2 Dec 2025 15:08:16 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D1712004B; Tue, 2 Dec 2025 15:08:16 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 2 Dec 2025 15:08:16 +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 v3 3/3] x86/unwind_user: Guard unwind_user_word_size() by UNWIND_USER Date: Tue, 2 Dec 2025 16:08:13 +0100 Message-ID: <20251202150814.3505869-4-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251202150814.3505869-1-jremus@linux.ibm.com> References: <20251202150814.3505869-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: AW1haW4tMjUxMTI5MDAwMCBTYWx0ZWRfXzkYD9Vwg8P08 Qg8YhZ8iLfU1akzU1yfWnUzT5Yj0A+Ko4cn5Yul8RDzrfPmQSRk+wfRkWvDDFzgQ0JDfCTdMVXR w0FDAspSQrHbL/PFeLqylHNMKx43FaAmggXEvUpXzfkyh8l98tytDRLpsqSSbsPB5XHM8MrmfsH pQj2URBqC7TeATBR4LgZI7zMXfYkJIPEN4IfEvD0nLGyoCfoauTM/T3n/jwKp4khNiVL9IPGC1X NFP1p1DAYFR6ohTu37ztTzlxkMTfqx0iw/hGKzPbvTtCRoRe4svLATpQRJk9dFxxCqzkT71k3ge tOeh86tfyJ8n7hPqOFLQ8mVICaR6C0Ut54Ass8dtxuJOm7ii7JLfxMeHijGRpSGxHxbzqJL79/H vVHS5RAmnVPC0HPmqedHKx6M4LnARw== X-Authority-Analysis: v=2.4 cv=dIerWeZb c=1 sm=1 tr=0 ts=692f00e5 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=EUPQYQbpjl04SHwYsagA:9 X-Proofpoint-ORIG-GUID: jTCte1t2R41GFG_ziEfzwZaB4OTMIOjr X-Proofpoint-GUID: jTCte1t2R41GFG_ziEfzwZaB4OTMIOjr 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-12-01_01,2025-11-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 clxscore=1015 spamscore=0 malwarescore=0 suspectscore=0 adultscore=0 bulkscore=0 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511290000 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 --- Notes (jremus): Changes in v3: - Move includes into more common UNWIND_USER guard at the top of the source. asm/ptrace.h is required for struct pt_regs. arch/x86/include/asm/unwind_user.h | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwi= nd_user.h index 971ffe937d50..7f1229b33d06 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -2,23 +2,11 @@ #ifndef _ASM_X86_UNWIND_USER_H #define _ASM_X86_UNWIND_USER_H =20 -#ifdef CONFIG_HAVE_UNWIND_USER_FP +#ifdef CONFIG_UNWIND_USER =20 #include #include =20 -#define ARCH_INIT_USER_FP_FRAME(ws) \ - .cfa_off =3D 2*(ws), \ - .ra_off =3D -1*(ws), \ - .fp_off =3D -2*(ws), \ - .use_fp =3D true, - -#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) \ - .cfa_off =3D 1*(ws), \ - .ra_off =3D -1*(ws), \ - .fp_off =3D 0, \ - .use_fp =3D false, - static inline int unwind_user_word_size(struct pt_regs *regs) { /* We can't unwind VM86 stacks */ @@ -31,6 +19,22 @@ static inline int unwind_user_word_size(struct pt_regs *= regs) return sizeof(long); } =20 +#endif /* CONFIG_UNWIND_USER */ + +#ifdef CONFIG_HAVE_UNWIND_USER_FP + +#define ARCH_INIT_USER_FP_FRAME(ws) \ + .cfa_off =3D 2*(ws), \ + .ra_off =3D -1*(ws), \ + .fp_off =3D -2*(ws), \ + .use_fp =3D true, + +#define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) \ + .cfa_off =3D 1*(ws), \ + .ra_off =3D -1*(ws), \ + .fp_off =3D 0, \ + .use_fp =3D false, + static inline bool unwind_user_at_function_start(struct pt_regs *regs) { return is_uprobe_at_func_entry(regs); --=20 2.51.0