From mboxrd@z Thu Jan 1 00:00:00 1970 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 1F778426EC4; Tue, 5 May 2026 12:18:18 +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=1777983500; cv=none; b=rmXwSdZrRwnQrBOP1LfZjVC0MlBYk0G5HD1a3iUf/3UdtdBJncmgL7PcQc0xvg2XUzQ0ejG8k5ic+4hTd8l0pT3aG+YvPzVQy/qAtcxjxpby+p2izZECEGU+cYC65wzHOWVGUh7GVWDliQ/So5sV83LLJdLVMinXO9HmSypgzKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777983500; c=relaxed/simple; bh=lnqUBHPpzXbWDkV21nilebs+kDCcwN10JV8SRrKWPOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JVevv6+LS6DiduTXq4DD+pfwJA2JGkpn/Q+TY0bFYUDKM0a2mWpRzSHO99W79la1TfHASldanv71IUNZdm2pia+WP/e+3hPuYCm1qWKl/ys5QntIu0ryHkCOJ+ap/TNoUeIVvmg1rquqShhT7mwy0tHGqozilu2LvS6+UrN7q2k= 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=X7cka+Fx; 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="X7cka+Fx" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 64563I0U2236368; Tue, 5 May 2026 12:17:30 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=dLUdkq8a3Y1OwT5DX jpOwlqcJtqrXG3rf2YuzJ2NkbA=; b=X7cka+Fxlkuxg3fa7fL7DkyXZdCRhE2pz BTBsiVrkaYM1y4geOYzbsmoSvkPnMdBNsqscjhBQMbVaD4W3GuhJFGMQVaZriqzx c8ArxrKaNVLBMzM9hgRFgcZs5yeph2wxIKej0NeiOQMn9VxVWYmA24OFZwkL1kAm xh2acRy2RRTLccqg159V5hWMJw7bQn/raaNQtnM+8rBX4zK7gc2ee5dcJL6b3DDF enqhF57N9MwN17Naz/gJJqXCYCg5GPWyWHf8pVoa0cOYfJpdo8KYP0qVjEVFeINh yXEt8CghXIfPfDFEmVte/p+FLwv0VZYTM1VOEwW0hjAzV6/nuHVrQ== 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 4dw9y1bh3e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 12:17:29 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 645C9bkD015131; Tue, 5 May 2026 12:17:28 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dwx9y98g0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 12:17:28 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 645CHOUg43057458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 May 2026 12:17:24 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C46192004B; Tue, 5 May 2026 12:17:24 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6092D2004D; Tue, 5 May 2026 12:17:24 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 5 May 2026 12:17:24 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, Steven Rostedt , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Dylan Hatch , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Mathieu Desnoyers , Kees Cook , Sam James Cc: Jens Remus , bpf@vger.kernel.org, linux-mm@kvack.org, Namhyung Kim , Andrii Nakryiko , "Jose E. Marchesi" , Beau Belgrave , Florian Weimer , "Carlos O'Donell" , Masami Hiramatsu , Jiri Olsa , Arnaldo Carvalho de Melo , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich Subject: [PATCH v14 08/19] unwind_user: Stop when reaching an outermost frame Date: Tue, 5 May 2026 14:17:07 +0200 Message-ID: <20260505121718.3572346-9-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260505121718.3572346-1-jremus@linux.ibm.com> References: <20260505121718.3572346-1-jremus@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: 1-0-ys_TCaBcSRISAfsRo81sfod1BNXN X-Proofpoint-GUID: w5dqYWUxr6Si0ukN1IIY6K1w76LcbiVL X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA1MDExNCBTYWx0ZWRfX8Swk4vct0uCk p7COYGCK6DzKtfxlk1afvXZijPdN3wCiC0Z9nP8yt/ZyATSIGhc+GqitKeNkfW6Hzihx2ZDaqUC QtG+jDGO6sw4aR7+RltMPB9Hc1qTqx6XTpwnt+ufrb7xCOhatT37skvkwV6/fqgnGtvWeR13HmD lrGkU0QUpyc30+rlWTK50ckHXiTdVG2DPHQwbX2VSZ1e6EcWPRfGEf+KE2/4gJdnvVJUDBs31gA bif6mtQbO/GL9mQxm40/zy2++U4l8mz2ELbPgJaSe7doX/Q0stZpOB6MgfXFwBoczPiI4FpibPV +1sZU0xJHOHMaazO0EHbRe3i6tdVUKkHc9cmLmRcbh3VDVdh7VgjtEn+zYgBGyOTrCO2npUFepH TzHja9M/YguCYSSHj9pGqdtvM56gG8cHnd9BfGI2HnQuaEV/JXxJq9XV4Xrgvlx+ztiiU4wzSE8 uBUFxa5zAhEBX7MQZ6Q== X-Authority-Analysis: v=2.4 cv=UbFhjqSN c=1 sm=1 tr=0 ts=69f9dfda cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=pGLkceISAAAA:8 a=VnNF1IyMAAAA:8 a=_1qlYuAciRtwIPuEvDgA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-05_02,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 adultscore=0 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605050114 Add an indication for an outermost frame to the unwind user frame structure and stop unwinding when reaching an outermost frame. This will be used by unwind user sframe, as SFrame may represent an undefined return address as indication for an outermost frame. Reviewed-by: Indu Bhagat Signed-off-by: Jens Remus --- arch/x86/include/asm/unwind_user.h | 6 ++++-- include/linux/unwind_user_types.h | 1 + kernel/unwind/user.c | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwind_user.h index 6e469044e4de..2dfb5ef11e36 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -23,13 +23,15 @@ static inline int unwind_user_word_size(struct pt_regs *regs) .cfa_off = 2*(ws), \ .ra_off = -1*(ws), \ .fp_off = -2*(ws), \ - .use_fp = true, + .use_fp = true, \ + .outermost = false, #define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) \ .cfa_off = 1*(ws), \ .ra_off = -1*(ws), \ .fp_off = 0, \ - .use_fp = false, + .use_fp = false, \ + .outermost = false, static inline bool unwind_user_at_function_start(struct pt_regs *regs) { diff --git a/include/linux/unwind_user_types.h b/include/linux/unwind_user_types.h index 43e4b160883f..616cc5ee4586 100644 --- a/include/linux/unwind_user_types.h +++ b/include/linux/unwind_user_types.h @@ -32,6 +32,7 @@ struct unwind_user_frame { s32 ra_off; s32 fp_off; bool use_fp; + bool outermost; }; struct unwind_user_state { diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 1fb272419733..fdb1001e3750 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -32,6 +32,12 @@ static int unwind_user_next_common(struct unwind_user_state *state, { unsigned long cfa, fp, ra; + /* Stop unwinding when reaching an outermost frame. */ + if (frame->outermost) { + state->done = true; + return 0; + } + /* Get the Canonical Frame Address (CFA) */ if (frame->use_fp) { if (state->fp < state->sp) -- 2.51.0