From: Uros Bizjak Date: Tue, 9 Sep 2025 16:41:54 +0000 (+0200) Subject: i386: Use __seg_gs qualifiers in {STACK, POINTER}_CHK_GUARD macros X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a076b5c21f05066e079e6a0aa6f73935f9c0e1e;p=thirdparty%2Fglibc.git i386: Use __seg_gs qualifiers in {STACK, POINTER}_CHK_GUARD macros Use the __seg_gs named address space qualifiers to cast reads of the guard values in the TCB as %gs: prefixed addresses. Signed-off-by: Uros Bizjak Cc: H.J.Lu Cc: Florian Weimer Cc: Carlos O'Donell Reviewed-by: H.J. Lu --- diff --git a/sysdeps/i386/stackguard-macros.h b/sysdeps/i386/stackguard-macros.h index 039762927c..574a409584 100644 --- a/sysdeps/i386/stackguard-macros.h +++ b/sysdeps/i386/stackguard-macros.h @@ -1,12 +1,7 @@ #include #define STACK_CHK_GUARD \ - ({ uintptr_t x; asm ("movl %%gs:0x14, %0" : "=r" (x)); x; }) + (*(uintptr_t __seg_gs *) offsetof (tcbhead_t, stack_guard)) #define POINTER_CHK_GUARD \ - ({ \ - uintptr_t x; \ - asm ("movl %%gs:%c1, %0" : "=r" (x) \ - : "i" (offsetof (tcbhead_t, pointer_guard))); \ - x; \ - }) + (*(uintptr_t __seg_gs *) offsetof (tcbhead_t, pointer_guard))