[hurd,commited 3/3] hurd: demangle pointers on fork's longjmp

Samuel Thibault <[email protected]> Tue, 21 Jul 2026 09:17:41 +0200
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
The thread state structure requires plain pointers, while the jmpbuf has
mangled pointers.

Fixes 78f1f0e39cd41d28ae771eb3498bc33780c85cfd
("Consolidate the C pointer guard and align the assembly
implementations")
---
 sysdeps/mach/hurd/i386/longjmp-ts.c   | 5 +++++
 sysdeps/mach/hurd/x86_64/longjmp-ts.c | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/sysdeps/mach/hurd/i386/longjmp-ts.c b/sysdeps/mach/hurd/i386/longjmp-ts.c
index a5ad2b5b29..93450e86b4 100644
--- a/sysdeps/mach/hurd/i386/longjmp-ts.c
+++ b/sysdeps/mach/hurd/i386/longjmp-ts.c
@@ -19,6 +19,7 @@
 #include <hurd/signal.h>
 #include <setjmp.h>
 #include <jmpbuf-offsets.h>
+#include <pointer_guard.h>
 #include <mach/thread_status.h>
 
 
@@ -36,4 +37,8 @@ _hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
   ts->uesp = env[0].__jmpbuf[JB_SP];
   ts->eip = env[0].__jmpbuf[JB_PC];
   ts->eax = val ?: 1;
+
+  PTR_DEMANGLE (ts->ebp);
+  PTR_DEMANGLE (ts->uesp);
+  PTR_DEMANGLE (ts->eip);
 }
diff --git a/sysdeps/mach/hurd/x86_64/longjmp-ts.c b/sysdeps/mach/hurd/x86_64/longjmp-ts.c
index 62574e7797..df7d2e4cb7 100644
--- a/sysdeps/mach/hurd/x86_64/longjmp-ts.c
+++ b/sysdeps/mach/hurd/x86_64/longjmp-ts.c
@@ -19,6 +19,7 @@
 #include <hurd/signal.h>
 #include <setjmp.h>
 #include <jmpbuf-offsets.h>
+#include <pointer_guard.h>
 #include <mach/thread_status.h>
 
 
@@ -38,4 +39,8 @@ _hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
   ts->ursp = env[0].__jmpbuf[JB_RSP];
   ts->rip = env[0].__jmpbuf[JB_PC];
   ts->rax = val ?: 1;
+
+  PTR_DEMANGLE (ts->rbp);
+  PTR_DEMANGLE (ts->ursp);
+  PTR_DEMANGLE (ts->rip);
 }
-- 
2.53.0