[glibc] hurd: demangle pointers on fork's longjmp

Samuel Thibault via Glibc-cvs <[email protected]> Tue, 21 Jul 2026 07:16:56 +0000 (GMT)
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a5aa0df24ad61a7dbc0f7c0dc9da7387ec0e974d

commit a5aa0df24ad61a7dbc0f7c0dc9da7387ec0e974d
Author: Samuel Thibault <[email protected]>
Date:   Mon Jul 20 17:10:44 2026 +0200

    hurd: demangle pointers on fork's longjmp
    
    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")

Diff:
---
 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);
 }