From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26227439006; Tue, 5 May 2026 12:34:21 +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=1777984462; cv=none; b=H8clXQQ+pTBPn2foP53vPzFxjkur37XxGWoTb9/0dpQSUWkq3UelfiMCFg854UDMrD5uwGlKDipLKPISD4BtzRSUyTnA3Fctjqe6dRjJLk0ZEf+/xG4JMkwj/zcCIZqmymQCNQ4QH0m3Sxv00PaTxMuj0iCwfLaCYmVac7prvkc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777984462; c=relaxed/simple; bh=JX5DB7kuIFLTsjbACmu21PvGbIRTip8UGIdm1g5XdgQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vGMZdpQQJt/+1rPPaKM3eAhdBp2jKeyU3lIB5/Q8p6ed6xDSn+7aDYGG4lOLzHgzT063HFjXPxvFWekf2YGlmxFPcWi6zffygH2i893sfd5Wf95QwgOm5vaDY951XzGTujEwlygsmgTY/OAJ4eBwBP1+twNQWoI459ahoE6a1Kc= 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=qmlDclUp; 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="qmlDclUp" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6457Vt1j2805903; Tue, 5 May 2026 12:33:48 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=cSiBsMiyvS7cygGX5 2RlC3XdEyvxbuMMGQjKtYeDTPg=; b=qmlDclUpN92qW9d+YesE/GcqxsAMp6EoH a7TF23djLdcniuwKYSgTgKz/6lsQCeNXtSDHFF6Z3jyAqYe6cfMmrsF/DqRHQy++ 0yNRVBvugQoSfdz5ADQ09ktEGubO+OYDPml6Ouoxaos13IskEQEyYbJmFJuKjIYy BZWKc+lxueQ9aHXCpaMsWvX15mh14f/n/jpg64rauPmT5jkxLYLRIGOUys1CwMgt rrGzT/5ayP+1wtPm3NT41a1xTHbRwRlQiN4RqFRD2SN7ovIlIvS5TRjVmRz1vVqw VvbDmhIAd+8PWcI38S+TziSrK8cRD2iGrhaByh+VMfhZXkRL2Tklw== 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 4dw9v7bn05-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 12:33:47 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 645COOsh030976; Tue, 5 May 2026 12:33:46 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4dwx9y9aq7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 May 2026 12:33:46 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 645CXhR320185376 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 May 2026 12:33:43 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42B072004B; Tue, 5 May 2026 12:33:43 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B45B42004D; Tue, 5 May 2026 12:33:42 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.87.85.9]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Tue, 5 May 2026 12:33:42 +0000 (GMT) From: Jens Remus To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, x86@kernel.org, Steven Rostedt , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Dylan Hatch , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Mathieu Desnoyers , Kees Cook , Sam James , Andy Lutomirski Cc: Jens Remus , bpf@vger.kernel.org, linux-mm@kvack.org, Namhyung Kim , Andrii Nakryiko , "Jose E. Marchesi" , Beau Belgrave , Florian Weimer , "Carlos O'Donell" , Masami Hiramatsu , Jiri Olsa , Arnaldo Carvalho de Melo , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Heiko Carstens , Vasily Gorbik , Ilya Leoshkevich , "Steven Rostedt (Google)" Subject: [PATCH v10 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO Date: Tue, 5 May 2026 14:33:36 +0200 Message-ID: <20260505123340.3770025-3-jremus@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260505123340.3770025-1-jremus@linux.ibm.com> References: <20260505123340.3770025-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: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNTA1MDExNCBTYWx0ZWRfX+8UcH5+UOaM1 NiyK+gIU52dpuz51o6BTQysBsVyNT/2mHHR9qR+6Emc/FTD5h+tcOm+YkehVAPO5XFOYOi9bgMg Yk8NhMcfHccMTzJgElEu0S/Gq0x1tew69hfaJkeFN5/h5GDUT1S/CrDWP4SiLTJy4OJ2n8VcGJ+ zdt3iXbDlgGIua5NU1SD1/qsimPp+X7M21nFoGb/aYNW63LIsa3bNIG+toisTxLPz+310iBbCfs zTeEMnf+xooGMloeqkO5fmBGK8oOsZf744P0kcRi6BpBwA2FSzrV1D6yuWwbSAoJF30dmRkkU6D vLvlivEsq9xlD4KUxctpiONUN76EfOv1mdeITHDkHe7Yp6vn06VV8MK41EqyxL6NWHfsfpRzXT+ HhnxMntyythGAMxfrm9LY6aUx819saPNKadhTIavu+/FKJ2FDOKdImtOXDZhvzw5bfofFPlPwBA sRd0ERyHmcZAWKrhGyg== X-Proofpoint-GUID: 0_uFKNj1zBABeQQdK6Fa-tlAuwKxXQCu X-Proofpoint-ORIG-GUID: CPvQIMWgxbWFE4k8IOhb5eoIN_adUwGA X-Authority-Analysis: v=2.4 cv=eu/vCIpX c=1 sm=1 tr=0 ts=69f9e3ac cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=NGcC8JguVDcA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VwQbUJbxAAAA:8 a=meVymXHHAAAA:8 a=oGMlB6cnAAAA:8 a=VnNF1IyMAAAA:8 a=zOOTxvlrTZNIKiBVQswA:9 a=2JgSa4NbpEOStq-L5dxp:22 a=NdAtdrkLVvyUPsUoGJp4:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-05-05_02,2026-04-30_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 lowpriorityscore=0 clxscore=1015 adultscore=0 suspectscore=0 malwarescore=0 bulkscore=0 impostorscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604200000 definitions=main-2605050114 From: Josh Poimboeuf It was decided years ago that .cfi_* annotations aren't maintainable in the kernel. They were replaced by objtool unwind hints. 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. [ Jens Remus: Define CFI_SIGNAL_FRAME for !BUILD_VDSO. ] Signed-off-by: Josh Poimboeuf Signed-off-by: Steven Rostedt (Google) Acked-by: H. Peter Anvin (Intel) Signed-off-by: Jens Remus --- arch/x86/include/asm/dwarf2.h | 52 ++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h index 09c9684d3ad6..13e2e64ef265 100644 --- a/arch/x86/include/asm/dwarf2.h +++ b/arch/x86/include/asm/dwarf2.h @@ -6,6 +6,15 @@ #warning "asm/dwarf2.h should be only included in pure assembly files" #endif +#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 .cfi_def_cfa @@ -22,21 +31,32 @@ #define CFI_ESCAPE .cfi_escape #define CFI_SIGNAL_FRAME .cfi_signal_frame -#ifndef BUILD_VDSO - /* - * Emit CFI data in .debug_frame sections, not .eh_frame sections. - * The latter we currently just discard since we don't do DWARF - * unwinding at runtime. So only the offline DWARF information is - * useful to anyone. Note we should not use this directive if we - * ever decide to enable DWARF unwinding at runtime. - */ - .cfi_sections .debug_frame -#else - /* - * For the vDSO, emit both runtime unwind information and debug - * symbols for the .dbg file. - */ - .cfi_sections .eh_frame, .debug_frame -#endif +#else /* !BUILD_VDSO */ + +/* + * On x86, these macros aren't used outside VDSO. As well they shouldn't be: + * they're fragile and very difficult to maintain. + */ + +.macro nocfi args:vararg +.endm + +#define CFI_STARTPROC nocfi +#define CFI_ENDPROC nocfi +#define CFI_DEF_CFA nocfi +#define CFI_DEF_CFA_REGISTER nocfi +#define CFI_DEF_CFA_OFFSET nocfi +#define CFI_ADJUST_CFA_OFFSET nocfi +#define CFI_OFFSET nocfi +#define CFI_REL_OFFSET nocfi +#define CFI_REGISTER nocfi +#define CFI_RESTORE nocfi +#define CFI_REMEMBER_STATE nocfi +#define CFI_RESTORE_STATE nocfi +#define CFI_UNDEFINED nocfi +#define CFI_ESCAPE nocfi +#define CFI_SIGNAL_FRAME nocfi + +#endif /* !BUILD_VDSO */ #endif /* _ASM_X86_DWARF2_H */ -- 2.51.0