From: Samuel Thibault Date: Sat, 17 Jan 2026 14:15:33 +0000 (+0100) Subject: hurd: make __thread_set_pcsptp align stack X-Git-Tag: glibc-2.43~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bbeb1fd13ba4d30cd7ec977e1ab6c22d7bf8b7f;p=thirdparty%2Fglibc.git hurd: make __thread_set_pcsptp align stack When cancelling a thread, __pthread_do_cancel forces calling call_exit, but we need to align down the stack, so any further SSE use can work. --- diff --git a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c index 2cb0ce9838..e11a1f994b 100644 --- a/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c +++ b/sysdeps/mach/hurd/x86_64/htl/pt-machdep.c @@ -24,6 +24,7 @@ #include #include #include +#include #include int @@ -48,7 +49,11 @@ __thread_set_pcsptp (thread_t thread, if (set_sp) state.ursp = (uintptr_t) sp; if (set_ip) - state.rip = (uintptr_t) ip; + { + /* Making it call something else, we have to re-align the stack for SSE. */ + state.ursp = PTR_ALIGN_DOWN_8_16 (state.ursp); + state.rip = (uintptr_t) ip; + } err = __thread_set_state (thread, i386_REGS_SEGS_STATE, (thread_state_t) &state, i386_THREAD_STATE_COUNT);