* [PATCH v7 1/6] x86/vdso: Fix DWARF generation for getrandom()
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
@ 2026-02-03 17:19 ` Jens Remus
2026-02-04 0:43 ` H. Peter Anvin
2026-02-03 17:19 ` [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO Jens Remus
` (5 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jens Remus @ 2026-02-03 17:19 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm, Steven Rostedt
Cc: Jens Remus, 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
H. Peter Anvin, Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka,
Heiko Carstens, Vasily Gorbik, Steven Rostedt (Google)
From: Josh Poimboeuf <jpoimboe@kernel.org>
Add CFI annotations to the VDSO implementation of getrandom() so it will
have valid DWARF unwinding metadata.
Fixes: 33385150ac45 ("x86: vdso: Wire up getrandom() vDSO implementation")
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
index bcba5639b8ee..cc82da9216fb 100644
--- a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
+++ b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
@@ -4,7 +4,7 @@
*/
#include <linux/linkage.h>
-#include <asm/frame.h>
+#include <asm/dwarf2.h>
.section .rodata, "a"
.align 16
@@ -22,7 +22,7 @@ CONSTANTS: .octa 0x6b20657479622d323320646e61707865
* rcx: number of 64-byte blocks to write to output
*/
SYM_FUNC_START(__arch_chacha20_blocks_nostack)
-
+ CFI_STARTPROC
.set output, %rdi
.set key, %rsi
.set counter, %rdx
@@ -175,4 +175,5 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
pxor temp,temp
ret
+ CFI_ENDPROC
SYM_FUNC_END(__arch_chacha20_blocks_nostack)
--
2.51.0
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v7 1/6] x86/vdso: Fix DWARF generation for getrandom()
2026-02-03 17:19 ` [PATCH v7 1/6] x86/vdso: Fix DWARF generation for getrandom() Jens Remus
@ 2026-02-04 0:43 ` H. Peter Anvin
0 siblings, 0 replies; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-04 0:43 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2026-02-03 09:19, Jens Remus wrote:
> From: Josh Poimboeuf <jpoimboe@kernel.org>
>
> Add CFI annotations to the VDSO implementation of getrandom() so it will
> have valid DWARF unwinding metadata.
>
> Fixes: 33385150ac45 ("x86: vdso: Wire up getrandom() vDSO implementation")
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
> index bcba5639b8ee..cc82da9216fb 100644
> --- a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
> +++ b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
> @@ -4,7 +4,7 @@
> */
>
> #include <linux/linkage.h>
> -#include <asm/frame.h>
> +#include <asm/dwarf2.h>
>
> .section .rodata, "a"
> .align 16
> @@ -22,7 +22,7 @@ CONSTANTS: .octa 0x6b20657479622d323320646e61707865
> * rcx: number of 64-byte blocks to write to output
> */
> SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> -
> + CFI_STARTPROC
> .set output, %rdi
> .set key, %rsi
> .set counter, %rdx
> @@ -175,4 +175,5 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> pxor temp,temp
>
> ret
> + CFI_ENDPROC
> SYM_FUNC_END(__arch_chacha20_blocks_nostack)
Looks good to me.
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
2026-02-03 17:19 ` [PATCH v7 1/6] x86/vdso: Fix DWARF generation for getrandom() Jens Remus
@ 2026-02-03 17:19 ` Jens Remus
2026-02-03 17:35 ` H. Peter Anvin
2026-02-04 0:43 ` H. Peter Anvin
2026-02-03 17:19 ` [PATCH v7 3/6] x86/asm: Simplify VDSO DWARF generation Jens Remus
` (4 subsequent siblings)
6 siblings, 2 replies; 20+ messages in thread
From: Jens Remus @ 2026-02-03 17:19 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm, Steven Rostedt
Cc: Jens Remus, 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
H. Peter Anvin, Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka,
Heiko Carstens, Vasily Gorbik, Steven Rostedt (Google)
From: Josh Poimboeuf <jpoimboe@kernel.org>
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.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/x86/include/asm/dwarf2.h | 51 ++++++++++++++++++++++++-----------
1 file changed, 35 insertions(+), 16 deletions(-)
diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
index 09c9684d3ad6..7cc30500c095 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,31 @@
#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
+
+#endif /* !BUILD_VDSO */
#endif /* _ASM_X86_DWARF2_H */
--
2.51.0
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO
2026-02-03 17:19 ` [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO Jens Remus
@ 2026-02-03 17:35 ` H. Peter Anvin
2026-02-04 0:43 ` H. Peter Anvin
1 sibling, 0 replies; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-03 17:35 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On February 3, 2026 9:19:53 AM PST, Jens Remus <jremus@linux.ibm.com> wrote:
>From: Josh Poimboeuf <jpoimboe@kernel.org>
>
>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.
>
>Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
>Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>Signed-off-by: Jens Remus <jremus@linux.ibm.com>
>---
> arch/x86/include/asm/dwarf2.h | 51 ++++++++++++++++++++++++-----------
> 1 file changed, 35 insertions(+), 16 deletions(-)
>
>diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
>index 09c9684d3ad6..7cc30500c095 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,31 @@
> #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
>+
>+#endif /* !BUILD_VDSO */
>
> #endif /* _ASM_X86_DWARF2_H */
Maybe we should move these into x86/entry/vdso/common instead?
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO
2026-02-03 17:19 ` [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO Jens Remus
2026-02-03 17:35 ` H. Peter Anvin
@ 2026-02-04 0:43 ` H. Peter Anvin
2026-02-06 14:01 ` Jens Remus
1 sibling, 1 reply; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-04 0:43 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2026-02-03 09:19, Jens Remus wrote:
> From: Josh Poimboeuf <jpoimboe@kernel.org>
>
> 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.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> arch/x86/include/asm/dwarf2.h | 51 ++++++++++++++++++++++++-----------
> 1 file changed, 35 insertions(+), 16 deletions(-)
>
> diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
> index 09c9684d3ad6..7cc30500c095 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,31 @@
> #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
> +
> +#endif /* !BUILD_VDSO */
>
> #endif /* _ASM_X86_DWARF2_H */
I guess patch 3 justifies this.
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO
2026-02-04 0:43 ` H. Peter Anvin
@ 2026-02-06 14:01 ` Jens Remus
0 siblings, 0 replies; 20+ messages in thread
From: Jens Remus @ 2026-02-06 14:01 UTC (permalink / raw)
To: H. Peter Anvin, linux-kernel, linux-trace-kernel, bpf, x86,
linux-mm, Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2/4/2026 1:43 AM, H. Peter Anvin wrote:
> On 2026-02-03 09:19, Jens Remus wrote:
>> From: Josh Poimboeuf <jpoimboe@kernel.org>
>>
>> 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.
>>
>> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
>> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
>> ---
>> arch/x86/include/asm/dwarf2.h | 51 ++++++++++++++++++++++++-----------
>> 1 file changed, 35 insertions(+), 16 deletions(-)
>>
>> diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
>> index 09c9684d3ad6..7cc30500c095 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,31 @@
>> #define CFI_ESCAPE .cfi_escape
>> #define CFI_SIGNAL_FRAME .cfi_signal_frame
I missed that this is new on tip:x86/entry and thus also needs to be
added below in the !BUILD_VDSO case.
>>
>> -#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 */
>
> I guess patch 3 justifies this.
>
> Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
>
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v7 3/6] x86/asm: Simplify VDSO DWARF generation
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
2026-02-03 17:19 ` [PATCH v7 1/6] x86/vdso: Fix DWARF generation for getrandom() Jens Remus
2026-02-03 17:19 ` [PATCH v7 2/6] x86/asm: Avoid emitting DWARF CFI for non-VDSO Jens Remus
@ 2026-02-03 17:19 ` Jens Remus
2026-02-04 0:44 ` H. Peter Anvin
2026-02-03 17:19 ` [PATCH v7 4/6] x86/vdso: Use SYM_FUNC_{START,END} in __kernel_vsyscall() Jens Remus
` (3 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jens Remus @ 2026-02-03 17:19 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm, Steven Rostedt
Cc: Jens Remus, 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
H. Peter Anvin, Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka,
Heiko Carstens, Vasily Gorbik, Steven Rostedt (Google)
From: Josh Poimboeuf <jpoimboe@kernel.org>
Add CFI_STARTPROC and CFI_ENDPROC annotations to the SYM_FUNC_* macros
so the VDSO asm functions don't need to add them manually. Note this
only affects VDSO, the CFI_* macros are empty for the kernel proper.
[ Jens Remus: Reword commit subject and message as suggested by Josh. ]
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/x86/entry/vdso/common/vdso-layout.lds.S | 2 +-
.../x86/entry/vdso/vdso64/vgetrandom-chacha.S | 2 --
arch/x86/entry/vdso/vdso64/vsgx.S | 4 ---
arch/x86/include/asm/linkage.h | 33 +++++++++++++++----
arch/x86/include/asm/vdso.h | 1 -
5 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/arch/x86/entry/vdso/common/vdso-layout.lds.S b/arch/x86/entry/vdso/common/vdso-layout.lds.S
index a1e30be3e83d..856b8b9d278c 100644
--- a/arch/x86/entry/vdso/common/vdso-layout.lds.S
+++ b/arch/x86/entry/vdso/common/vdso-layout.lds.S
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
-#include <asm/vdso.h>
+#include <asm/page_types.h>
#include <asm/vdso/vsyscall.h>
#include <vdso/datapage.h>
diff --git a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
index cc82da9216fb..a33212594731 100644
--- a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
+++ b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
@@ -22,7 +22,6 @@ CONSTANTS: .octa 0x6b20657479622d323320646e61707865
* rcx: number of 64-byte blocks to write to output
*/
SYM_FUNC_START(__arch_chacha20_blocks_nostack)
- CFI_STARTPROC
.set output, %rdi
.set key, %rsi
.set counter, %rdx
@@ -175,5 +174,4 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
pxor temp,temp
ret
- CFI_ENDPROC
SYM_FUNC_END(__arch_chacha20_blocks_nostack)
diff --git a/arch/x86/entry/vdso/vdso64/vsgx.S b/arch/x86/entry/vdso/vdso64/vsgx.S
index 37a3d4c02366..c0342238c976 100644
--- a/arch/x86/entry/vdso/vdso64/vsgx.S
+++ b/arch/x86/entry/vdso/vdso64/vsgx.S
@@ -24,8 +24,6 @@
.section .text, "ax"
SYM_FUNC_START(__vdso_sgx_enter_enclave)
- /* Prolog */
- .cfi_startproc
push %rbp
.cfi_adjust_cfa_offset 8
.cfi_rel_offset %rbp, 0
@@ -143,8 +141,6 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
jle .Lout
jmp .Lenter_enclave
- .cfi_endproc
-
_ASM_VDSO_EXTABLE_HANDLE(.Lenclu_eenter_eresume, .Lhandle_exception)
SYM_FUNC_END(__vdso_sgx_enter_enclave)
diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
index 9d38ae744a2e..9d7f90c57451 100644
--- a/arch/x86/include/asm/linkage.h
+++ b/arch/x86/include/asm/linkage.h
@@ -40,6 +40,10 @@
#ifdef __ASSEMBLER__
+#ifndef LINKER_SCRIPT
+#include <asm/dwarf2.h>
+#endif
+
#if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
#define RET jmp __x86_return_thunk
#else /* CONFIG_MITIGATION_RETPOLINE */
@@ -112,34 +116,51 @@
# define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS
#endif
+#define __SYM_FUNC_START \
+ CFI_STARTPROC ASM_NL
+
+#define __SYM_FUNC_END \
+ CFI_ENDPROC ASM_NL
+
/* SYM_TYPED_FUNC_START -- use for indirectly called globals, w/ CFI type */
#define SYM_TYPED_FUNC_START(name) \
SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \
+ __SYM_FUNC_START \
ENDBR
/* SYM_FUNC_START -- use for global functions */
#define SYM_FUNC_START(name) \
- SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN)
+ SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \
+ __SYM_FUNC_START
/* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */
#define SYM_FUNC_START_NOALIGN(name) \
- SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
+ SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) \
+ __SYM_FUNC_START
/* SYM_FUNC_START_LOCAL -- use for local functions */
#define SYM_FUNC_START_LOCAL(name) \
- SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN)
+ SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN) \
+ __SYM_FUNC_START
/* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */
#define SYM_FUNC_START_LOCAL_NOALIGN(name) \
- SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
+ SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) \
+ __SYM_FUNC_START
/* SYM_FUNC_START_WEAK -- use for weak functions */
#define SYM_FUNC_START_WEAK(name) \
- SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN)
+ SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN) \
+ __SYM_FUNC_START
/* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */
#define SYM_FUNC_START_WEAK_NOALIGN(name) \
- SYM_START(name, SYM_L_WEAK, SYM_A_NONE)
+ SYM_START(name, SYM_L_WEAK, SYM_A_NONE) \
+ __SYM_FUNC_START
+
+#define SYM_FUNC_END(name) \
+ __SYM_FUNC_END \
+ SYM_END(name, SYM_T_FUNC)
/*
* Expose 'sym' to the startup code in arch/x86/boot/startup/, by emitting an
diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
index e8afbe9faa5b..498ac423741c 100644
--- a/arch/x86/include/asm/vdso.h
+++ b/arch/x86/include/asm/vdso.h
@@ -2,7 +2,6 @@
#ifndef _ASM_X86_VDSO_H
#define _ASM_X86_VDSO_H
-#include <asm/page_types.h>
#include <linux/linkage.h>
#include <linux/init.h>
--
2.51.0
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v7 3/6] x86/asm: Simplify VDSO DWARF generation
2026-02-03 17:19 ` [PATCH v7 3/6] x86/asm: Simplify VDSO DWARF generation Jens Remus
@ 2026-02-04 0:44 ` H. Peter Anvin
0 siblings, 0 replies; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-04 0:44 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2026-02-03 09:19, Jens Remus wrote:
> From: Josh Poimboeuf <jpoimboe@kernel.org>
>
> Add CFI_STARTPROC and CFI_ENDPROC annotations to the SYM_FUNC_* macros
> so the VDSO asm functions don't need to add them manually. Note this
> only affects VDSO, the CFI_* macros are empty for the kernel proper.
>
> [ Jens Remus: Reword commit subject and message as suggested by Josh. ]
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> arch/x86/entry/vdso/common/vdso-layout.lds.S | 2 +-
> .../x86/entry/vdso/vdso64/vgetrandom-chacha.S | 2 --
> arch/x86/entry/vdso/vdso64/vsgx.S | 4 ---
> arch/x86/include/asm/linkage.h | 33 +++++++++++++++----
> arch/x86/include/asm/vdso.h | 1 -
> 5 files changed, 28 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/common/vdso-layout.lds.S b/arch/x86/entry/vdso/common/vdso-layout.lds.S
> index a1e30be3e83d..856b8b9d278c 100644
> --- a/arch/x86/entry/vdso/common/vdso-layout.lds.S
> +++ b/arch/x86/entry/vdso/common/vdso-layout.lds.S
> @@ -1,5 +1,5 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> -#include <asm/vdso.h>
> +#include <asm/page_types.h>
> #include <asm/vdso/vsyscall.h>
> #include <vdso/datapage.h>
>
> diff --git a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
> index cc82da9216fb..a33212594731 100644
> --- a/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
> +++ b/arch/x86/entry/vdso/vdso64/vgetrandom-chacha.S
> @@ -22,7 +22,6 @@ CONSTANTS: .octa 0x6b20657479622d323320646e61707865
> * rcx: number of 64-byte blocks to write to output
> */
> SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> - CFI_STARTPROC
> .set output, %rdi
> .set key, %rsi
> .set counter, %rdx
> @@ -175,5 +174,4 @@ SYM_FUNC_START(__arch_chacha20_blocks_nostack)
> pxor temp,temp
>
> ret
> - CFI_ENDPROC
> SYM_FUNC_END(__arch_chacha20_blocks_nostack)
> diff --git a/arch/x86/entry/vdso/vdso64/vsgx.S b/arch/x86/entry/vdso/vdso64/vsgx.S
> index 37a3d4c02366..c0342238c976 100644
> --- a/arch/x86/entry/vdso/vdso64/vsgx.S
> +++ b/arch/x86/entry/vdso/vdso64/vsgx.S
> @@ -24,8 +24,6 @@
> .section .text, "ax"
>
> SYM_FUNC_START(__vdso_sgx_enter_enclave)
> - /* Prolog */
> - .cfi_startproc
> push %rbp
> .cfi_adjust_cfa_offset 8
> .cfi_rel_offset %rbp, 0
> @@ -143,8 +141,6 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
> jle .Lout
> jmp .Lenter_enclave
>
> - .cfi_endproc
> -
> _ASM_VDSO_EXTABLE_HANDLE(.Lenclu_eenter_eresume, .Lhandle_exception)
>
> SYM_FUNC_END(__vdso_sgx_enter_enclave)
> diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
> index 9d38ae744a2e..9d7f90c57451 100644
> --- a/arch/x86/include/asm/linkage.h
> +++ b/arch/x86/include/asm/linkage.h
> @@ -40,6 +40,10 @@
>
> #ifdef __ASSEMBLER__
>
> +#ifndef LINKER_SCRIPT
> +#include <asm/dwarf2.h>
> +#endif
> +
> #if defined(CONFIG_MITIGATION_RETHUNK) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO)
> #define RET jmp __x86_return_thunk
> #else /* CONFIG_MITIGATION_RETPOLINE */
> @@ -112,34 +116,51 @@
> # define SYM_FUNC_ALIAS_MEMFUNC SYM_FUNC_ALIAS
> #endif
>
> +#define __SYM_FUNC_START \
> + CFI_STARTPROC ASM_NL
> +
> +#define __SYM_FUNC_END \
> + CFI_ENDPROC ASM_NL
> +
> /* SYM_TYPED_FUNC_START -- use for indirectly called globals, w/ CFI type */
> #define SYM_TYPED_FUNC_START(name) \
> SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \
> + __SYM_FUNC_START \
> ENDBR
>
> /* SYM_FUNC_START -- use for global functions */
> #define SYM_FUNC_START(name) \
> - SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN)
> + SYM_START(name, SYM_L_GLOBAL, SYM_F_ALIGN) \
> + __SYM_FUNC_START
>
> /* SYM_FUNC_START_NOALIGN -- use for global functions, w/o alignment */
> #define SYM_FUNC_START_NOALIGN(name) \
> - SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)
> + SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) \
> + __SYM_FUNC_START
>
> /* SYM_FUNC_START_LOCAL -- use for local functions */
> #define SYM_FUNC_START_LOCAL(name) \
> - SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN)
> + SYM_START(name, SYM_L_LOCAL, SYM_F_ALIGN) \
> + __SYM_FUNC_START
>
> /* SYM_FUNC_START_LOCAL_NOALIGN -- use for local functions, w/o alignment */
> #define SYM_FUNC_START_LOCAL_NOALIGN(name) \
> - SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)
> + SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) \
> + __SYM_FUNC_START
>
> /* SYM_FUNC_START_WEAK -- use for weak functions */
> #define SYM_FUNC_START_WEAK(name) \
> - SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN)
> + SYM_START(name, SYM_L_WEAK, SYM_F_ALIGN) \
> + __SYM_FUNC_START
>
> /* SYM_FUNC_START_WEAK_NOALIGN -- use for weak functions, w/o alignment */
> #define SYM_FUNC_START_WEAK_NOALIGN(name) \
> - SYM_START(name, SYM_L_WEAK, SYM_A_NONE)
> + SYM_START(name, SYM_L_WEAK, SYM_A_NONE) \
> + __SYM_FUNC_START
> +
> +#define SYM_FUNC_END(name) \
> + __SYM_FUNC_END \
> + SYM_END(name, SYM_T_FUNC)
>
> /*
> * Expose 'sym' to the startup code in arch/x86/boot/startup/, by emitting an
> diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
> index e8afbe9faa5b..498ac423741c 100644
> --- a/arch/x86/include/asm/vdso.h
> +++ b/arch/x86/include/asm/vdso.h
> @@ -2,7 +2,6 @@
> #ifndef _ASM_X86_VDSO_H
> #define _ASM_X86_VDSO_H
>
> -#include <asm/page_types.h>
> #include <linux/linkage.h>
> #include <linux/init.h>
>
Makes sense to me.
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v7 4/6] x86/vdso: Use SYM_FUNC_{START,END} in __kernel_vsyscall()
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
` (2 preceding siblings ...)
2026-02-03 17:19 ` [PATCH v7 3/6] x86/asm: Simplify VDSO DWARF generation Jens Remus
@ 2026-02-03 17:19 ` Jens Remus
2026-02-04 0:44 ` H. Peter Anvin
2026-02-03 17:19 ` [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave() Jens Remus
` (2 subsequent siblings)
6 siblings, 1 reply; 20+ messages in thread
From: Jens Remus @ 2026-02-03 17:19 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm, Steven Rostedt
Cc: Jens Remus, 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
H. Peter Anvin, Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka,
Heiko Carstens, Vasily Gorbik, Steven Rostedt (Google)
From: Josh Poimboeuf <jpoimboe@kernel.org>
Use SYM_FUNC_{START,END} instead of all the boilerplate. No functional
change.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
Notes (jremus):
Changes in v7:
- Rebase on H. Peter Anvin's vDSO changes on tip:x86/entry.
arch/x86/entry/vdso/vdso32/system_call.S | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso32/system_call.S b/arch/x86/entry/vdso/vdso32/system_call.S
index 9157cf9c5749..a90f4f7de396 100644
--- a/arch/x86/entry/vdso/vdso32/system_call.S
+++ b/arch/x86/entry/vdso/vdso32/system_call.S
@@ -9,11 +9,7 @@
#include <asm/alternative.h>
.text
- .globl __kernel_vsyscall
- .type __kernel_vsyscall,@function
- ALIGN
-__kernel_vsyscall:
- CFI_STARTPROC
+SYM_FUNC_START(__kernel_vsyscall)
/*
* If using int $0x80, there is no reason to muck about with the
@@ -85,7 +81,5 @@ SYM_INNER_LABEL(int80_landing_pad, SYM_L_GLOBAL)
CFI_RESTORE ecx
CFI_ADJUST_CFA_OFFSET -4
RET
- CFI_ENDPROC
-
- .size __kernel_vsyscall,.-__kernel_vsyscall
+SYM_FUNC_END(__kernel_vsyscall)
.previous
--
2.51.0
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v7 4/6] x86/vdso: Use SYM_FUNC_{START,END} in __kernel_vsyscall()
2026-02-03 17:19 ` [PATCH v7 4/6] x86/vdso: Use SYM_FUNC_{START,END} in __kernel_vsyscall() Jens Remus
@ 2026-02-04 0:44 ` H. Peter Anvin
0 siblings, 0 replies; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-04 0:44 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2026-02-03 09:19, Jens Remus wrote:
> From: Josh Poimboeuf <jpoimboe@kernel.org>
>
> Use SYM_FUNC_{START,END} instead of all the boilerplate. No functional
> change.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
>
> Notes (jremus):
> Changes in v7:
> - Rebase on H. Peter Anvin's vDSO changes on tip:x86/entry.
>
> arch/x86/entry/vdso/vdso32/system_call.S | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vdso32/system_call.S b/arch/x86/entry/vdso/vdso32/system_call.S
> index 9157cf9c5749..a90f4f7de396 100644
> --- a/arch/x86/entry/vdso/vdso32/system_call.S
> +++ b/arch/x86/entry/vdso/vdso32/system_call.S
> @@ -9,11 +9,7 @@
> #include <asm/alternative.h>
>
> .text
> - .globl __kernel_vsyscall
> - .type __kernel_vsyscall,@function
> - ALIGN
> -__kernel_vsyscall:
> - CFI_STARTPROC
> +SYM_FUNC_START(__kernel_vsyscall)
>
> /*
> * If using int $0x80, there is no reason to muck about with the
> @@ -85,7 +81,5 @@ SYM_INNER_LABEL(int80_landing_pad, SYM_L_GLOBAL)
> CFI_RESTORE ecx
> CFI_ADJUST_CFA_OFFSET -4
> RET
> - CFI_ENDPROC
> -
> - .size __kernel_vsyscall,.-__kernel_vsyscall
> +SYM_FUNC_END(__kernel_vsyscall)
> .previous
Looks good to me.
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave()
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
` (3 preceding siblings ...)
2026-02-03 17:19 ` [PATCH v7 4/6] x86/vdso: Use SYM_FUNC_{START,END} in __kernel_vsyscall() Jens Remus
@ 2026-02-03 17:19 ` Jens Remus
2026-02-04 0:44 ` H. Peter Anvin
2026-02-06 15:04 ` Jens Remus
2026-02-03 17:19 ` [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO Jens Remus
2026-02-06 15:02 ` [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
6 siblings, 2 replies; 20+ messages in thread
From: Jens Remus @ 2026-02-03 17:19 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm, Steven Rostedt
Cc: Jens Remus, 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
H. Peter Anvin, Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka,
Heiko Carstens, Vasily Gorbik, Steven Rostedt (Google)
From: Josh Poimboeuf <jpoimboe@kernel.org>
Use the CFI macros instead of the raw .cfi_* directives to be consistent
with the rest of the VDSO asm. It's also easier on the eyes.
No functional changes.
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
arch/x86/entry/vdso/vdso64/vsgx.S | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/arch/x86/entry/vdso/vdso64/vsgx.S b/arch/x86/entry/vdso/vdso64/vsgx.S
index c0342238c976..8d7b8eb45c50 100644
--- a/arch/x86/entry/vdso/vdso64/vsgx.S
+++ b/arch/x86/entry/vdso/vdso64/vsgx.S
@@ -24,13 +24,14 @@
.section .text, "ax"
SYM_FUNC_START(__vdso_sgx_enter_enclave)
+ SYM_F_ALIGN
push %rbp
- .cfi_adjust_cfa_offset 8
- .cfi_rel_offset %rbp, 0
+ CFI_ADJUST_CFA_OFFSET 8
+ CFI_REL_OFFSET %rbp, 0
mov %rsp, %rbp
- .cfi_def_cfa_register %rbp
+ CFI_DEF_CFA_REGISTER %rbp
push %rbx
- .cfi_rel_offset %rbx, -8
+ CFI_REL_OFFSET %rbx, -8
mov %ecx, %eax
.Lenter_enclave:
@@ -77,13 +78,11 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
.Lout:
pop %rbx
leave
- .cfi_def_cfa %rsp, 8
+ CFI_DEF_CFA %rsp, 8
RET
- /* The out-of-line code runs with the pre-leave stack frame. */
- .cfi_def_cfa %rbp, 16
-
.Linvalid_input:
+ CFI_DEF_CFA %rbp, 16
mov $(-EINVAL), %eax
jmp .Lout
--
2.51.0
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave()
2026-02-03 17:19 ` [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave() Jens Remus
@ 2026-02-04 0:44 ` H. Peter Anvin
2026-02-06 15:04 ` Jens Remus
1 sibling, 0 replies; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-04 0:44 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2026-02-03 09:19, Jens Remus wrote:
> From: Josh Poimboeuf <jpoimboe@kernel.org>
>
> Use the CFI macros instead of the raw .cfi_* directives to be consistent
> with the rest of the VDSO asm. It's also easier on the eyes.
>
> No functional changes.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> arch/x86/entry/vdso/vdso64/vsgx.S | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vdso64/vsgx.S b/arch/x86/entry/vdso/vdso64/vsgx.S
> index c0342238c976..8d7b8eb45c50 100644
> --- a/arch/x86/entry/vdso/vdso64/vsgx.S
> +++ b/arch/x86/entry/vdso/vdso64/vsgx.S
> @@ -24,13 +24,14 @@
> .section .text, "ax"
>
> SYM_FUNC_START(__vdso_sgx_enter_enclave)
> + SYM_F_ALIGN
> push %rbp
> - .cfi_adjust_cfa_offset 8
> - .cfi_rel_offset %rbp, 0
> + CFI_ADJUST_CFA_OFFSET 8
> + CFI_REL_OFFSET %rbp, 0
> mov %rsp, %rbp
> - .cfi_def_cfa_register %rbp
> + CFI_DEF_CFA_REGISTER %rbp
> push %rbx
> - .cfi_rel_offset %rbx, -8
> + CFI_REL_OFFSET %rbx, -8
>
> mov %ecx, %eax
> .Lenter_enclave:
> @@ -77,13 +78,11 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
> .Lout:
> pop %rbx
> leave
> - .cfi_def_cfa %rsp, 8
> + CFI_DEF_CFA %rsp, 8
> RET
>
> - /* The out-of-line code runs with the pre-leave stack frame. */
> - .cfi_def_cfa %rbp, 16
> -
> .Linvalid_input:
> + CFI_DEF_CFA %rbp, 16
> mov $(-EINVAL), %eax
> jmp .Lout
>
Looks good to me.
Acked-by: H. Peter Anvin (Intel) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave()
2026-02-03 17:19 ` [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave() Jens Remus
2026-02-04 0:44 ` H. Peter Anvin
@ 2026-02-06 15:04 ` Jens Remus
1 sibling, 0 replies; 20+ messages in thread
From: Jens Remus @ 2026-02-06 15:04 UTC (permalink / raw)
To: Josh Poimboeuf, H. Peter Anvin, linux-kernel, linux-trace-kernel,
bpf, x86, linux-mm, Steven Rostedt
Cc: 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,
Borislav Petkov, Dave Hansen, David Hildenbrand, Liam R. Howlett,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Suren Baghdasaryan,
Vlastimil Babka, Heiko Carstens, Vasily Gorbik,
Steven Rostedt (Google)
On 2/3/2026 6:19 PM, Jens Remus wrote:
> From: Josh Poimboeuf <jpoimboe@kernel.org>
>
> Use the CFI macros instead of the raw .cfi_* directives to be consistent
> with the rest of the VDSO asm. It's also easier on the eyes.
>
> No functional changes.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> Signed-off-by: Jens Remus <jremus@linux.ibm.com>
> ---
> arch/x86/entry/vdso/vdso64/vsgx.S | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/vdso64/vsgx.S b/arch/x86/entry/vdso/vdso64/vsgx.S
> index c0342238c976..8d7b8eb45c50 100644
> --- a/arch/x86/entry/vdso/vdso64/vsgx.S
> +++ b/arch/x86/entry/vdso/vdso64/vsgx.S
> @@ -24,13 +24,14 @@
> .section .text, "ax"
>
> SYM_FUNC_START(__vdso_sgx_enter_enclave)
> + SYM_F_ALIGN
Somehow I missed Steven's v6 and any of it's review feedback, where Josh
noticed that this added SYM_F_ALIGN somehow creeped in and should be
dropped:
https://lore.kernel.org/all/amh7fzsjx4p5nowy3b3j6blkty5ojqf7jawtlslexwzdbxrhc3@zersgacmcnai/
> push %rbp
> - .cfi_adjust_cfa_offset 8
> - .cfi_rel_offset %rbp, 0
> + CFI_ADJUST_CFA_OFFSET 8
> + CFI_REL_OFFSET %rbp, 0
> mov %rsp, %rbp
> - .cfi_def_cfa_register %rbp
> + CFI_DEF_CFA_REGISTER %rbp
> push %rbx
> - .cfi_rel_offset %rbx, -8
> + CFI_REL_OFFSET %rbx, -8
>
> mov %ecx, %eax
> .Lenter_enclave:
> @@ -77,13 +78,11 @@ SYM_FUNC_START(__vdso_sgx_enter_enclave)
> .Lout:
> pop %rbx
> leave
> - .cfi_def_cfa %rsp, 8
> + CFI_DEF_CFA %rsp, 8
> RET
>
> - /* The out-of-line code runs with the pre-leave stack frame. */
> - .cfi_def_cfa %rbp, 16
> -
> .Linvalid_input:
> + CFI_DEF_CFA %rbp, 16
> mov $(-EINVAL), %eax
> jmp .Lout
>
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
` (4 preceding siblings ...)
2026-02-03 17:19 ` [PATCH v7 5/6] x86/vdso: Use CFI macros in __vdso_sgx_enter_enclave() Jens Remus
@ 2026-02-03 17:19 ` Jens Remus
2026-02-04 0:49 ` H. Peter Anvin
2026-02-06 15:02 ` [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
6 siblings, 1 reply; 20+ messages in thread
From: Jens Remus @ 2026-02-03 17:19 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm, Steven Rostedt
Cc: Jens Remus, 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
H. Peter Anvin, Liam R. Howlett, Lorenzo Stoakes, Michal Hocko,
Mike Rapoport, Suren Baghdasaryan, Vlastimil Babka,
Heiko Carstens, Vasily Gorbik, Steven Rostedt (Google)
From: Josh Poimboeuf <jpoimboe@kernel.org>
Enable sframe generation in the VDSO library so kernel and user space
can unwind through it.
[ Jens Remus: Add support for SFrame V3. Prevent GNU_SFRAME program
table entry to empty .sframe section. ]
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Jens Remus <jremus@linux.ibm.com>
---
Notes (jremus):
Changes in v7:
- Rebase on H. Peter Anvin's vDSO changes on tip:x86/entry.
- Simplify adding assembler option -Wa,--gsframe-3. Add for
vdso64 only.
- Align to .eh_frame and mark .sframe as KEEP in vDSO linker script.
Note that GNU linker 2.46 will mark .sframe as KEEP in its default
linker script as well.
arch/Kconfig | 7 +++++++
arch/x86/entry/vdso/common/vdso-layout.lds.S | 11 +++++++++++
arch/x86/entry/vdso/vdso64/Makefile | 1 +
arch/x86/include/asm/dwarf2.h | 5 ++++-
4 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index 31220f512b16..8170e492a44c 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.
+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
diff --git a/arch/x86/entry/vdso/common/vdso-layout.lds.S b/arch/x86/entry/vdso/common/vdso-layout.lds.S
index 856b8b9d278c..421eb4ca9131 100644
--- a/arch/x86/entry/vdso/common/vdso-layout.lds.S
+++ b/arch/x86/entry/vdso/common/vdso-layout.lds.S
@@ -60,6 +60,13 @@ SECTIONS
*(.eh_frame.*)
} :text
+#ifdef CONFIG_AS_SFRAME
+ .sframe : {
+ KEEP (*(.sframe))
+ *(.sframe.*)
+ } :text :sframe
+#endif
+
/*
* Text is well-separated from actual data: there's plenty of
* stuff that isn't used at runtime in between.
@@ -89,6 +96,7 @@ SECTIONS
#define PT_GNU_EH_FRAME 0x6474e550
#define PT_GNU_STACK 0x6474e551
#define PT_GNU_PROPERTY 0x6474e553
+#define PT_GNU_SFRAME 0x6474e554
/*
* We must supply the ELF program headers explicitly to get just one
@@ -104,6 +112,9 @@ PHDRS
dynamic PT_DYNAMIC PF_R;
note PT_NOTE PF_R;
eh_frame_hdr PT_GNU_EH_FRAME PF_R;
+#ifdef CONFIG_AS_SFRAME
+ sframe PT_GNU_SFRAME PF_R;
+#endif
gnu_stack PT_GNU_STACK PF_RW;
gnu_property PT_GNU_PROPERTY PF_R;
}
diff --git a/arch/x86/entry/vdso/vdso64/Makefile b/arch/x86/entry/vdso/vdso64/Makefile
index bfffaf1aeecc..459f8026531e 100644
--- a/arch/x86/entry/vdso/vdso64/Makefile
+++ b/arch/x86/entry/vdso/vdso64/Makefile
@@ -14,6 +14,7 @@ vobjs-$(CONFIG_X86_SGX) += vsgx.o
# Compilation flags
flags-y := -DBUILD_VDSO64 -m64 -mcmodel=small
+flags-$(CONFIG_AS_SFRAME3) += -Wa,--gsframe-3
# The location of this include matters!
include $(src)/../common/Makefile.include
diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
index 7cc30500c095..90b42367815e 100644
--- a/arch/x86/include/asm/dwarf2.h
+++ b/arch/x86/include/asm/dwarf2.h
@@ -12,8 +12,11 @@
* For the vDSO, emit both runtime unwind information and debug
* symbols for the .dbg file.
*/
-
+#if defined(__x86_64__) && defined(CONFIG_AS_SFRAME)
+ .cfi_sections .eh_frame, .debug_frame, .sframe
+#else
.cfi_sections .eh_frame, .debug_frame
+#endif
#define CFI_STARTPROC .cfi_startproc
#define CFI_ENDPROC .cfi_endproc
--
2.51.0
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO
2026-02-03 17:19 ` [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO Jens Remus
@ 2026-02-04 0:49 ` H. Peter Anvin
2026-02-06 17:48 ` Jens Remus
0 siblings, 1 reply; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-04 0:49 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt
Cc: 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, Borislav Petkov, Dave Hansen, David Hildenbrand,
Liam R. Howlett, Lorenzo Stoakes, Michal Hocko, Mike Rapoport,
Suren Baghdasaryan, Vlastimil Babka, Heiko Carstens,
Vasily Gorbik, Steven Rostedt (Google)
On 2026-02-03 09:19, Jens Remus wrote:
> -
> +#if defined(__x86_64__) && defined(CONFIG_AS_SFRAME)
> + .cfi_sections .eh_frame, .debug_frame, .sframe
> +#else
> .cfi_sections .eh_frame, .debug_frame
> +#endif
>
It would be better to:
#undef CONFIG_AS_SFRAME /* i386 doesn't support .sframe */
in fake_32bit_build.h.
-hpa
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO
2026-02-04 0:49 ` H. Peter Anvin
@ 2026-02-06 17:48 ` Jens Remus
2026-02-06 23:56 ` H. Peter Anvin
0 siblings, 1 reply; 20+ messages in thread
From: Jens Remus @ 2026-02-06 17:48 UTC (permalink / raw)
To: H. Peter Anvin, linux-kernel, linux-trace-kernel, bpf, x86,
linux-mm, Steven Rostedt, Josh Poimboeuf, Indu Bhagat
Cc: Masami Hiramatsu, Mathieu Desnoyers, Peter Zijlstra, Ingo Molnar,
Jiri Olsa, Arnaldo Carvalho de Melo, Namhyung Kim,
Thomas Gleixner, Andrii Nakryiko, Jose E. Marchesi,
Beau Belgrave, Linus Torvalds, Andrew Morton, Florian Weimer,
Kees Cook, Carlos O'Donell, Sam James, Dylan Hatch,
Borislav Petkov, Dave Hansen, David Hildenbrand, Liam R. Howlett,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Suren Baghdasaryan,
Vlastimil Babka, Heiko Carstens, Vasily Gorbik,
Steven Rostedt (Google)
On 2/4/2026 1:49 AM, H. Peter Anvin wrote:
> On 2026-02-03 09:19, Jens Remus wrote:
>> -
>> +#if defined(__x86_64__) && defined(CONFIG_AS_SFRAME)
My understanding is that you would like above changed to:
#ifdef CONFIG_AS_SFRAME
>> + .cfi_sections .eh_frame, .debug_frame, .sframe
>> +#else
>> .cfi_sections .eh_frame, .debug_frame
>> +#endif
>>
>
> It would be better to:
>
> #undef CONFIG_AS_SFRAME /* i386 doesn't support .sframe */
>
> in fake_32bit_build.h.
Due to (binutils 2.46 pre-release) GNU assembler supporting --gsframe-3,
but only for x86-64 not for x86-32 (nor x32) CONFIG_AS_SFRAME is enabled
even for my i386 cross build attempt. This then wrongly causes the
.cfi_sections with .sframe to be selected (verified by adding an #error
for testing).
IIUC the .cfi_sections is there to have DWARF in both .eh_frame and
.debug_frame. For .sframe it basically has the same effect as
specifying the common assembler option --gsframe. Given the more
specific option --gsframe-3 is explicitly specified I think it would
be better to drop the changes to both dwarf2.h and fake_32bit_build.h
and solely rely on --gsframe-3.
Josh, Indu, do you agree?
Thanks and rRegards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO
2026-02-06 17:48 ` Jens Remus
@ 2026-02-06 23:56 ` H. Peter Anvin
2026-02-07 0:48 ` Josh Poimboeuf
0 siblings, 1 reply; 20+ messages in thread
From: H. Peter Anvin @ 2026-02-06 23:56 UTC (permalink / raw)
To: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt, Josh Poimboeuf, Indu Bhagat
Cc: Masami Hiramatsu, Mathieu Desnoyers, Peter Zijlstra, Ingo Molnar,
Jiri Olsa, Arnaldo Carvalho de Melo, Namhyung Kim,
Thomas Gleixner, Andrii Nakryiko, Jose E. Marchesi,
Beau Belgrave, Linus Torvalds, Andrew Morton, Florian Weimer,
Kees Cook, Carlos O'Donell, Sam James, Dylan Hatch,
Borislav Petkov, Dave Hansen, David Hildenbrand, Liam R. Howlett,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Suren Baghdasaryan,
Vlastimil Babka, Heiko Carstens, Vasily Gorbik,
Steven Rostedt (Google)
On February 6, 2026 9:48:24 AM PST, Jens Remus <jremus@linux.ibm.com> wrote:
>On 2/4/2026 1:49 AM, H. Peter Anvin wrote:
>> On 2026-02-03 09:19, Jens Remus wrote:
>>> -
>>> +#if defined(__x86_64__) && defined(CONFIG_AS_SFRAME)
>
>My understanding is that you would like above changed to:
>
>#ifdef CONFIG_AS_SFRAME
>
>>> + .cfi_sections .eh_frame, .debug_frame, .sframe
>>> +#else
>>> .cfi_sections .eh_frame, .debug_frame
>>> +#endif
>>>
>>
>> It would be better to:
>>
>> #undef CONFIG_AS_SFRAME /* i386 doesn't support .sframe */
>>
>> in fake_32bit_build.h.
>Due to (binutils 2.46 pre-release) GNU assembler supporting --gsframe-3,
>but only for x86-64 not for x86-32 (nor x32) CONFIG_AS_SFRAME is enabled
>even for my i386 cross build attempt. This then wrongly causes the
>.cfi_sections with .sframe to be selected (verified by adding an #error
>for testing).
>
>IIUC the .cfi_sections is there to have DWARF in both .eh_frame and
>.debug_frame. For .sframe it basically has the same effect as
>specifying the common assembler option --gsframe. Given the more
>specific option --gsframe-3 is explicitly specified I think it would
>be better to drop the changes to both dwarf2.h and fake_32bit_build.h
>and solely rely on --gsframe-3.
>
>Josh, Indu, do you agree?
>
>Thanks and rRegards,
>Jens
Seems a lot cleaner to me, too, assuming it actually works.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO
2026-02-06 23:56 ` H. Peter Anvin
@ 2026-02-07 0:48 ` Josh Poimboeuf
0 siblings, 0 replies; 20+ messages in thread
From: Josh Poimboeuf @ 2026-02-07 0:48 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Jens Remus, linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt, Indu Bhagat, Masami Hiramatsu, Mathieu Desnoyers,
Peter Zijlstra, Ingo Molnar, Jiri Olsa, Arnaldo Carvalho de Melo,
Namhyung Kim, Thomas Gleixner, Andrii Nakryiko, Jose E. Marchesi,
Beau Belgrave, Linus Torvalds, Andrew Morton, Florian Weimer,
Kees Cook, Carlos O'Donell, Sam James, Dylan Hatch,
Borislav Petkov, Dave Hansen, David Hildenbrand, Liam R. Howlett,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Suren Baghdasaryan,
Vlastimil Babka, Heiko Carstens, Vasily Gorbik,
Steven Rostedt (Google)
On Fri, Feb 06, 2026 at 03:56:59PM -0800, H. Peter Anvin wrote:
> On February 6, 2026 9:48:24 AM PST, Jens Remus <jremus@linux.ibm.com> wrote:
> >On 2/4/2026 1:49 AM, H. Peter Anvin wrote:
> >> On 2026-02-03 09:19, Jens Remus wrote:
> >>> -
> >>> +#if defined(__x86_64__) && defined(CONFIG_AS_SFRAME)
> >
> >My understanding is that you would like above changed to:
> >
> >#ifdef CONFIG_AS_SFRAME
> >
> >>> + .cfi_sections .eh_frame, .debug_frame, .sframe
> >>> +#else
> >>> .cfi_sections .eh_frame, .debug_frame
> >>> +#endif
> >>>
> >>
> >> It would be better to:
> >>
> >> #undef CONFIG_AS_SFRAME /* i386 doesn't support .sframe */
> >>
> >> in fake_32bit_build.h.
> >Due to (binutils 2.46 pre-release) GNU assembler supporting --gsframe-3,
> >but only for x86-64 not for x86-32 (nor x32) CONFIG_AS_SFRAME is enabled
> >even for my i386 cross build attempt. This then wrongly causes the
> >.cfi_sections with .sframe to be selected (verified by adding an #error
> >for testing).
> >
> >IIUC the .cfi_sections is there to have DWARF in both .eh_frame and
> >.debug_frame. For .sframe it basically has the same effect as
> >specifying the common assembler option --gsframe. Given the more
> >specific option --gsframe-3 is explicitly specified I think it would
> >be better to drop the changes to both dwarf2.h and fake_32bit_build.h
> >and solely rely on --gsframe-3.
> >
> >Josh, Indu, do you agree?
> >
> >Thanks and rRegards,
> >Jens
>
> Seems a lot cleaner to me, too, assuming it actually works.
+1
--
Josh
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes
2026-02-03 17:19 [PATCH v7 0/6] x86/vdso: VDSO updates and fixes for sframes Jens Remus
` (5 preceding siblings ...)
2026-02-03 17:19 ` [PATCH v7 6/6] x86/vdso: Enable sframe generation in VDSO Jens Remus
@ 2026-02-06 15:02 ` Jens Remus
6 siblings, 0 replies; 20+ messages in thread
From: Jens Remus @ 2026-02-06 15:02 UTC (permalink / raw)
To: linux-kernel, linux-trace-kernel, bpf, x86, linux-mm,
Steven Rostedt, Josh Poimboeuf, H. Peter Anvin
Cc: 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,
Borislav Petkov, Dave Hansen, David Hildenbrand, Liam R. Howlett,
Lorenzo Stoakes, Michal Hocko, Mike Rapoport, Suren Baghdasaryan,
Vlastimil Babka, Heiko Carstens, Vasily Gorbik
On 2/3/2026 6:19 PM, Jens Remus wrote:
> This enables generation of SFrame V3 stack trace information for VDSO on
> x86-64. It's a continuation of Josh's and Steve's work:
>
> https://lore.kernel.org/all/cover.1737511963.git.jpoimboe@kernel.org/
> https://lore.kernel.org/all/20250422183439.895236512@goodmis.org/
Above is the link to Steven's v5 of the series on which I based my v6:
https://lore.kernel.org/all/20260129112726.892340-1-jremus@linux.ibm.com/
I just realized that Steven's latest version actually was v6:
https://lore.kernel.org/all/20250425023750.669174660@goodmis.org/
That is why I also messed up the series' versioning and erroneously sent
mine as v6 as well. Sorry for that!
I'll incorporate all of the missing original v6 changes and review
feedback into v8. Following is an excerpt from the range-diff between
Steven's v6 and my v6 showing the only missing change in commit subject
of patch 3:
3: 6ce4adda138b ! 3: 9b59e14424b0 x86/asm: Use CFI_* macros in SYM_FUNC_* macros so they can be added to VDSO
@@ Metadata
Author: Josh Poimboeuf <jpoimboe@kernel.org>
## Commit message ##
- x86/asm: Use CFI_* macros in SYM_FUNC_* macros so they can be added to VDSO
+ x86/asm: Simplify VDSO DWARF generation
Add CFI_STARTPROC and CFI_ENDPROC annotations to the SYM_FUNC_* macros
so the VDSO asm functions don't need to add them manually. Note this
only affects VDSO, the CFI_* macros are empty for the kernel proper.
+ [ Jens Remus: Reword commit subject and message as suggested by Josh. ]
+
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
- [ Fixed rebased issues. ]
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+ Signed-off-by: Jens Remus <jremus@linux.ibm.com>
## arch/x86/entry/vdso/vdso-layout.lds.S ##
@@
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@de.ibm.com / jremus@linux.ibm.com
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
^ permalink raw reply [flat|nested] 20+ messages in thread