From nobody Sat Feb 7 05:44:17 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 C3992361654; Tue, 27 Jan 2026 15:20:03 +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=1769527206; cv=none; b=jWj0L8FsKujzoKIK1C317EcKBP0AZ44dSDjYOypr+88aiLsn4UWQMm6UyL5RNYjUVjDxDNsFROFhJAhLOu8WwxcjEmS7UsxJWyTytcZXboTdasE//yB/ioYzt300w8nBEYWwn5l9z0RKubrTTJwOOPJZyltG/zxpcVA/F/c7VL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527206; c=relaxed/simple; bh=kaPUe9HEKn8n1z5tXB04hI3rzMgQLA6Ru2FLKn1YNjE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OsDZt9F9zAXbPEHUGm3mLNJYB3KkYpPJnLdYRCYRijr/S+KR5oelnPDF+0cwlQI9NrI+Y0iLmaV0A28Uag7P5ba8c1BFz20B4lbFlvrP+1kGzbV/TCkyUn45S12D4Y6QSA6zPuIdcP7w3Dfi553oWWB7HCeteVwuaQ/5o+UUHGA= 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=q6J8Inew; 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="q6J8Inew" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R87CcA017052; Tue, 27 Jan 2026 15:19:37 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=0U9VOyhHCvaJ8UWLX 8BbR5hsyCDcsncf5gTti8J2pdY=; b=q6J8Inewdoa8NYTWMimSrskbIOwa4Js+q NPQk/2mPuvSnc1YLiSh3TbMBdrFedOHPALff0EpEhNkyFRAQu6p4ir9c/boU5H79 DFhBu+wFE/WyAtGRXPfDUx3obA3rz+VpprZwZ3HXJMSSfS6dXiGIGYUpYqp+S7AN jfxttyTBoZ/nhCRwpBQeIululgvxflg0GOnHJ6UmHX5iv04+mzW0UgEEh5HSpKWr XKtVz6leYC6THim18lPOFDzuQqTgKIGHGVe8ob2DGdY48opeGhC6sRPqriEiLHhv 2KFL5Z+jzpYar8vy1JtUjQNId/PYjgfX1PDUBd+NB8q0+WMePQMow== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvmgfvfft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFGGf8014106; Tue, 27 Jan 2026 15:19:36 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvmgfvffm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:36 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 60REgU8i023624; Tue, 27 Jan 2026 15:19:35 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4bwamjrxxh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:35 +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 60RFJVv747645146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:32 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CC2A520040; Tue, 27 Jan 2026 15:19:31 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8401E2004B; Tue, 27 Jan 2026 15:19:31 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:31 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 01/12] s390: asm/dwarf.h should only be included in assembly files Date: Tue, 27 Jan 2026 16:19:14 +0100 Message-ID: <20260127151926.2805123-2-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-Authority-Analysis: v=2.4 cv=Z4vh3XRA c=1 sm=1 tr=0 ts=6978d789 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=62EC5onNXgn9lpaB:21 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=AB0lExOjSfRHyy3z6bMA:9 X-Proofpoint-GUID: SagVeGzBAfCeEh-IB3v7NxBRHDwEqn7w X-Proofpoint-ORIG-GUID: hAb7Qz9FU9hp-6BRrNTIApnjgNty2F9S X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfXyB1dPePuW95I NgK0Lfug4ZCx0qfMsg2bO7BVcxg6CuIv+JsMdAh/gRcNjvXJu3yJX/xNrNLra3vUcBmockFdlsD bHgOM2yvwL5fQ/mKxBDjRRf3BDNs08yBnLOOA1ir+YF0hX1nDKCl6Ihr+igP+eVYTyhaLYa6/vm 4mNh9PnxtE0QHG+DxGIjJrDX39fOGimeLK6zQcH6EbEM0URrAhu9Re53MeXq970SZT+IB7XoWRk lqftOqIirYJXDTbzPmQXtL8TelbQ5X/n7EC4yl2wcIDqBGiwdISrcmubWUJlwbA3zSqNzhdTtZi RplG03rEj0KsArQ0m0rGKpHUUXZMVOQ3dFqUVqz45gvPMmua1PN/U+WHUFN+AukncGthKGtRxuN TTptntW9YrOmhYUAwsGP6+c+Jc/6WAp7DJY1ivqF6OJ0VlhMbeoNEJu/FvyHtgl2+RIgPBEmSTs VIDj6Hc2pUEvKxwSNnQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" Align to x86 and add a compile-time check that asm/dwarf.h is only included in pure assembly files. Signed-off-by: Jens Remus --- Notes (jremus): Changes in RFC v2: - Adjust to upstream change of __ASSEMBLY__ to __ASSEMBLER__. arch/s390/include/asm/dwarf.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/dwarf.h b/arch/s390/include/asm/dwarf.h index e3ad6798d0cd..df9f467910f7 100644 --- a/arch/s390/include/asm/dwarf.h +++ b/arch/s390/include/asm/dwarf.h @@ -2,7 +2,9 @@ #ifndef _ASM_S390_DWARF_H #define _ASM_S390_DWARF_H =20 -#ifdef __ASSEMBLER__ +#ifndef __ASSEMBLER__ +#warning "asm/dwarf.h should be only included in pure assembly files" +#endif =20 #define CFI_STARTPROC .cfi_startproc #define CFI_ENDPROC .cfi_endproc @@ -33,6 +35,4 @@ .cfi_sections .eh_frame, .debug_frame #endif =20 -#endif /* __ASSEMBLER__ */ - #endif /* _ASM_S390_DWARF_H */ --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 4B0BB35F8DC; Tue, 27 Jan 2026 15:20:01 +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=1769527203; cv=none; b=ag6qjDQAjvGx/qJ0QE67YVWH2zfYaOhGusZm+bRhabB7yBDoJh63B69b+jZVVre82Z2Ned01hySuy9GVNfMRVfJUmXiMPZTlgPRYnlgfEVn+NvNDpDLXssPD8Fb9KjaVAJ7qh1PnlwTa0UO2DHDYWwG8FdROjz6EWfhErBkbLMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527203; c=relaxed/simple; bh=n4UqXtWKP9aM7+of2a9zTKNpugsdsHjeuZZ9Y6vQt1g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LNpTACnt3jLKTdf3JLQL1+UnWLpX8n08paMoPYTEVcDvLgJFZbtUU1NNGqojx5HjHcq5V7PdWYWryufEsitnHk5ifiX9vI27RO1KSEMsyHmXiG3kJEu45iMvfSHDiFQnaClIswddg7B7uom6Zs3zg5r/L3GCXqVUNVgNqYL0HxM= 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=d9wYm5H1; 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="d9wYm5H1" 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 60R8JYWi021655; Tue, 27 Jan 2026 15:19:38 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=YwkCBIDx+CdwD1PaP 1iGkMwFtK6nggvYnNMUdWID+FY=; b=d9wYm5H1bnAJo4F6vo4IW5OyLc2T+n2XR 6/SYNP55taYa5OBXkHAaWwXsci9/7jA04Z0bGhyogvMX6+TI361cmZKlmqxQeYHT qRongjx2vma9aVcPmx6kqKxzQzeGwyhAe9i/ShSzlf9J60UtPpLDxjB6kJFZQUNs mYdhlOQCUmIcqaGnA66oS+4mJAdlNaU4QNYcPy3erbupNuHbPmNP6iQbfDBAq1JC iykkiClHGu68AA1UKENGBHquOmGGYA/31QewyjCHfDfTvQCu7FmcpkZxyWwiQW6S el3IbRe3gbHDK5xHsTbqfsUFXT7Fqj1UN63i1S9lyO1f2W/9KL9qg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvnk6x5hh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFFtfW006394; Tue, 27 Jan 2026 15:19:37 GMT 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 4bvnk6x5he-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +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 60REptfE017960; Tue, 27 Jan 2026 15:19:36 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4bwb41rvge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:36 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJWFD61866366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:32 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 25DB920040; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D0D3D20043; Tue, 27 Jan 2026 15:19:31 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:31 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 02/12] s390/vdso: Avoid emitting DWARF CFI for non-vDSO Date: Tue, 27 Jan 2026 16:19:15 +0100 Message-ID: <20260127151926.2805123-3-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-GUID: h_nc00dc0Tt1Wj7AikvB-Ktd9HCsR19H X-Proofpoint-ORIG-GUID: bzr1sWWmmNhoHfzG0j-EJXNVzzOZJstn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfX/AlT+89Tcx18 BVzYUI9JvLp7ubq0wMfau7ye6qk5kfujksQjXfZ62SLH1DZGSRHzlGKq2pTzQLHqMZXMPQXyWdG WxGvWz7v9QuwibLseupLQ3WaTlDWmYfOpys6xSwJk/QTfIuNARABklgDmAHRk4wfE5nVCQSzCkb 0LJfKUaP7WHGBVEk94DbLl6YjB7bSTrweKcUsP1uhbLdJJ2NiXQtr8LfEd45jivTTLMyI8fbYnZ KMu7nmTa//l8fXLbKhLko+SWLgFy6ch9/52IDx43nIx627n+37ATAeNtu16MLjRmp13lxb/zkS2 TGD4biolxS+8dg10/uWFxxiRGq2TNSmqVA0fnlfIzp3ZVELqCSo5QQYDEQbRTdT/3S4w3x+Gnhj qxI3pzqmAO+7MftRMP9xebKN6H+krbo8ywnT+aax4/9zLSHQrECQ7jYRF7xW2bquakePb9xxv4r tuHvjMl903EjNhMgQYQ== X-Authority-Analysis: v=2.4 cv=AMiVTGgp c=1 sm=1 tr=0 ts=6978d78a cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=meVymXHHAAAA:8 a=VnNF1IyMAAAA:8 a=BeDKgDnIR9-QKG0Pbi4A:9 a=2JgSa4NbpEOStq-L5dxp:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 phishscore=0 bulkscore=0 suspectscore=0 adultscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" This replicates Josh's x86 commit TODO ("x86/asm: Avoid emitting DWARF CFI for non-VDSO") for s390. It also aligns asm/dwarf.h to x86 asm/dwarf2.h. It was decided years ago that .cfi_* annotations aren't maintainable in the kernel. For the kernel proper, ensure the CFI_* macros don't do anything. On the other hand the vDSO library *does* use them, so user space can unwind through it. Make sure these macros only work for vDSO. They aren't actually being used outside of vDSO anyway, so there's no functional change. Signed-off-by: Jens Remus --- Notes (jremus): Link to latest x86 patch: https://lore.kernel.org/all/20250425024022.477374378@goodmis.org/ arch/s390/include/asm/dwarf.h | 45 ++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/arch/s390/include/asm/dwarf.h b/arch/s390/include/asm/dwarf.h index df9f467910f7..6bcf37256feb 100644 --- a/arch/s390/include/asm/dwarf.h +++ b/arch/s390/include/asm/dwarf.h @@ -6,6 +6,18 @@ #warning "asm/dwarf.h should be only included in pure assembly files" #endif =20 +.macro nocfi args:vararg +.endm + +#ifdef BUILD_VDSO + + /* + * For the vDSO, emit both runtime unwind information and debug + * symbols for the .dbg file. + */ + + .cfi_sections .eh_frame, .debug_frame + #define CFI_STARTPROC .cfi_startproc #define CFI_ENDPROC .cfi_endproc #define CFI_DEF_CFA_OFFSET .cfi_def_cfa_offset @@ -16,23 +28,24 @@ #ifdef CONFIG_AS_CFI_VAL_OFFSET #define CFI_VAL_OFFSET .cfi_val_offset #else -#define CFI_VAL_OFFSET # +#define CFI_VAL_OFFSET nocfi #endif =20 -#ifndef BUILD_VDSO - /* - * Emit CFI data in .debug_frame sections and not in .eh_frame - * sections. The .eh_frame CFI is used for runtime unwind - * information that is not being used. Hence, vmlinux.lds.S - * can discard the .eh_frame sections. - */ - .cfi_sections .debug_frame -#else - /* - * For vDSO, emit CFI data in both, .eh_frame and .debug_frame - * sections. - */ - .cfi_sections .eh_frame, .debug_frame -#endif +#else /* !BUILD_VDSO */ + +/* + * On s390, these macros aren't used outside vDSO. As well they shouldn't= be: + * they're fragile and very difficult to maintain. + */ + +#define CFI_STARTPROC nocfi +#define CFI_ENDPROC nocfi +#define CFI_DEF_CFA_OFFSET nocfi +#define CFI_ADJUST_CFA_OFFSET nocfi +#define CFI_RESTORE nocfi +#define CFI_REL_OFFSET nocfi +#define CFI_VAL_OFFSET nocfi + +#endif /* !BUILD_VDSO */ =20 #endif /* _ASM_S390_DWARF_H */ --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 74C5D35FF40; Tue, 27 Jan 2026 15:20:01 +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=1769527204; cv=none; b=AgsXRFbf4S4nwGhOPJCLVCWZXcxuJ4D8vtanrb0KugY3EDqyH1DAsI7cxCrBG71IsZ66tXJafRXV03Eu7OM0S0DZf7IQydDlNryNfxTefc1Zf61kx7bDTRoSLX7PVI5NQ56LQAuqSrLHwjaDDBFueOOssvmUIVuOB6jnYxnq8CQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527204; c=relaxed/simple; bh=rOcR+5F/C3Nq8e90YbOxlbMijoGlvSAnkfOY289Jreo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i9CyFrSPJE94/MKZrpaafO8abn4PJeTAlVIfR+k6XJJCXPt3M3yyECO6RlbESHlKJahDFqUlWGQ5KjzFu887Bf8SNJkF49b0BVcpcvzbpaeZQzOA+iIUQolsvNfE0HT4u8R9DRC2k4dtMKO9X7/Xev1zC0NVjcAR6H5CzRJ/Ayk= 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=nBc0Gw8v; 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="nBc0Gw8v" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R7HbWs014420; Tue, 27 Jan 2026 15:19:39 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=QIzG3yERWAD0X6BiE CosJMQQHT3hd/5vCOzAO3f76gI=; b=nBc0Gw8vAlJ1QibcDWBzTPCMxoFMlZJnc EZldc8qlM06wayxuknypttfW6rr2nfwyt29pVWiB4H8SKMQLUwdfpKnriSS3X6Zz uADQUx+nKegv54fD/6KTvzDEcVd3buXmdb6MOl2hHm5nKLI3dy2US8/wXIvA07tQ X4E1bFhX5l/8SLuOG0kiBAkqoLdoBh3u0H21d3DPr263GAupnuLMOD43hA4MgEkA nYReUFdDEx8nVfScbNG4f9Q5jPQU4bPBtLJl4NmcYsyl27YwwEigerhzeNqVRtmU sZyFk9KMrGgTeiHw6dVGF+nc1JQ7tWqtDQ4E8IbueHRvHWIOTEJFw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvnrte1vk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFJber008249; Tue, 27 Jan 2026 15:19:38 GMT 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 4bvnrte1v7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +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 60RE3Pmn019666; Tue, 27 Jan 2026 15:19:36 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw9dn153y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:36 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJWOG61866368 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:32 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E32C20043; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2A5A42004B; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 03/12] s390/vdso: Keep function symbols in vDSO Date: Tue, 27 Jan 2026 16:19:16 +0100 Message-ID: <20260127151926.2805123-4-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-GUID: TOYoFOrvGBo3XdukcZDhpQGLAq2TyU_B X-Authority-Analysis: v=2.4 cv=Uptu9uwB c=1 sm=1 tr=0 ts=6978d78a cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=meVymXHHAAAA:8 a=VnNF1IyMAAAA:8 a=jnAA27LldM3NCp0g0JkA:9 a=2JgSa4NbpEOStq-L5dxp:22 X-Proofpoint-ORIG-GUID: 4puAM-DtEJJ45pjh5iMT5mNi_AO2fhtR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyMSBTYWx0ZWRfX5KKO9kgPsI5c uYa3XNUhw2ynyRt8TgveCWbQXdfcaDKTtkeexwdG+TwTcnOy5tNP12F9nktkVxb+guzFHpxesik rpfO11Vp/ZjnMHVl0vFd39GCeX5sZJUw0eqCDfsmxHSRxDcrUNnnJJs9X6jak3Fr0xH60Y4cqj4 CWjTskvlmDmOAK1V035XdgQ9UU2E5lRVZEUo9WbqKsA5NdfbLaNjMNjh+1u5q3SH6O5Opow6Juk ni5fEwpIanz8KSJ43nrUWb42nQrOwEpnwbw58doPvSvlfXqJHUTdh/QaSzwtyq5MW0bY79Dofan eibkawwNWUORaaStNEiSOWO/MoVUPYf9SjpoCKoXvEghKIFHurGPeS3NOcKDIvaEz9BrFCzVSXf IA93X5MdJiNx51Pae7x9J4O8Br7JJhY7/REoc+E7lMR1nV49hGIWTzC/wyx4owq+XUs9CoOx8su 1a+o2EoHciMdXBJ3VtA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270121 Content-Type: text/plain; charset="utf-8" Keep all function symbols in the vDSO .symtab for stack trace purposes. This enables a stack tracer, such as perf, to lookup these function symbols in addition to those already exported in vDSO .dynsym. Signed-off-by: Jens Remus --- Notes (jremus): Changes in RFC v2: - Use objcopy flag "-g" instead of "-S" with the cumbersome filter "-w -K "__arch_*" -K "__cvdso_*" -K "__s390_vdso_*" to keep the function symbols, as Josh did in "x86/vdso: Enable sframe generation in VDSO": https://lore.kernel.org/all/20250425024023.173709192@goodmis.org/ - Reword commit message. =20 Note that unlike Josh I did not squash this into the subsequent patch "s390/vdso: Enable SFrame generation in vDSO", as this change is unrelated to enabling the use of SFrame. perf report/script do also benefit from this change when using perf record --call-graph dwarf. =20 Note that this change does not cause the vDSO build-id to change. perf record may therefore not dump an updated copy of the vDSO to ~/.debug/[vdso]//vdso, so that perf report/script may use a stale copy without .symtab. Resolve by deleting ~/.debug/. arch/s390/kernel/vdso/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/vdso/Makefile b/arch/s390/kernel/vdso/Makefile index 2fa12d4ac106..3a8bde5716f4 100644 --- a/arch/s390/kernel/vdso/Makefile +++ b/arch/s390/kernel/vdso/Makefile @@ -50,7 +50,7 @@ $(obj)/vdso.so.dbg: $(obj)/vdso.lds $(obj-vdso) $(obj-cvd= so) FORCE $(call if_changed,vdso_and_check) =20 # strip rule for the .so file -$(obj)/%.so: OBJCOPYFLAGS :=3D -S +$(obj)/%.so: OBJCOPYFLAGS :=3D -g $(obj)/%.so: $(obj)/%.so.dbg FORCE $(call if_changed,objcopy) =20 --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 3F8F435CBB0; Tue, 27 Jan 2026 15:20:01 +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=1769527203; cv=none; b=S+osO6pzTcw8GNjU6b6NGaGPgfc1BYaIUN1ERH1BE3hwpMsZeXgH+evd/Vc81qRDW9JHAdypUImFhtHP6nmt6ycJqh2aMXplBgJziqDmZnymaqqSvf7owcXjMZLXwpxPWWXobnT4EfZH/QDu3+13CaGV+pElbLMXNhR0rzMIEwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527203; c=relaxed/simple; bh=NX1lub2wg02nrRuvM/eEfc4uFVh0nxxekKzTNLP34Uk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZcNMCiZEMQNV3XI3lf50tiP2OwrMHv9631Rol3q5wWywzTvrdtH8RBiCNlzu//6EQnQ/WGmkT7zCxy9oxI8qIfj+LHDHPUGqHB8quyTvJG2tPKKRPPEeRhfHyXVmrNqActg9y7EuTo2tqiJNmi8xlkOjI3UdJLjt9Ntj/CqSDQs= 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=WTnJzchK; 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="WTnJzchK" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R6nRoW030212; Tue, 27 Jan 2026 15:19:38 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=TA9Fyu/N//vwb3hoz 5GJXxji6d+3johNsY9O2zhB5m4=; b=WTnJzchKYRiUkb5+024ssRHvU3fO1l2kR pYrKvsal+Yo5/yjqVkEvqyexOGl7Igf7yAwye+BB8MR+tp0xvPt9kOrvWaREkAG/ VmPOBnkJd+UmFjsDFsKx339XlvWNTOCVH1ZpFA47BTpq3HcWxTxy0lD0b+sRLMnG CEcr5AU24ceY7ZZ2+liPby+QAlv5b5awBTzwf2ofpHSLlz3XCOjNe3AX79+kmUVn ho8lh+uT8Jb1E+qUaCMghNOXkOaoH4OBlLdLqix5R0Js64w5hzEN3BFyGD4AbYba QSvM4C9ff6JyP/EOmpJPP40GjfSU5qbVsYu0GCGQp86ZEzTb0NF9Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvnrte1ve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFJbep008249; Tue, 27 Jan 2026 15:19:37 GMT 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 4bvnrte1v8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +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 60REptfF017960; Tue, 27 Jan 2026 15:19:36 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4bwb41rvgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:36 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJW0u60883424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:32 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7A6D20040; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 736782004D; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 04/12] s390/vdso: Enable SFrame V3 generation in vDSO Date: Tue, 27 Jan 2026 16:19:17 +0100 Message-ID: <20260127151926.2805123-5-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-GUID: lfu8Mof5g3CdoScifPWLHUtF_nYHVS_N X-Authority-Analysis: v=2.4 cv=Uptu9uwB c=1 sm=1 tr=0 ts=6978d78a cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=meVymXHHAAAA:8 a=VnNF1IyMAAAA:8 a=aCsQZq_vhc4F8yeggjQA:9 a=2JgSa4NbpEOStq-L5dxp:22 X-Proofpoint-ORIG-GUID: -C89hkHOri2E7tocAabfmdej8sBQF5UY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyMSBTYWx0ZWRfX2IxyCzz44tC+ yAACqJAY2u7UsL0izW/LgMXbRI0sN5s7c31bazC2Zy9c7lcExHTr+uo4iwFNpn6ZNluFPBtd1fQ Z50ALI7znTxOElzf41kOrgAs3vmRwK3mPILuovgaZca6uQWKK2wFTzbO9iYpr5HGrRBqr5ov4yI 3qTMNu73kxRmP9gqaJgUYgjFgf/tbiY46zklPs2IiiG0xIwe6w+aqA5KL47UcI2j4qlTusB+ouu +qhKvc+aQ2NVWXGlWmqF6F3BQRXTn4i8EhFILKPzkAS5wwzhPNVMLpVB/ZCrDOzEA7+3pcdqfL/ l53yxXdN/z1DoPNzwN5vSp9eKpM7MzZy21jkS+ZCkmVOrxcPSuH/26LMo1a9vAjgUbRqi0qdQ7l UriU7lbIjib1FOcN981vq0nSzIeuUqG/WQWyPC5l+ijGmT4phUmBas0DWA+kGuIN1913hDEnUUM GR/2opxRRKzqm3yyVPQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270121 Content-Type: text/plain; charset="utf-8" This replicates Josh's x86 patch "x86/vdso: Enable sframe generation in VDSO" [1] for s390. Test whether the assembler supports generating SFrame V3 stack trace information. Note that it is insufficient to test whether the assembler supports option --gsframe-3, as GNU assembler supports that regardless of whether it is actually capable of generating SFrame V3 stack trace information for the architecture. If so enable SFrame V3 stack trace information generation in the vDSO library so kernel and user space can unwind through it. [1]: x86/vdso: Enable sframe generation in VDSO, https://lore.kernel.org/all/20250425024023.173709192@goodmis.org/ Signed-off-by: Jens Remus --- Notes (jremus): Changes in v4: - Test for and generate SFrame V3 using assembler option --gsframe-3. =20 Changes in RFC v2: - Introduce config option AS_SFRAME instead of requiring Josh's x86 patch as pre-requisite. - Reword commit message. =20 Link to Josh's latest x86 patch: https://lore.kernel.org/all/20250425024023.173709192@goodmis.org/ arch/Kconfig | 7 +++++++ arch/s390/include/asm/dwarf.h | 4 ++++ arch/s390/kernel/vdso/Makefile | 7 ++++++- arch/s390/kernel/vdso/vdso.lds.S | 9 +++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/Kconfig b/arch/Kconfig index dcb553136e0c..b5b3a83072f7 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -479,6 +479,13 @@ config HAVE_HARDLOCKUP_DETECTOR_ARCH It uses the same command line parameters, and sysctl interface, as the generic hardlockup detectors. =20 +config AS_SFRAME + bool + +config AS_SFRAME3 + def_bool $(as-instr,.cfi_startproc\n.cfi_endproc,-Wa$(comma)--gsframe-3) + select AS_SFRAME + config UNWIND_USER bool =20 diff --git a/arch/s390/include/asm/dwarf.h b/arch/s390/include/asm/dwarf.h index 6bcf37256feb..2f148b15fd7d 100644 --- a/arch/s390/include/asm/dwarf.h +++ b/arch/s390/include/asm/dwarf.h @@ -16,7 +16,11 @@ * symbols for the .dbg file. */ =20 +#ifdef CONFIG_AS_SFRAME + .cfi_sections .eh_frame, .debug_frame, .sframe +#else .cfi_sections .eh_frame, .debug_frame +#endif =20 #define CFI_STARTPROC .cfi_startproc #define CFI_ENDPROC .cfi_endproc diff --git a/arch/s390/kernel/vdso/Makefile b/arch/s390/kernel/vdso/Makefile index 3a8bde5716f4..d604839756d0 100644 --- a/arch/s390/kernel/vdso/Makefile +++ b/arch/s390/kernel/vdso/Makefile @@ -20,7 +20,11 @@ targets :=3D $(obj-vdso) $(obj-cvdso) vdso.so vdso.so.dbg obj-vdso :=3D $(addprefix $(obj)/, $(obj-vdso)) obj-cvdso :=3D $(addprefix $(obj)/, $(obj-cvdso)) =20 -KBUILD_AFLAGS_VDSO :=3D $(KBUILD_AFLAGS) -DBUILD_VDSO +ifeq ($(CONFIG_AS_SFRAME3),y) + SFRAME_CFLAGS :=3D -Wa,--gsframe-3 +endif + +KBUILD_AFLAGS_VDSO :=3D $(KBUILD_AFLAGS) -DBUILD_VDSO $(SFRAME_CFLAGS) =20 KBUILD_CFLAGS_VDSO :=3D $(KBUILD_CFLAGS) -DBUILD_VDSO -DDISABLE_BRANCH_PRO= FILING KBUILD_CFLAGS_VDSO :=3D $(filter-out -mpacked-stack,$(KBUILD_CFLAGS_VDSO)) @@ -29,6 +33,7 @@ KBUILD_CFLAGS_VDSO :=3D $(filter-out -munaligned-symbols,= $(KBUILD_CFLAGS_VDSO)) KBUILD_CFLAGS_VDSO :=3D $(filter-out -fno-asynchronous-unwind-tables,$(KBU= ILD_CFLAGS_VDSO)) KBUILD_CFLAGS_VDSO +=3D -fPIC -fno-common -fno-builtin -fasynchronous-unwi= nd-tables KBUILD_CFLAGS_VDSO +=3D -fno-stack-protector +KBUILD_CFLAGS_VDSO +=3D $(SFRAME_CFLAGS) ldflags-y :=3D -shared -soname=3Dlinux-vdso.so.1 \ --hash-style=3Dboth --build-id=3Dsha1 -T =20 diff --git a/arch/s390/kernel/vdso/vdso.lds.S b/arch/s390/kernel/vdso/vdso.= lds.S index 7bec4de0e8e0..13d20fcede2f 100644 --- a/arch/s390/kernel/vdso/vdso.lds.S +++ b/arch/s390/kernel/vdso/vdso.lds.S @@ -51,6 +51,11 @@ SECTIONS =20 .eh_frame_hdr : { *(.eh_frame_hdr) } :text :eh_frame_hdr .eh_frame : { KEEP (*(.eh_frame)) } :text + +#ifdef CONFIG_AS_SFRAME + .sframe : { *(.sframe) } :text :sframe +#endif + .gcc_except_table : { *(.gcc_except_table .gcc_except_table.*) } =20 .rela.dyn ALIGN(8) : { *(.rela.dyn) } @@ -77,6 +82,7 @@ SECTIONS * Very old versions of ld do not recognize this name token; use the const= ant. */ #define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_SFRAME 0x6474e554 =20 /* * We must supply the ELF program headers explicitly to get just one @@ -88,6 +94,9 @@ PHDRS dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ note PT_NOTE FLAGS(4); /* PF_R */ eh_frame_hdr PT_GNU_EH_FRAME; +#ifdef CONFIG_AS_SFRAME + sframe PT_GNU_SFRAME; +#endif } =20 /* --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 8E23923E23C; Tue, 27 Jan 2026 15:19:58 +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=1769527200; cv=none; b=LbV1VGHbwAlyvYN7d2KN2lmDygXqDJk/erVN+cDoE1ZjCdfW251gOeYwAfLSKZCbQX0wON31vE4Zm2yimlXJMcid2i3s44dCSPaO7g9s/qgXNFWobxpQEKhjjTogjESVKzY3sTU0Xh3gNdXb8qla2tNg9ke4KcNrUp7vSNkEY1Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527200; c=relaxed/simple; bh=RT8EBSR8WUQAbyvZRvXCygdtoMjanu9p9cPL0JHiKSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vggo9FU5vnN14XYFjHd5Zdu++Ptv8Rd8JESRpX4BiSQy8HgX0LX+il7ZNnTYFMWVKYakJRjVvN/7sRuGNnhU7dkQrczNfjvgeGjlDqJsHL7V8mX9jAwLicCEqcrvhojC2umnfPUTfyRn1Fp94u7SNjaMta9wBs6p8pemSWdyguU= 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=X1W9jFj+; 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="X1W9jFj+" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R80wX1010200; Tue, 27 Jan 2026 15:19:39 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=1TqPmQcpDe5apq/kR pvca83qGv9hWGr5mzGDqs1lLgI=; b=X1W9jFj+b26zgpaIINIlniXat7mR1Vy/3 oMasOd4CsZktmzGfSjJd4Y1CFKgfzcQc9UgDOJw/R9GKutk25tj+VXh5+BDx2A02 iGzptLL9Q/+xLnfiq58K8e6sKcfdQ7FU0n4bbOIU6J0lwdm44tidIlepfTsrwHDv /OqACNriQHAS8p35cPGNf/xcXPKq+l7nXQtNr7j9amdO+h7H/eAkk3870GR6Zw2t 78RxhEyO9zxlXGAJ1KH7w/ou+/Ln+uHZ+seXF+rNhkzEaF3o0kKA+sVZ4FSzcRFJ BAV95Wyo0PkN/xLFS1uuPzOgnfVxzdSeLohoxRf/vBdJQTH//kPSQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvnrte1vh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFD6S9025596; Tue, 27 Jan 2026 15:19:38 GMT 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 4bvnrte1v9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +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 60REZjgE017966; Tue, 27 Jan 2026 15:19:36 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4bwb41rvgh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:36 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJXJp14680446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:33 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0D0B820040; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BC60020043; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:32 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 05/12] unwind_user: Enable archs that define CFA = SP_callsite + offset Date: Tue, 27 Jan 2026 16:19:18 +0100 Message-ID: <20260127151926.2805123-6-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-GUID: KyIC7bF4FuLeyIQSv9yvDDXMGlNmPLkq X-Authority-Analysis: v=2.4 cv=Uptu9uwB c=1 sm=1 tr=0 ts=6978d78a cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=D-3WH5monn3MMgO2UeQA:9 X-Proofpoint-ORIG-GUID: JGPGDIlhc6TzCi6TuXKlwH2paykcZ1eT X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyMSBTYWx0ZWRfXxJ1Rn4mBPI46 MvDaOth+MUyvapytBn/p9OcYA0ITq100qKf3vt56RfVBRpjy0rCuLZluFoOd2MxDQS5BAJXtMdo HOjwd2z612x9KiuhJAUivQNfL/6UhiKIdl/RKD4+xPujUlo1noqnVW9kCaackarEcMSNSmIFgh/ m1M7m8n01+UnLBSGxtuaqioeL+bFgoQMCWsvdAGC4quWBt/WJkSmXLlLjXZ+X1SSEeWM3qHs9c7 fMHpL3BMsKpvfAj/+QyDHfkWDIy2HLcHrpuxKlNBpAAUMPUfKZxoLkj3YQYsdy7ex04tt3vamXv /vZI0bBCZ6jeimjjnft59cupRLcrvXAeWF2Zm8Q3sOCuF5YSZPRBd/UIqQ11lk6XGqAUtFWklB7 iNRZjBySw/DHhlUXzn/UkOHdCh7zP+L1JGKW38k37l5yL0/MTPNpU8Bp6BwKDyDeRnaDzXe6eEu yaE3vN80AutUCCycOiA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270121 Content-Type: text/plain; charset="utf-8" Most architectures define their CFA as the value of the stack pointer (SP) at the call site in the previous frame, as suggested by the DWARF standard. Therefore the SP at call site can be unwound using an implicitly assumed value offset from CFA rule with an offset of zero: .cfi_val_offset , 0 As a result the SP at call site computes as follows: SP =3D CFA Enable unwinding of user space for architectures, such as s390, which define their CFA as the value of the SP at the call site in the previous frame with an offset. Do so by enabling architectures to override the default SP value offset from CFA of zero with an architecture-specific one: .cfi_val_offset , offset So that the SP at call site computes as follows: SP =3D CFA + offset Signed-off-by: Jens Remus --- arch/x86/include/asm/unwind_user.h | 2 ++ arch/x86/include/asm/unwind_user_sframe.h | 2 ++ include/asm-generic/Kbuild | 1 + include/asm-generic/unwind_user_sframe.h | 12 ++++++++++++ include/linux/unwind_user_types.h | 1 + kernel/unwind/sframe.c | 1 + kernel/unwind/user.c | 11 ++++++----- 7 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 include/asm-generic/unwind_user_sframe.h diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwi= nd_user.h index ae46906c3b39..0650bcfae461 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -66,6 +66,7 @@ static inline int unwind_user_get_reg(unsigned long *val,= unsigned int regnum) .rule =3D UNWIND_USER_RULE_CFA_OFFSET_DEREF,\ .offset =3D -2*(ws), \ }, \ + .sp_off =3D 0, \ .outermost =3D false, =20 #define ARCH_INIT_USER_FP_ENTRY_FRAME(ws) \ @@ -80,6 +81,7 @@ static inline int unwind_user_get_reg(unsigned long *val,= unsigned int regnum) .fp =3D { \ .rule =3D UNWIND_USER_RULE_RETAIN,\ }, \ + .sp_off =3D 0, \ .outermost =3D false, =20 static inline bool unwind_user_at_function_start(struct pt_regs *regs) diff --git a/arch/x86/include/asm/unwind_user_sframe.h b/arch/x86/include/a= sm/unwind_user_sframe.h index d828ae1a4aac..40b03b482d1a 100644 --- a/arch/x86/include/asm/unwind_user_sframe.h +++ b/arch/x86/include/asm/unwind_user_sframe.h @@ -9,4 +9,6 @@ =20 #endif =20 +#include + #endif /* _ASM_X86_UNWIND_USER_SFRAME_H */ diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild index 9aff61e7b8f2..91f86dd84677 100644 --- a/include/asm-generic/Kbuild +++ b/include/asm-generic/Kbuild @@ -61,6 +61,7 @@ mandatory-y +=3D topology.h mandatory-y +=3D trace_clock.h mandatory-y +=3D uaccess.h mandatory-y +=3D unwind_user.h +mandatory-y +=3D unwind_user_sframe.h mandatory-y +=3D vermagic.h mandatory-y +=3D vga.h mandatory-y +=3D video.h diff --git a/include/asm-generic/unwind_user_sframe.h b/include/asm-generic= /unwind_user_sframe.h new file mode 100644 index 000000000000..8c9ac47bc8bd --- /dev/null +++ b/include/asm-generic/unwind_user_sframe.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_GENERIC_UNWIND_USER_SFRAME_H +#define _ASM_GENERIC_UNWIND_USER_SFRAME_H + +#include + +#ifndef SFRAME_SP_OFFSET +/* Most archs/ABIs define CFA as SP at call site, so that SP =3D CFA + 0. = */ +#define SFRAME_SP_OFFSET 0 +#endif + +#endif /* _ASM_GENERIC_UNWIND_USER_SFRAME_H */ diff --git a/include/linux/unwind_user_types.h b/include/linux/unwind_user_= types.h index 059e5c76f2f3..89c71a4553b2 100644 --- a/include/linux/unwind_user_types.h +++ b/include/linux/unwind_user_types.h @@ -65,6 +65,7 @@ struct unwind_user_frame { struct unwind_user_cfa_rule_data cfa; struct unwind_user_rule_data ra; struct unwind_user_rule_data fp; + s32 sp_off; bool outermost; }; =20 diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c index f24997e84e05..6a6221ce6d12 100644 --- a/kernel/unwind/sframe.c +++ b/kernel/unwind/sframe.c @@ -496,6 +496,7 @@ static __always_inline int __find_fre(struct sframe_sec= tion *sec, return -EINVAL; sframe_init_rule_data(&frame->ra, fre->ra_ctl, fre->ra_off); sframe_init_rule_data(&frame->fp, fre->fp_ctl, fre->fp_off); + frame->sp_off =3D SFRAME_SP_OFFSET; frame->outermost =3D SFRAME_V3_FRE_RA_UNDEFINED_P(fre->info); =20 return 0; diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index eb7d9489f671..e21d088f7543 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -30,7 +30,7 @@ get_user_word(unsigned long *word, unsigned long base, in= t off, unsigned int ws) static int unwind_user_next_common(struct unwind_user_state *state, const struct unwind_user_frame *frame) { - unsigned long cfa, fp, ra; + unsigned long cfa, sp, fp, ra; =20 /* Stop unwinding when reaching an outermost frame. */ if (frame->outermost) { @@ -62,16 +62,17 @@ static int unwind_user_next_common(struct unwind_user_s= tate *state, get_user_word(&cfa, cfa, 0, state->ws)) return -EINVAL; =20 + /* Get the Stack Pointer (SP) */ + sp =3D cfa + frame->sp_off; /* * Make sure that stack is not going in wrong direction. Allow SP * to be unchanged for the topmost frame, by subtracting topmost, * which is either 0 or 1. */ - if (cfa <=3D state->sp - state->topmost) + if (sp <=3D state->sp - state->topmost) return -EINVAL; - /* Make sure that the address is word aligned */ - if (cfa & (state->ws - 1)) + if (sp & (state->ws - 1)) return -EINVAL; =20 /* Get the Return Address (RA) */ @@ -122,7 +123,7 @@ static int unwind_user_next_common(struct unwind_user_s= tate *state, return -EINVAL; =20 state->ip =3D ra; - state->sp =3D cfa; + state->sp =3D sp; state->fp =3D fp; state->topmost =3D false; return 0; --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 ADDAA35FF4B; Tue, 27 Jan 2026 15:20:01 +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=1769527203; cv=none; b=VPX8iA3m5XPdwN2guhU3rVd3yptjTg//3w+HkhkpEoT+pwKePPXtkQkHSKT4m4NlWr8NSKQZngmgPxCaaHt8+o4/huZB2VtTS+uxQqXPMMp3NBQpfFrqq+lf1+7Vb9QqWNpimVSKE6LxGIKj/OiqQNyqd7I/Xa5lDl6iuApkbxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527203; c=relaxed/simple; bh=ssH4QO23h+UP0S6GwfDDv6/M4ysuLYiQn+dNM/0nlEs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MP94VugVXQHnn9VxmTvtyDeoEkhaIKRX00twV2pLg7+KGIK4rAVeaYxK6wVFAsIcLVmqT0LD0SK3GNN+tLnH1qaOUS25dgTVJro/EsqMS2NffrmcGATvIRxYwYa8RzpL3rbcGVzRVQqHwmuB7SPVBSRf9VWpZCWInEjSLH6lNm0= 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=cmbfAhlz; 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="cmbfAhlz" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R5mfuP027227; Tue, 27 Jan 2026 15:19:40 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=UxlPh/BRlvAOcC0/c WMxCf7Av6zcp28QATZWh5Nh3SQ=; b=cmbfAhlz1uswpATUc0m6/Mh10h6lucG92 Gi7sO1grxAU4T2pjpLl8MCDMaQZnbtOUjplDm3OvO1wZ2tLfwj2BDuV3q1Bme6LP Gakzxe6ELzqK8LXp6yETbl72NIVJDXxEwBjZB5At4XuzYe3DteLlCluKrebw6Y56 eIn2AqUjlIBOrfaWl5E2Kieuk6su5PNTOJsF7Kl8Y5tWsOvTcvvLrjO+Py6aJ8Du 0yuPCK9yoQxOa+rub5xnQGDFtENBq2bUhfQ17oFBaqlH99YsV4Mcgt4OYFeBD99c bcN6Pg1Zovebdno7okhdinXt2eArC5x4EhqiYjPMvDPDtQOtZxnQQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvnrte1vt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +0000 (GMT) Received: from m0353729.ppops.net (m0353729.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60REscNb019500; Tue, 27 Jan 2026 15:19:39 GMT 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 4bvnrte1vf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +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 60RDR0eY026357; Tue, 27 Jan 2026 15:19:37 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw9wk930v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJX9V24904256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:33 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55BBA20040; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1134C2004B; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 06/12] unwind_user/sframe: Enable archs with encoded SFrame CFA offsets Date: Tue, 27 Jan 2026 16:19:19 +0100 Message-ID: <20260127151926.2805123-7-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-GUID: GJU1NxnSV8_CkvJAce5SPPsF0ls5J7q8 X-Authority-Analysis: v=2.4 cv=Uptu9uwB c=1 sm=1 tr=0 ts=6978d78b cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=F2OLnndEFUwyb2Hjky0A:9 X-Proofpoint-ORIG-GUID: szHCqXrRk7xpKVwgi1SdQYceHPmsBHLo X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyMSBTYWx0ZWRfX7DJExOXoYzwt 7bAAezZpIYG375vGLCZoHpTOLkOCivXD3I3CwJ1PrVakrSozMBuFfqo5X3cfvVO6e86Ocqt76bR 2TE7l6jd2pI1hP6Hd7ZfXUO+TgpL/m3gewtC7Ki5cbXh/zGot0kGQTb/jynVGQcdC1ESZCBVuIT a9AYs3Vntv48qUq+JZC827TS59DbK1/LfY/JQ3e+DkOp9xcFf2hK+djIOtfZt66uhcZLrERqi29 B9jBxX0cBllN/UIv+yrE+T1maRUTTthdmA8e9XkTDWaw293ejfSvugrN+lZwemLKfqWBflOcY0S drPMQI7Pzn4HTs3eCqRdnDKY7/2221j7bGdINSj/Lon3UFbfQqa3CwL+1ApsMt9JV9GqakhdriD lZkCtWcUbNg9khA4Q6PpGHLymDNp+VnrejLcNNIu3VGtMF9zxpqqcHGL1lO19na2H5PtxdNtJtJ +QClNmWRte3j5ZTTMJg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 phishscore=0 adultscore=0 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270121 Content-Type: text/plain; charset="utf-8" Enable architectures, such as s390, which store SFrame CFA offset values encoded, to e.g. make (better) use of unsigned 8-bit SFrame offsets. Signed-off-by: Jens Remus --- Notes (jremus): Changes in RFC v2: - Rename generic_sframe_cfa_offset_decode() to sframe_cfa_offset_decode(). (Josh) include/asm-generic/unwind_user_sframe.h | 8 ++++++++ kernel/unwind/sframe.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/include/asm-generic/unwind_user_sframe.h b/include/asm-generic= /unwind_user_sframe.h index 8c9ac47bc8bd..117b05e1dcab 100644 --- a/include/asm-generic/unwind_user_sframe.h +++ b/include/asm-generic/unwind_user_sframe.h @@ -9,4 +9,12 @@ #define SFRAME_SP_OFFSET 0 #endif =20 +#ifndef sframe_cfa_offset_decode +static inline s32 sframe_cfa_offset_decode(s32 offset) +{ + return offset; +} +#define sframe_cfa_offset_decode sframe_cfa_offset_decode +#endif + #endif /* _ASM_GENERIC_UNWIND_USER_SFRAME_H */ diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c index 6a6221ce6d12..5ac502f16bad 100644 --- a/kernel/unwind/sframe.c +++ b/kernel/unwind/sframe.c @@ -209,6 +209,7 @@ __read_regular_fre_datawords(struct sframe_section *sec, =20 UNSAFE_GET_USER_INC(cfa_off, cur, dataword_size, Efault); dataword_count--; + cfa_off =3D sframe_cfa_offset_decode(cfa_off); =20 ra_off =3D sec->ra_off; if (!ra_off && dataword_count) { @@ -258,6 +259,7 @@ __read_flex_fde_fre_datawords(struct sframe_section *se= c, UNSAFE_GET_USER_INC(cfa_ctl, cur, dataword_size, Efault); UNSAFE_GET_USER_INC(cfa_off, cur, dataword_size, Efault); dataword_count -=3D 2; + cfa_off =3D sframe_cfa_offset_decode(cfa_off); =20 ra_off =3D sec->ra_off; ra_ctl =3D ra_off ? 2 : 0; /* regnum=3D0, deref_p=3D(ra_off !=3D 0), reg_= p=3D0 */ --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 A211A35F8A3; Tue, 27 Jan 2026 15:20:00 +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=1769527202; cv=none; b=KyYOwtyFcOoqb4pEoVV8+UsfJpgnvcL6wU9g9acvSlLw8FYNxUbWYo++LJzW1OxlZgTYFleFuCW0qxM84FXSu/asA05KHQeZNV5XZz9i0fyptWE2p8AszuhVl+m90OmyN8rDmWDVsAV+JbU4l6ReK+163D7bueTkfYElwJOmvjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527202; c=relaxed/simple; bh=gmcluVRdPAJ1NG6VlNqtxyM27ANShcw9L2i/GfJzdo8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QuQJLT2FVEn1GEaE6Vc4MW8UrUcN2GEV+OPQeS/bwfZS0Z+9jwwp+Qs8C7GqDmDjpF+4+NxKoL386E90nDnNCgKKOf8lwoKzwDzGWrazgv/0DJz0nQGfzX3OiU0lnu+kiUgpJOkgp08LwOOv+ebk4ZCu4SA2BXZAuKYWlKMasik= 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=KS88Db5G; 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="KS88Db5G" 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 60R6uQiH031862; Tue, 27 Jan 2026 15:19:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=280g+6 Hai+7g9ZIuQWaVCWEmjVCE/Ja3nHYE00m10iE=; b=KS88Db5GN/bmvu8o14OnT3 zr62i4esg8xr5Qr5F+3lCJwhJwIPHBcac/QFf+Ssp75tXh3nKnLJ2vvYm3jpULjR t43pC2t8XlBWVO4nm6jrNUbXKJkyh2VhEzNTqMvT+r9vKEPk9ZjCcNX18cGthAHw YSUtmhNLxAGvnZRXuRRnz6zp7L9zRUpgvdP8/A7HSKNcByAAxSsELlp1DDFj9AnP o4VSFddj/YiLH6j6XKSRVW6/lSOqtvEITX+fpTX1HMSFzhEVk0qXv4pqQVtfi4pq xN5UPzspj1yK/Mfgn4Nj5VreopTonPD8zeCvAjQOj2LGp6F3R5EmVdwbs/e1RCWA == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvkgmmkpc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFJc6o000308; Tue, 27 Jan 2026 15:19:38 GMT 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 4bvkgmmkp8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +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 60RCxjAj019653; Tue, 27 Jan 2026 15:19:37 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw9dn1541-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJXgo24904260 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:33 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A13252004B; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AB4A2004D; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 07/12] s390/ptrace: Convert function macros to inline functions Date: Tue, 27 Jan 2026 16:19:20 +0100 Message-ID: <20260127151926.2805123-8-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=Gr1PO01C c=1 sm=1 tr=0 ts=6978d78b cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=buFWL2FryyfO44b410EA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: gOItHQAEK5JdQYqBc_Pcq3_YFFraa12s X-Proofpoint-ORIG-GUID: IaA5Ab-IWkgSsCsR44k1qWZ9LHka8NSn X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfX6f9V5uayh0cJ K14q/8u7jPMmPmsJLD4HLLJzXHF+kcVFQjy45fq1CCVM+f4H0UHqlM+jFeb4U4Pyx7S7jVjqbwn xx+js9ezjDsYPj2qLXUt6FWusaMG0PMBbA19AqRZ5+0vYthRmTCDPlMqTODxfnhlL3JExjjnilK 9H4H3Hf3bPzbYa2dBBb2W3rbQc+M8moSMS3W//Bde2Kb31KVRe1RB+eo9NQUHn61awXPnrhZKVQ XkxtN2/wVcQlkbMhP3t1XMhGcz6yOgaAByoUVxj3237FBaONYwXC4U1BuZu99jvcPoLTEV+zuKf /8JlKJZrOmSMseT1sbTmCv4VumN93EvDra9IR9U42FEu6HkV/Q84bkjbZvw217EtxT/aqxTW2sd CsUKgbG0ewSNIrg1+XIC7ARw41YJ9n8PbOSet3LA5m0FVDNhC9bw4v+m8/y57UZaP/oCCTHHfci k9hS16xzHWHUbV0ZrKw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 suspectscore=0 impostorscore=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Convert the function macros user_mode(), instruction_pointer(), and user_stack_pointer() to inline functions, to align their definition with x86 and arm64. Use const qualifier on struct pt_regs pointer parameters to prevent compiler warnings: arch/s390/kernel/stacktrace.c: In function =E2=80=98arch_stack_walk_user_co= mmon=E2=80=99: arch/s390/kernel/stacktrace.c:114:34: warning: passing argument 1 of =E2=80=98instruction_pointer=E2=80=99 discards =E2=80=98const=E2=80=99 qual= ifier from pointer target type [-Wdiscarded-qualifiers] ... arch/s390/kernel/stacktrace.c:117:48: warning: passing argument 1 of =E2=80=98user_stack_pointer=E2=80=99 discards =E2=80=98const=E2=80=99 quali= fier from pointer target type [-Wdiscarded-qualifiers] ... While at it add const qualifier to all struct pt_regs pointer parameters that are accessed read-only and use __always_inline instead of inline to harmonize the helper functions. [hca@linux.ibm.com: Use psw_bits() helper] Reviewed-by: Heiko Carstens Signed-off-by: Jens Remus Signed-off-by: Heiko Carstens --- Notes (jremus): Changes in v4: - New patch. Split out "while at it" changes from patch "s390/ptrace: Provide frame_pointer()" to go upstream separately. (Heiko) arch/s390/include/asm/ptrace.h | 37 ++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h index 962cf042c66d..e6ec0ccf3d73 100644 --- a/arch/s390/include/asm/ptrace.h +++ b/arch/s390/include/asm/ptrace.h @@ -214,16 +214,23 @@ void update_cr_regs(struct task_struct *task); #define arch_has_single_step() (1) #define arch_has_block_step() (1) =20 -#define user_mode(regs) (((regs)->psw.mask & PSW_MASK_PSTATE) !=3D 0) -#define instruction_pointer(regs) ((regs)->psw.addr) -#define user_stack_pointer(regs)((regs)->gprs[15]) #define profile_pc(regs) instruction_pointer(regs) =20 -static inline long regs_return_value(struct pt_regs *regs) +static __always_inline bool user_mode(const struct pt_regs *regs) +{ + return psw_bits(regs->psw).pstate; +} + +static inline long regs_return_value(const struct pt_regs *regs) { return regs->gprs[2]; } =20 +static __always_inline unsigned long instruction_pointer(const struct pt_r= egs *regs) +{ + return regs->psw.addr; +} + static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { @@ -233,19 +240,26 @@ static inline void instruction_pointer_set(struct pt_= regs *regs, int regs_query_register_offset(const char *name); const char *regs_query_register_name(unsigned int offset); =20 -static __always_inline unsigned long kernel_stack_pointer(struct pt_regs *= regs) +static __always_inline unsigned long kernel_stack_pointer(const struct pt_= regs *regs) +{ + return regs->gprs[15]; +} + +static __always_inline unsigned long user_stack_pointer(const struct pt_re= gs *regs) { return regs->gprs[15]; } =20 -static __always_inline unsigned long regs_get_register(struct pt_regs *reg= s, unsigned int offset) +static __always_inline unsigned long regs_get_register(const struct pt_reg= s *regs, + unsigned int offset) { if (offset >=3D NUM_GPRS) return 0; return regs->gprs[offset]; } =20 -static __always_inline int regs_within_kernel_stack(struct pt_regs *regs, = unsigned long addr) +static __always_inline int regs_within_kernel_stack(const struct pt_regs *= regs, + unsigned long addr) { unsigned long ksp =3D kernel_stack_pointer(regs); =20 @@ -261,7 +275,8 @@ static __always_inline int regs_within_kernel_stack(str= uct pt_regs *regs, unsign * is specifined by @regs. If the @n th entry is NOT in the kernel stack, * this returns 0. */ -static __always_inline unsigned long regs_get_kernel_stack_nth(struct pt_r= egs *regs, unsigned int n) +static __always_inline unsigned long regs_get_kernel_stack_nth(const struc= t pt_regs *regs, + unsigned int n) { unsigned long addr; =20 @@ -278,8 +293,8 @@ static __always_inline unsigned long regs_get_kernel_st= ack_nth(struct pt_regs *r * * regs_get_kernel_argument() returns @n th argument of the function call. */ -static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs, - unsigned int n) +static __always_inline unsigned long regs_get_kernel_argument(const struct= pt_regs *regs, + unsigned int n) { unsigned int argoffset =3D STACK_FRAME_OVERHEAD / sizeof(long); =20 @@ -290,7 +305,7 @@ static inline unsigned long regs_get_kernel_argument(st= ruct pt_regs *regs, return regs_get_kernel_stack_nth(regs, argoffset + n); } =20 -static inline void regs_set_return_value(struct pt_regs *regs, unsigned lo= ng rc) +static __always_inline void regs_set_return_value(struct pt_regs *regs, un= signed long rc) { regs->gprs[2] =3D rc; } --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 D685D361665; Tue, 27 Jan 2026 15:20:03 +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=1769527207; cv=none; b=CAL3x4dTGliARF3Y26kZ4Djf4to+iuN3g0SR5dHK1VFWk+phNYQeidHD+CP6gNvIViHOjop6+JGMG5OQdFKmXbIKrHqXuoMYBRQVC8RufuKpVpFMXUFPDAXWTgxSd1eh9p0TIYlhpNZLpJr0RBPrBb6vDrk75JCXwy8yJqdfj0o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527207; c=relaxed/simple; bh=PZHIpBGCcmOjceWawsZqoargbzKlkSzOGaAf9rH/SFE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JNbdjr9+EcrYiaapFrUtoIDSOHqZa1gYNY+umcWRLraPcKGe9y2TuCAV+uK3DAVIb6x+nEGoSKK5aFW146S6eFW6tx7BwhBKDU99EHvNCFTiE1ego5ulA7LjsgmhuRByp07J29GXjNFihhY1JuynysCy2r0oapDtC1Y3weCB1ps= 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=r0vVIQZo; 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="r0vVIQZo" 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 60R8eKXl012953; Tue, 27 Jan 2026 15:19:39 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=CT5Yzhhna9QHI+XdQ 9N05jfgb2pmqt4zaAgcbfvxQUA=; b=r0vVIQZocOIFPJ5TKPc5oKqHjmfy6i1bA +Sc85M+57ycKuuoZZQzNHchKu9+Gh/iWHRyYHO3Mc/P27OBtXZpuYJu3o5B4j/Cw oCMYkHUfT5eZq3kkPI2wfvWPZ6114oQ706uNA29qY8jQCamUAKBU0byNWhSvW++9 ABzRMwZ+uH0oWshKlPjA207p46oxhnlwLZMH/VE3h/zG84rP/6GHng13TMUf9gNR rnb+Bce6YqtpUkxlJslEl2v/6j41lwZyLT77ZjH4UVMCfywDg6TP0SaGbqZwo7Ck 3i0KvSEmYc8cTjT2KlHDsK9iBtx81PKSbNvJCVGmYbJVCapAC1Lkg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvkgmmkpf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFDub6019789; Tue, 27 Jan 2026 15:19:38 GMT 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 4bvkgmmkp9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +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 60RD0BbC006711; Tue, 27 Jan 2026 15:19:38 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw8sy97xy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:37 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJYat38404442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:34 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E83D320040; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A42F22004E; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 08/12] s390/ptrace: Provide frame_pointer() Date: Tue, 27 Jan 2026 16:19:21 +0100 Message-ID: <20260127151926.2805123-9-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-Authority-Analysis: v=2.4 cv=Gr1PO01C c=1 sm=1 tr=0 ts=6978d78b cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=NEAV23lmAAAA:8 a=VnNF1IyMAAAA:8 a=qpzfwOR0HA9Q5Rrae1MA:9 X-Proofpoint-GUID: IOw5bD2h0m9jWjw8gNZmyNkz3GINDcA- X-Proofpoint-ORIG-GUID: N9u8KjS7k6vBnqvMoArQJBk1byJqa5tM X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfXynKNwWCmOQ7h sOwsj49HXJczAzUjwjeZnwuk2sVFIiryzHKdOJIVXZuKB4X68W7jKCjnu2EgKYiJMpbI50WvGRm IaIBFz4N+3+0paxms/vQh/2U5sB281jHIWkOZ6DYOVAOoyVzeQthcqmyT1/KuQxfLjm7nEB4v1Q n+uRp7a7hAUB5wsjD6+uhZzbc1xzZ8dSyrCCYGXOHKkTv7z1tW2jJMtb17tUllV3/ZfX8iyj708 SJ21nNWIE8ACvWfrB5f1tPtnk8Va1zYuwWDLNE/IYDxvLdI9MYBAEIYLDhZfdLdknyeEScgN4ni CuYFYASMy8Epl+fWH6iqMhlPlEXXIKVgRTENj4YBjLDJ6dKmoXokPdKZS3fUTz/VyJHY+HkXAiA 4st5S0IbNmje8v0rYBu/A2w9c78+lN+NbCDT8lnVoW5IHVfUzvw/PopbJrK1uRj8emq212ZrnVx c9ewJ/6dWWBQ2/BliSw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 suspectscore=0 impostorscore=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" On s390 64-bit the s390x ELF ABI [1] designates register 11 as the "preferred" frame pointer (FP) register in user space. [1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases Signed-off-by: Jens Remus --- Notes (jremus): Changes in v4: - Split out "while at it" changes into separate commit that can go upstream independently. (Heiko) =20 Changes in RFC v2: - Separate provide frame_pointer() into this new commit. arch/s390/include/asm/ptrace.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/s390/include/asm/ptrace.h b/arch/s390/include/asm/ptrace.h index e6ec0ccf3d73..8f18d00b5fdb 100644 --- a/arch/s390/include/asm/ptrace.h +++ b/arch/s390/include/asm/ptrace.h @@ -250,6 +250,12 @@ static __always_inline unsigned long user_stack_pointe= r(const struct pt_regs *re return regs->gprs[15]; } =20 +static __always_inline unsigned long frame_pointer(const struct pt_regs *r= egs) +{ + /* Return ABI-designated "preferred" frame-pointer register value. */ + return regs->gprs[11]; +} + static __always_inline unsigned long regs_get_register(const struct pt_reg= s *regs, unsigned int offset) { --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 B5F163624C6; Tue, 27 Jan 2026 15:20:05 +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=1769527208; cv=none; b=n5jl0lEK0lG5GpBJGuD2FDwhfvtO6rPkdyBp12IQTWGDBvbxtKcSKskhqD8R1IG1Vf20VvbPGWXBDw8lfVMEZRWBomh7Ha0haB0D1IsC1zeW1oFTucFTfb+TDldvb7V5nRTGfU/n0Ofhm3k/bIaziu7CH5auOvwYnHXdZEOM1eM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527208; c=relaxed/simple; bh=b2bGG+y3Ob/xC2VR9bYaOdXuMWDMfK21pfp6Rp+pedo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Rfa6mGnYAo8fJQYmsljszyXGOsRidFwEGiuO29ZXdoMhRhrL8waaPz89wILkf162ZDZfu0cTX/3vO4euIx9n7ydstrnVMVYNc29JBNNXGO7xmm3xXa/pb3jUsgQTfV5c5Yy2gd78jn1wGNDJk0EL0y2A29nyba7vFE2vcvJehsk= 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=NiIS5Y++; 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="NiIS5Y++" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R2WCfp017248; Tue, 27 Jan 2026 15:19:40 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=zuSMMM/EeZwSE8HD+ lBguGbIw/zs0dqj2jDSiLuDvR4=; b=NiIS5Y++csbmXOX4FQ/doKDz62XYqQ63G 7Sl9TD9/qJ6qnZ2hpUZ+p/mGzfF1cLfLXRv5h+Zm8pDEff5ljDCNhFH9KXuT8uoe 9tks+QJrIbtHNayOmAmHVMS/dgDMB6dy/W1T5nprfN2kCYgh1aeCWvpxdskM5uHh m5o3Ju/uR9ZHOcVGTpcFnEMfqPPm9DQJmOb+WM6udONN00zDY6N0UsvBWApOEEoe ZwDus+lcr1oTthtHWXlkXtyhSwQQCXam1d6fljJ/r3Du5/8I/4T8vmGE3ZdMW3r7 +BTTwWDj7Z6k0T48TfAwI66SYSvLd8vK4bK4C7e/d/PUcauQvGmnA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvmgfvfg1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:40 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFJ807020641; Tue, 27 Jan 2026 15:19:39 GMT 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 4bvmgfvffw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +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 60RE0G5Y026319; Tue, 27 Jan 2026 15:19:38 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw9wk930w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJY6I38404444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:34 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4659C20040; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EDEA120043; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:33 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 09/12] s390/unwind_user/sframe: Enable sframe unwinding on s390 Date: Tue, 27 Jan 2026 16:19:22 +0100 Message-ID: <20260127151926.2805123-10-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-Authority-Analysis: v=2.4 cv=Z4vh3XRA c=1 sm=1 tr=0 ts=6978d78c cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=NEAV23lmAAAA:8 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=Qa0OrbKoCXZI6_Y7VosA:9 X-Proofpoint-GUID: 41ZkWyJy5DOTfrmp9yY_s4B5B_xKQOQ1 X-Proofpoint-ORIG-GUID: APBUffS2QqOJ6PbV8kDq_c2HRtCw-WG9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfX+52L1jFVfm9w hvtBq1fPeEY10p0X6BFOxWr4/k0DK8dsZTRg1YdkgOFMHvfO7y+ZiRecv1k0uZbWG0QDoh5dc/8 Zd0DxPaklcM7hLLwcixzBzpSPnZt0IvVD+zrfFcOniVzA66JIFn6/bRqsqTs/ximm/R7wpxdLgE 4W41/0kBHhUIYgW8giTk1Fvw/pWNrN0Pjpj/W05kktZ2zFvluW1aZR2V0XZe6uIdyuGtYQie3Bv FNA7p78t1bTFMTduAt2tAVql5j7qyYz8rU5VEScByyMcPMF9KgOCmpI4GMI8N/Jl7ZLlyItS8vW U1h1NtquHSehq2I40Zfpb5Ii/2Ke2LGbWxT0dmH1Droct85WK1qB5b4GWnobMwicXhvbzBb5L0B l1Q5pUC/nRcPUrFphlq53ZAAoFP26fyFcbmbkl+cWAx/PlucEyEMbveXewc6eXX499UPLLuepC4 2gI0NaxeruQvnyyNsgA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" Add s390 support for unwinding of user space using SFrame. This leverages the previous commits to address the following s390 particularities: - The CFA is defined as the value of the stack pointer (SP) at call site in the previous frame plus 160. Therefore the SP unwinds as SP =3D CFA - 160. Therefore use a SP value offset from CFA of -160. - The return address (RA) is not saved on the stack at function entry. It is also not saved in the function prologue, when in leaf functions. Therefore the RA does not necessarily need to be unwound in the topmost frame. - The frame pointer (FP) and/or return address (RA) may be saved in other registers when in leaf functions. GCC effectively uses floating-point registers (FPR) for this purpose. In SFrame V3 this is represented using flexible FDEs, where the CFA, FP, and RA recovery rules may specify a DWARF register number. - To make use of the signed 8-bit SFrame data word size and effectively reduce the .sframe section size the SFrame CFA offset values are encoded as (CFA - 160) / 8. This is because the lowest CFA offset value on s390 is by definition +160 (=3D value at function entry), which does not fit into a signed 8-bit SFrame data word / offset. Therefore the CFA offset values are stored adjusted by -160. Additionally they are scaled by the s390-specific DWARF data scaling factor of 8. The s390x ELF ABI [1] guarantees that the CFA offset values are always aligned on an 8-byte boundary. Add s390-specific SFrame format definitions. Include after "sframe.h" to make those s390-specific definitions available to architecture-specific unwind user sframe code, particularly the s390-specific one. [1]: s390x ELF ABI, https://github.com/IBM/s390x-abi/releases Signed-off-by: Jens Remus --- Notes (jremus): Changes in v4: - Fix __s390_get_dwarf_fpr() access of user FPR. (Heiko) - Use __s390_dwarf_fpr_to_fpr() helper instead of large switch/case block. (Heiko) - Use unsigned int for DWARF register numbers, as DWARF defines them as unsigned LEB128. - SFrame V3 support: - Remove now unused arch_sframe_init_reginfo(). - Remove now unused SFRAME_V2_S390X_OFFSET_IS_REGNUM() and SFRAME_V2_S390X_OFFSET_DECODE_REGNUM() macros. - Rename SFRAME_V2_*() macros to SFRAME_V3_*(). - Add architecture-specific defines SFRAME_REG_SP and SFRAME_REG_FP. =20 Changes in RFC v3: - Adjust to rename of UNWIND_USER_LOC_NONE to UNWIND_USER_LOC_RETAIN. - Adjust s390-specific unwind_user_word_size() to changes in the x86-specific (see patch 4). =20 Changes in RFC v2: - Provide unwind_user_word_size() to satisfy new unwind user need. Note that support for COMPAT has not been implemented as s390 support for COMPAT is expected to be removed with v6.19: https://lore.kernel.org/all/20251201102713.22472A5b-hca@linux.ibm.com/ - Adjust to changes in preceding patches in this series that enable support in unwind user (sframe) for s390 particularities. =20 Alternatively the s390-specific definitions could also be added to the s390-specific unwind user sframe header. The current implementation follows Binutils approach to have all SFrame format definitions in one central header file. arch/s390/Kconfig | 1 + arch/s390/include/asm/unwind_user.h | 70 ++++++++++++++++++++++ arch/s390/include/asm/unwind_user_sframe.h | 21 +++++++ kernel/unwind/sframe.c | 2 +- kernel/unwind/sframe.h | 11 ++++ 5 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 arch/s390/include/asm/unwind_user.h create mode 100644 arch/s390/include/asm/unwind_user_sframe.h diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 0e5fad5f06ca..063f0c857600 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -250,6 +250,7 @@ config S390 select HAVE_SOFTIRQ_ON_OWN_STACK select HAVE_STACKPROTECTOR if CC_HAS_STACKPROTECTOR_GLOBAL select HAVE_SYSCALL_TRACEPOINTS + select HAVE_UNWIND_USER_SFRAME select HAVE_VIRT_CPU_ACCOUNTING select HAVE_VIRT_CPU_ACCOUNTING_IDLE select HOTPLUG_SMT diff --git a/arch/s390/include/asm/unwind_user.h b/arch/s390/include/asm/un= wind_user.h new file mode 100644 index 000000000000..941aa3f0f70f --- /dev/null +++ b/arch/s390/include/asm/unwind_user.h @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_S390_UNWIND_USER_H +#define _ASM_S390_UNWIND_USER_H + +#include +#include +#include + +#ifdef CONFIG_UNWIND_USER + +static inline int unwind_user_word_size(struct pt_regs *regs) +{ + return 8; +} + +static inline int arch_unwind_user_get_ra_reg(unsigned long *val) +{ + struct pt_regs *regs =3D task_pt_regs(current); + *val =3D regs->gprs[14]; + return 0; +} +#define unwind_user_get_ra_reg arch_unwind_user_get_ra_reg + +static inline unsigned long __s390_dwarf_fpr_to_fpr(unsigned int regnum) +{ + unsigned int fpr; + + /* + * Convert from s390 DWARF floating-point register number (16..31) + * to floating-point register number (0..15): left rotate the least + * significant three bits and then return the least significant four + * bits. + */ + fpr =3D (regnum & 3) << 1; + fpr |=3D (regnum & 4) >> 2; + fpr |=3D (regnum & 8); + return fpr; +} + +static inline unsigned long __s390_get_dwarf_fpr(unsigned int regnum) +{ + struct fpu *fpu =3D ¤t->thread.ufpu; + + save_user_fpu_regs(); + return fpu->vxrs[__s390_dwarf_fpr_to_fpr(regnum)].high; +} + +static inline int arch_unwind_user_get_reg(unsigned long *val, + unsigned int regnum) +{ + if (regnum <=3D 15) { + /* DWARF register numbers 0..15 */ + struct pt_regs *regs =3D task_pt_regs(current); + *val =3D regs->gprs[regnum]; + return 0; + } else if (regnum <=3D 31) { + /* DWARF register numbers 16..31 */ + *val =3D __s390_get_dwarf_fpr(regnum); + return 0; + } + + return -EINVAL; +} +#define unwind_user_get_reg arch_unwind_user_get_reg + +#endif /* CONFIG_UNWIND_USER */ + +#include + +#endif /* _ASM_S390_UNWIND_USER_H */ diff --git a/arch/s390/include/asm/unwind_user_sframe.h b/arch/s390/include= /asm/unwind_user_sframe.h new file mode 100644 index 000000000000..91eea28c8a48 --- /dev/null +++ b/arch/s390/include/asm/unwind_user_sframe.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_S390_UNWIND_USER_SFRAME_H +#define _ASM_S390_UNWIND_USER_SFRAME_H + +#include +#include + +#define SFRAME_SP_OFFSET SFRAME_S390X_SP_VAL_OFFSET + +#define SFRAME_REG_SP 15 +#define SFRAME_REG_FP 11 /* "preferred" FP register */ + +static inline s32 arch_sframe_cfa_offset_decode(s32 offset) +{ + return SFRAME_V3_S390X_CFA_OFFSET_DECODE(offset); +} +#define sframe_cfa_offset_decode arch_sframe_cfa_offset_decode + +#include + +#endif /* _ASM_S390_UNWIND_USER_SFRAME_H */ diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c index 5ac502f16bad..21283e3bda42 100644 --- a/kernel/unwind/sframe.c +++ b/kernel/unwind/sframe.c @@ -12,11 +12,11 @@ #include #include #include -#include #include =20 #include "sframe.h" #include "sframe_debug.h" +#include =20 struct sframe_fde_internal { unsigned long func_addr; diff --git a/kernel/unwind/sframe.h b/kernel/unwind/sframe.h index 5b6112945b6c..8a5322e95403 100644 --- a/kernel/unwind/sframe.h +++ b/kernel/unwind/sframe.h @@ -19,6 +19,7 @@ #define SFRAME_ABI_AARCH64_ENDIAN_BIG 1 #define SFRAME_ABI_AARCH64_ENDIAN_LITTLE 2 #define SFRAME_ABI_AMD64_ENDIAN_LITTLE 3 +#define SFRAME_ABI_S390X_ENDIAN_BIG 4 /* s390 64-bit (s390x) */ =20 struct sframe_preamble { u16 magic; @@ -84,4 +85,14 @@ struct sframe_fda_v3 { #define SFRAME_V3_FLEX_FDE_CTLWORD_DEREF_P(data) (((data) >> 1) & 0x1) #define SFRAME_V3_FLEX_FDE_CTLWORD_REG_P(data) ((data) & 0x1) =20 +/* s390 64-bit (s390x) */ + +#define SFRAME_S390X_SP_VAL_OFFSET (-160) + +#define SFRAME_S390X_CFA_OFFSET_ADJUSTMENT SFRAME_S390X_SP_VAL_OFFSET +#define SFRAME_S390X_CFA_OFFSET_ALIGNMENT_FACTOR 8 +#define SFRAME_V3_S390X_CFA_OFFSET_DECODE(offset) \ + (((offset) * SFRAME_S390X_CFA_OFFSET_ALIGNMENT_FACTOR) \ + - SFRAME_S390X_CFA_OFFSET_ADJUSTMENT) + #endif /* _SFRAME_H */ --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 A21A435F8AA; Tue, 27 Jan 2026 15:20:00 +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=1769527202; cv=none; b=Uzv0h12FyZvXgNDXvIwdD6G4un+WLqkDl/RaSLUt34/5yXrh1Z7Job7Hnh8Hr4DbrRrR3YUKu8hlXjf0eVlBovV1BJaL8zAasnqkvFq8gMBRWGMjLmClrLtJ+md+sKua7icq6E4xT/J6wepqxRd2RMSEGV0eS0xw8paQI9rFSI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527202; c=relaxed/simple; bh=H7n+PXjV8neMsqTuIFC/9Axcasrr7i/IkPwnMszgmMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JVinttglADn3Zkyrt3Ot9JqvVsBZyspqvlnHMsfV79ns77uyIcCVgZEd8X/tJYFbYCt/ArblTkUoyLY2KNO1uiv8qzZN75jDRlSsamEIcMc/WINsl77U2fThEKatvQeLPc9pjUoizu7tTzoDluI65vbuaIQyaCfz+CulYGT6DzM= 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=I5lyJoiW; 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="I5lyJoiW" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R5RUYZ015650; Tue, 27 Jan 2026 15:19:40 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=VVguAxILxTzSbNQu5 WbhO4HZgS7zsxcqLOGbA4iC9kQ=; b=I5lyJoiWqfflGSV50GESF32joTAKgeD6y uDdL+CRQrntl6H9iRseeipo9Z9NOfjKBRN4w5fQNITJpcuV/mZkOW1re4HiDrzC4 +eQ/+UKoCKWLq/jJjOYv4Umhs5f0L/cd8ZjhyUhhyUC73+Rst0V8kHVepzIiFjzQ jmD3I1Y/gAKFZ+8+TMfQsVNTesWpOPYUslbJJOpGIXH6+dJhNO9+dM1xb2hJCK2k /gdgo++98UMcssSj+ddqO4F7DIhZ+Ptsi/7kG7n10yGeImgdzdIEueliNjNM8aP6 VkM4c/Y6bBXBVrgQ3gOi78489tbox81sioOS/29nuSw+2eSwHHHUw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvmgfvfg2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:40 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFI9iu018687; Tue, 27 Jan 2026 15:19:39 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvmgfvffv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 60REPhrk023625; Tue, 27 Jan 2026 15:19:38 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4bwamjrxxq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJY5W38404446 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:34 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F95A20040; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B5382004B; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 10/12] unwind_user: Introduce FP/RA recovery rule unknown Date: Tue, 27 Jan 2026 16:19:23 +0100 Message-ID: <20260127151926.2805123-11-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-Authority-Analysis: v=2.4 cv=Z4vh3XRA c=1 sm=1 tr=0 ts=6978d78c cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=x_8ZRXsrtd9nfFZNwNsA:9 X-Proofpoint-GUID: 2liHwGDL35txcMt1JbMxG85YwdANNyhk X-Proofpoint-ORIG-GUID: SNQ0rbTEN4EF7Ncey7g7ggyMk8JeUV3m X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfX/IpkcQvkBXRt TR7vEfeM+NzVU5yTDtU3SrLfGK90BVlTaBBPog5Ek3lUYhD5O/x4EK8QmNWx5Rk80eMu6KSm73b 5743IYUxo6KU9ZR8HXFlQl7zF3rwWjwsC1PbZH227RceMLeuWXFaE3OB5QUKilBAB6CoRU8zbaO 7LtsQ3Due9IHam/lq+7PRZYdmGp7IBpIc+984x40DdiWXS6vjI0MesMciCwVMZYxaLtSSauIjen T+6zmBzc+Q9IXGIzicYUrCNRcRuHPsYsPZVH0R+Ld+sVM/jaFezgn1gDzx99lZx5VxK0B2lbZGf WlIker8vV/heDP9TP3Azd1LGWBGR71DFHaqYZh+9Ie72cT7WEaUcmq2jk0AhXPSEo68LNdXPCfO EMIXrTvl4vSHRW1JHQwfin3ZeyuXBw/oOb9DivPuWow9M31YpOMSx2vp4JbLsGWOc4SItGY4Gzz vM7LzhjHbc7RP9ZJbug== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 phishscore=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" Add support for the unwind user FP/RA recovery rule "unknown". For the frame pointer (FP) set the FP value to zero, so that subsequent unwind next frame that rely on FP fail. For the return address (RA) treat as error. This enables to implement support for unwinding of user space using back chain on s390 with a subsequent commit, which can only unwind SP and RA, but not FP. Signed-off-by: Jens Remus --- Notes (jremus): Changes in RFC v3: - New patch. Prerequirement to implement unwind user fp using back chain on s390. include/linux/unwind_user_types.h | 1 + kernel/unwind/user.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/include/linux/unwind_user_types.h b/include/linux/unwind_user_= types.h index 89c71a4553b2..fac8f470b597 100644 --- a/include/linux/unwind_user_types.h +++ b/include/linux/unwind_user_types.h @@ -45,6 +45,7 @@ struct unwind_user_cfa_rule_data { }; =20 enum unwind_user_rule { + UNWIND_USER_RULE_ZERO, /* entity =3D 0 */ UNWIND_USER_RULE_RETAIN, /* entity =3D entity */ UNWIND_USER_RULE_CFA_OFFSET, /* entity =3D CFA + offset */ UNWIND_USER_RULE_REG_OFFSET, /* entity =3D register + offset */ diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index e21d088f7543..036328cb9ee8 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -114,6 +114,10 @@ static int unwind_user_next_common(struct unwind_user_= state *state, return -EINVAL; fp +=3D frame->fp.offset; break; + case UNWIND_USER_RULE_ZERO: + /* FP cannot be unwound. Not an error. Set to zero. */ + fp =3D 0; + break; default: WARN_ON_ONCE(1); return -EINVAL; --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 4FEA735CB9F; Tue, 27 Jan 2026 15:20:00 +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=1769527202; cv=none; b=MyLa1l/dTkeD7BNteriLMTqzE2MtTM87znYLW6PKGylAJXULkW4irdAnoqgG8DD48fjppGLqzmZwuPkI+TerXaRRk/po6HnYGiCWa7MQWOQDg/bwj80jI7HW7pgMrYTAWUZnj2GY1ZYHkIOrtE5Ynx4rC3f/DosHi96HGTMhAOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527202; c=relaxed/simple; bh=/GDZHvKL20WkVc+xQURi+GL8V7aNFAeFcy2+sWH8F2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aVCvRc8qGc+3ldkNfSz4cddYLtozgnJYnJlvCgH0KqSri6hpsj7LsX7wSV0KpNoEAJLbSmsVW1vg9Ec/k05UlWmmUpIpLEXZiL77Atr71o/veejFm8hoG/eYEc5I8FS7SQHKEAdnJXNEiFgOcGs1UQlY785NK16fp/DR5C59A7M= 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=Z9KHoC2d; 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="Z9KHoC2d" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 60R7WMTd008927; Tue, 27 Jan 2026 15:19:40 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=LHC+JvN+TpuEh9Kkw evIeUH2B3MQb7aBBWgCtLuQE6c=; b=Z9KHoC2dTDahr98rSJevpGPuc5EfzuICu MpavmjziX/f+4M2/wlFRRGOXTtv9K76sPR5Is9uy4JNtVpFpDNCg+v93ZWtST1gb xWji6JZsXUd9mtjdQTmovFo6CWRm09pGeJ40B6CX6BJNcFMbtymZfqQoUP/03jQD 28F6t7KtMXFheYaAf5dRc83mQTSQIbW8t5zm10UBB1LPQK0+9IRLh2AWH6LrG1Td HD19xr18KsINAbrBMqWI5gYbTrS+/0fpJzBIwn6EkqzVQDz2aEyR1e/ddsaweRog QbGV2EnOot9E6P3DQYbru3r3XJwrWbYOsRQM0VW2cJso6XQxcn5jA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvnr648ww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:40 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RFJdjZ030640; Tue, 27 Jan 2026 15:19:39 GMT 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 4bvnr648ws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +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 60RDaidJ026334; Tue, 27 Jan 2026 15:19:38 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw9wk930y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:38 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJZb233423682 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:35 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D858620040; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 948D420043; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 11/12] unwind_user/fp: Use arch-specific helper to initialize FP frame Date: Tue, 27 Jan 2026 16:19:24 +0100 Message-ID: <20260127151926.2805123-12-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfX7hBeit9GXDVo mxdAE/qwW8N/bbTp6ed+YllfTLEcy43dddeY6htWgcSLrEHaAxAgSW94oVO9jHXHbzVFJ5nrvu4 jpCmUXYlcqg/oeZKuK9Xv3VByUIp1VFjDnQwvXIxa6q/PRIIFpYzx6dbcP66C9ESXnWeYS2F1qN u0rzzKor5BwLeJqWsTIHygrBH5PJ1mqsSuj2vMtUcpziFZkrIJhgzUDDmBw3Vp5DsxNq2hn1XxS P83+M9+c7xuYVoo5iycVye7dTNG+DZSzXcpx3UHfx1eXRCJfTKj4i5EhrPzMmNqnYhHVNxfOdDc coNpoKU35vascLriTYN83/9iySqfw3UJT/DaEqz0MBaRTsVOFzz4mpLrehw4Qo90UXENjAHSs4D oO9GfryFJq4kwKxAsZi8OlMPEsxz56s6bplWY+eCXWaUNNotxz3q3p6bq1ld8qLnj91vedoldgI 1Oj8b3FClj46L/RKSJw== X-Proofpoint-GUID: 29P8UNrgDPJ85o-mcNqcsHDh82lbKJJh X-Proofpoint-ORIG-GUID: ZrvKTO_7gMK6ZC4ehVSazwqHNKCzgvyX X-Authority-Analysis: v=2.4 cv=X+Vf6WTe c=1 sm=1 tr=0 ts=6978d78c cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=Rlq6_WvGfIKZnD4uTv0A:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 adultscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" This enables more sophisticated initialization of the FP frame, for instance to implement support for unwinding of user space using back chain on s390 with a subsequent commit. Signed-off-by: Jens Remus --- Notes (jremus): Changes in v4: - Remove superfluous unwind_user_fp_get_frame defines. =20 Changes in RFC v3: - New patch. Prerequirement to implement unwind user fp using back chain on s390. arch/x86/include/asm/unwind_user.h | 19 ++++++++++++++++--- include/linux/unwind_user.h | 19 ++++++------------- kernel/unwind/user.c | 16 ++++------------ 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/arch/x86/include/asm/unwind_user.h b/arch/x86/include/asm/unwi= nd_user.h index 0650bcfae461..f5e9fbcdae28 100644 --- a/arch/x86/include/asm/unwind_user.h +++ b/arch/x86/include/asm/unwind_user.h @@ -84,11 +84,24 @@ static inline int unwind_user_get_reg(unsigned long *va= l, unsigned int regnum) .sp_off =3D 0, \ .outermost =3D false, =20 -static inline bool unwind_user_at_function_start(struct pt_regs *regs) +static inline int unwind_user_fp_get_frame(struct unwind_user_state *state, + struct unwind_user_frame *frame) { - return is_uprobe_at_func_entry(regs); + struct pt_regs *regs =3D task_pt_regs(current); + + if (state->topmost && is_uprobe_at_func_entry(regs)) { + const struct unwind_user_frame fp_entry_frame =3D { + ARCH_INIT_USER_FP_ENTRY_FRAME(state->ws) + }; + *frame =3D fp_entry_frame; + } else { + const struct unwind_user_frame fp_frame =3D { + ARCH_INIT_USER_FP_FRAME(state->ws) + }; + *frame =3D fp_frame; + } + return 0; } -#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 92cdf38c8ade..f65b0573b3a5 100644 --- a/include/linux/unwind_user.h +++ b/include/linux/unwind_user.h @@ -7,21 +7,14 @@ =20 #ifndef CONFIG_HAVE_UNWIND_USER_FP =20 -#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) +static inline int unwind_user_fp_get_frame(struct unwind_user_state *state, + struct unwind_user_frame *frame) { - return false; + WARN_ON_ONCE(1); + return -EINVAL; } -#define unwind_user_at_function_start unwind_user_at_function_start -#endif + +#endif /* CONFIG_HAVE_UNWIND_USER_FP */ =20 #ifndef unwind_user_get_ra_reg static inline int unwind_user_get_ra_reg(unsigned long *val) diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 036328cb9ee8..a64ceb4a2bf6 100644 --- a/kernel/unwind/user.c +++ b/kernel/unwind/user.c @@ -135,19 +135,11 @@ static int unwind_user_next_common(struct unwind_user= _state *state, =20 static int unwind_user_next_fp(struct unwind_user_state *state) { - struct pt_regs *regs =3D task_pt_regs(current); - - if (state->topmost && unwind_user_at_function_start(regs)) { - const struct unwind_user_frame fp_entry_frame =3D { - ARCH_INIT_USER_FP_ENTRY_FRAME(state->ws) - }; - return unwind_user_next_common(state, &fp_entry_frame); - } + struct unwind_user_frame frame; =20 - const struct unwind_user_frame fp_frame =3D { - ARCH_INIT_USER_FP_FRAME(state->ws) - }; - return unwind_user_next_common(state, &fp_frame); + if (unwind_user_fp_get_frame(state, &frame)) + return -ENOENT; + return unwind_user_next_common(state, &frame); } =20 static int unwind_user_next_sframe(struct unwind_user_state *state) --=20 2.51.0 From nobody Sat Feb 7 05:44:17 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 A041D35FF47; Tue, 27 Jan 2026 15:20:01 +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=1769527203; cv=none; b=NNn2INkb0tvS0Ihp1f0oCY9vaF3wnkFD5Z36KzXvPU7POW4BgxI0Es6vWdcg5l7BTAik06G8MNnTxsJFjy/AFuAMBzy12iKmt8XBuknQwygd9i2NOpZUOvyzRTJ0QaWeweQoGHcQeiMcsAR9Yh/xvFiowFcX3Lb2xylgs0U1ywU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769527203; c=relaxed/simple; bh=tE+HbJKnHo0bokVJmiQhkZqCUoyrJolgL0VrBkszPm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FThg6H3HHXX4gKiNA/cVhisO4FjjETreYw+KSbr6FaNAzggAR/tveuyZY0tNXo1JscqiAMvU8Htv0mD1sX0PfLkB1/TMUZ6oMKRxDQfsyDoWWyR5VxFA7w2cCdGOiNRqlwkwMeQebgFIFfKCQnm3WJfdxPRY04P2ul2Di8OCN/Y= 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=QdOx7Neh; 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="QdOx7Neh" 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 60REnrac000461; Tue, 27 Jan 2026 15:19:41 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=l733ryMv8oM5HTOcb kvDb9WV+38YiH1DO3xwmb+1T3s=; b=QdOx7Nehq6bQUjuRlKaQUjwhmGuo08+Px PgzIwLDkHBcgf5QN2nvVSnTr3ZplYcqkkwIj1BUfLux9KpS7lGlawgXGPA2pimtn Ob+3nH6n2/ElRxuMK0oYAU3tOpGEduVYMLQoAIZRrfCwrHjZOe/VyiqxtJeRfjbr 7k9FwTWRse6iulNW4mPK86lpn+cmS+Q5Oxbd6il2od1CvIr5W8iOE5+AbyCP3DSm 0OBLhoao9eUC5BODxWN1Gm/V7jzBGXWCTpxI4XDLh2+HcUvgwiWpK3ZDdQX6+bOu FHjxTSkTATyl5CJemhqbB0C1Ai73w4ea3nCyovdpzNYGghUCHeoeQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4bvkgmmkpn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:40 +0000 (GMT) Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 60RF6Gsi003971; Tue, 27 Jan 2026 15:19:40 GMT 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 4bvkgmmkph-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:40 +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 60RD5pK0006707; Tue, 27 Jan 2026 15:19:39 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4bw8sy97y3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Jan 2026 15:19:39 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 60RFJZtd45482304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 27 Jan 2026 15:19:35 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DF2520040; Tue, 27 Jan 2026 15:19:35 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD9362004B; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 27 Jan 2026 15:19:34 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-s390@vger.kernel.org, bpf@vger.kernel.org, x86@kernel.org, Steven Rostedt Cc: Jens Remus , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , Josh Poimboeuf , Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Ingo Molnar , Jiri Olsa , Arnaldo Carvalho de Melo , Namhyung Kim , Thomas Gleixner , Andrii Nakryiko , Indu Bhagat , "Jose E. Marchesi" , Beau Belgrave , Linus Torvalds , Andrew Morton , Florian Weimer , Kees Cook , "Carlos O'Donell" , Sam James , Dylan Hatch Subject: [PATCH v4 12/12] s390/unwind_user/fp: Enable back chain unwinding of user space Date: Tue, 27 Jan 2026 16:19:25 +0100 Message-ID: <20260127151926.2805123-13-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260127151926.2805123-1-jremus@linux.ibm.com> References: <20260127151926.2805123-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-Authority-Analysis: v=2.4 cv=Gr1PO01C c=1 sm=1 tr=0 ts=6978d78c cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=vUbySO9Y5rIA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=VQtjK7h01SoePT0JaawA:9 X-Proofpoint-GUID: 8g5ku-kVF1yBq_8TiLE-bjQChnL2nhJs X-Proofpoint-ORIG-GUID: FZoY_R0sCta0qELqFeMt3Pk3VIkD4udE X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI3MDEyNSBTYWx0ZWRfXzxmOXzsI1Kz8 GsSWxW1VXDgWpOOlj6vHzy5KK2pOi/72fM379JcuAGpt8vfIxvQRvIFAEk8Cz669l1Ie/Ckm5Xs rTMPGDB0bfJlh5x4blobzfXnGTP3lAJU7WvMvbzoMhej7/yE1JJDi7jg1wtdzxMKkOjE8/7AiA2 kDDd9PPekZsteXTFxPT94Kt2JTUT1NZbuSS7Oe3km2aL07JvlKUZgi4AKFQAqBB9EPaNcQb/R39 zxbtU3CQzjTk6vRZ0dX30AhN6fz8E1+xIDac6BNyriwfVsPnpu+3oOxazb165Yoj3qVPQLFZyte RdoE/Jb9KcFwa2ByM7WiE/egSvC/AF4B4Ur+ZPLwWf7JaQ1Zr2tAM+76hFcWRfyhbhsGmoRneu0 9tjxaW/P+Pk7FExS7otbWXHQ/MOD6CUXQ+NO53iXwuLwpIpng2EMbul45p8hm8oY5aoZtNUslh4 8RYUf+gl8L+5buelJDg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-27_03,2026-01-27_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 lowpriorityscore=0 suspectscore=0 impostorscore=0 phishscore=0 malwarescore=0 adultscore=0 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2601150000 definitions=main-2601270125 Content-Type: text/plain; charset="utf-8" Unwinding of user space using frame pointer (FP) is virtually impossible on s390 for the following reasons: The s390 64-bit (s390x) ELF ABI [1] does only designate a "preferred" FP register and does not mandate fixed FP and return address (RA) stack save slots. Therefore neither the FP register nor the FP/RA stack save slot offsets from CFA are known. Compilers, such as GCC and Clang, do not necessarily setup a FP register early in the function prologue, even not with compiler option -fno-omit-frame-pointer. Therefore the CFA offset from FP register is not known. This could be resolved by having compiler option -no-omit-frame-pointer enforce all of the following: Use the preferred FP register 11 as frame pointer, use fixed FP/RA stack slot offsets from CFA (e.g. -72 for FP and -48 for RA), and setup the FP register immediately after saving the call saved registers. Fortunately s390 provides an alternative to frame pointer: back chain, which can be enabled using s390-specific compiler option -mbackchain. The back chain is very similar to a frame pointer on the stack. Leverage the unwind user fp infrastructure to enable unwinding of user space using back chain. Enable HAVE_UNWIND_USER_FP and provide a s390- specific implementation of unwind_user_fp_get_frame(), which uses the back chain. Signed-off-by: Jens Remus --- Notes (jremus): Changes in v4: - Remove flawed heuristic to detect if topmost IP in early prologue. While it may resolve the caller getting skipped it may erroneously inject a callee as caller. - Fix outermost frame indication. - Adjust to flexible CFA and FP/RA rules. - Remove superfluous unwind_user_fp_get_frame define. =20 Changes in RFC v3: - New patch. Implement unwind user fp using back chain on s390. Reuses logic from RFC v2 patch "unwind_user/backchain: Introduce back chain user space unwinding". (Josh) arch/s390/Kconfig | 1 + arch/s390/include/asm/unwind_user.h | 62 +++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 063f0c857600..5f7e83ba54b2 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -250,6 +250,7 @@ config S390 select HAVE_SOFTIRQ_ON_OWN_STACK select HAVE_STACKPROTECTOR if CC_HAS_STACKPROTECTOR_GLOBAL select HAVE_SYSCALL_TRACEPOINTS + select HAVE_UNWIND_USER_FP select HAVE_UNWIND_USER_SFRAME select HAVE_VIRT_CPU_ACCOUNTING select HAVE_VIRT_CPU_ACCOUNTING_IDLE diff --git a/arch/s390/include/asm/unwind_user.h b/arch/s390/include/asm/un= wind_user.h index 941aa3f0f70f..a7b97ea01c26 100644 --- a/arch/s390/include/asm/unwind_user.h +++ b/arch/s390/include/asm/unwind_user.h @@ -3,8 +3,12 @@ #define _ASM_S390_UNWIND_USER_H =20 #include +#include #include +#include #include +#include +#include =20 #ifdef CONFIG_UNWIND_USER =20 @@ -65,6 +69,64 @@ static inline int arch_unwind_user_get_reg(unsigned long= *val, =20 #endif /* CONFIG_UNWIND_USER */ =20 +#ifdef CONFIG_HAVE_UNWIND_USER_FP + +static inline bool ip_within_vdso(unsigned long ip) +{ + return in_range(ip, current->mm->context.vdso_base, vdso_text_size()); +} + +static inline int unwind_user_fp_get_frame(struct unwind_user_state *state, + struct unwind_user_frame *frame) +{ + struct stack_frame_user __user *sf; + unsigned long __user *ra_addr; + unsigned long sp; + + sf =3D (void __user *)state->sp; + if (__get_user(sp, (unsigned long __user *)&sf->back_chain)) + return -EINVAL; + if (!sp && ip_within_vdso(state->ip)) { + /* + * Assume non-standard vDSO user wrapper stack frame. + * See vDSO user wrapper code for details. + */ + struct stack_frame_vdso_wrapper *sf_vdso =3D (void __user *)sf; + + ra_addr =3D (unsigned long __user *)&sf_vdso->return_address; + sf =3D (void __user *)((unsigned long)sf + STACK_FRAME_VDSO_OVERHEAD); + if (__get_user(sp, (unsigned long __user *)&sf->back_chain)) + return -EINVAL; + } else if (!sp) { + /* + * Assume outermost frame reached. unwind_user_next_common() + * disregards all other fields in outermost frame. + */ + frame->outermost =3D true; + return 0; + } else { + /* + * Assume IP past prologue and new stack frame allocated. + * Follow back chain, which then equals the SP at entry. + * Skips caller if wrong in topmost frame. + */ + sf =3D (void __user *)sp; + ra_addr =3D (unsigned long __user *)&sf->gprs[8]; + } + + frame->cfa.rule =3D UNWIND_USER_CFA_RULE_SP_OFFSET; + frame->cfa.offset =3D sp - state->sp + 160; + frame->sp_off =3D -160; + frame->fp.rule =3D UNWIND_USER_RULE_ZERO; /* Cannot unwind FP. */ + frame->ra.rule =3D UNWIND_USER_RULE_CFA_OFFSET_DEREF; + frame->ra.offset =3D (unsigned long)ra_addr - (state->sp + frame->cfa.off= set); + frame->outermost =3D false; + + return 0; +} + +#endif /* CONFIG_HAVE_UNWIND_USER_FP */ + #include =20 #endif /* _ASM_S390_UNWIND_USER_H */ --=20 2.51.0