[glibc] Remove the jmp_buf stack pointer demangle on ABIs that do not mangle it
Adhemerval Zanella via Glibc-cvs <[email protected]> Tue, 16 Jun 2026 18:15:56 +0000 (GMT)
| Newsgroups | gmane.comp.lib.glibc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c626d764d7ea2ffe3e5dd60452435eeaebdf68f6 commit c626d764d7ea2ffe3e5dd60452435eeaebdf68f6 Author: Adhemerval Zanella <[email protected]> Date: Fri Jun 12 13:10:13 2026 -0300 Remove the jmp_buf stack pointer demangle on ABIs that do not mangle it arc, m68k, microblaze, mips, and riscv store the raw stack pointer in setjmp, while their jmpbuf-unwind.h applies PTR_DEMANGLE to it in _jmpbuf_sp. This is currently harmless because these ABIs use the generic pointer_guard.h, where the C PTR_DEMANGLE is a no-op. No functional change. Reviewed-by: DJ Delorie <[email protected]> Diff: --- sysdeps/arc/jmpbuf-unwind.h | 7 +++---- sysdeps/m68k/jmpbuf-unwind.h | 7 +++---- sysdeps/microblaze/jmpbuf-unwind.h | 7 +++---- sysdeps/mips/jmpbuf-unwind.h | 7 +++---- sysdeps/riscv/jmpbuf-unwind.h | 7 +++---- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/sysdeps/arc/jmpbuf-unwind.h b/sysdeps/arc/jmpbuf-unwind.h index d007c78564..48a9f9a7c5 100644 --- a/sysdeps/arc/jmpbuf-unwind.h +++ b/sysdeps/arc/jmpbuf-unwind.h @@ -20,7 +20,6 @@ #include <jmpbuf-offsets.h> #include <stdint.h> #include <unwind.h> -#include <pointer_guard.h> /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ @@ -31,12 +30,12 @@ #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +/* setjmp does not mangle the stack pointer on this ABI, so the saved + value is used as-is. */ static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf jmpbuf) { - uintptr_t sp = jmpbuf[JB_SP]; - PTR_DEMANGLE (sp); - return sp; + return jmpbuf[JB_SP]; } #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ diff --git a/sysdeps/m68k/jmpbuf-unwind.h b/sysdeps/m68k/jmpbuf-unwind.h index 9c5206fb69..2f4bc71d5b 100644 --- a/sysdeps/m68k/jmpbuf-unwind.h +++ b/sysdeps/m68k/jmpbuf-unwind.h @@ -19,7 +19,6 @@ #include <setjmp.h> #include <stdint.h> #include <unwind.h> -#include <pointer_guard.h> /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ @@ -29,12 +28,12 @@ #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +/* setjmp does not mangle the stack pointer on this ABI, so the saved + value is used as-is. */ static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf regs) { - uintptr_t sp = (uintptr_t) regs[0].__sp; - PTR_DEMANGLE (sp); - return sp; + return (uintptr_t) regs[0].__sp; } #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ diff --git a/sysdeps/microblaze/jmpbuf-unwind.h b/sysdeps/microblaze/jmpbuf-unwind.h index cb28dd83ec..9584203257 100644 --- a/sysdeps/microblaze/jmpbuf-unwind.h +++ b/sysdeps/microblaze/jmpbuf-unwind.h @@ -20,7 +20,6 @@ #include <stdint.h> #include <unwind.h> #include <sysdep.h> -#include <pointer_guard.h> /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ @@ -30,12 +29,12 @@ #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +/* setjmp does not mangle the stack pointer on this ABI, so the saved + value is used as-is. */ static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf regs) { - void *sp = (void *) regs[0].__sp; - PTR_DEMANGLE (sp); - return (uintptr_t) sp; + return (uintptr_t) regs[0].__sp; } #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ diff --git a/sysdeps/mips/jmpbuf-unwind.h b/sysdeps/mips/jmpbuf-unwind.h index c213c0a97f..039cad5de8 100644 --- a/sysdeps/mips/jmpbuf-unwind.h +++ b/sysdeps/mips/jmpbuf-unwind.h @@ -19,7 +19,6 @@ #include <stdint.h> #include <unwind.h> #include <sysdep.h> -#include <pointer_guard.h> /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ @@ -31,12 +30,12 @@ (void *) (_Unwind_Ptr) _Unwind_GetCFA (_context), \ _adj) +/* setjmp does not mangle the stack pointer on this ABI, so the saved + value is used as-is. */ static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf regs) { - uintptr_t sp = (uintptr_t) regs[0].__sp; - PTR_DEMANGLE (sp); - return sp; + return (uintptr_t) regs[0].__sp; } #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ diff --git a/sysdeps/riscv/jmpbuf-unwind.h b/sysdeps/riscv/jmpbuf-unwind.h index 1a4de568d2..9676723b57 100644 --- a/sysdeps/riscv/jmpbuf-unwind.h +++ b/sysdeps/riscv/jmpbuf-unwind.h @@ -20,7 +20,6 @@ #include <stdint.h> #include <unwind.h> #include <sysdep.h> -#include <pointer_guard.h> /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ @@ -30,12 +29,12 @@ #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +/* setjmp does not mangle the stack pointer on this ABI, so the saved + value is used as-is. */ static inline uintptr_t __attribute__ ((unused)) _jmpbuf_sp (__jmp_buf regs) { - uintptr_t sp = regs[0].__sp; - PTR_DEMANGLE (sp); - return sp; + return regs[0].__sp; } #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \