From: Uros Bizjak Date: Tue, 9 Sep 2025 16:41:53 +0000 (+0200) Subject: x86_64: Use __seg_fs qualifiers in {STACK, POINTER}_CHK_GUARD macros X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f402c54483bd7686d95df25d072edaf0964cdabe;p=thirdparty%2Fglibc.git x86_64: Use __seg_fs qualifiers in {STACK, POINTER}_CHK_GUARD macros Use the __seg_fs named address space qualifiers to cast reads of the guard values in the TCB as %fs: 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/x86_64/stackguard-macros.h b/sysdeps/x86_64/stackguard-macros.h index 1948800cd0..1d4c620ff1 100644 --- a/sysdeps/x86_64/stackguard-macros.h +++ b/sysdeps/x86_64/stackguard-macros.h @@ -1,11 +1,7 @@ #include #define STACK_CHK_GUARD \ - ({ uintptr_t x; \ - asm ("mov %%fs:%c1, %0" : "=r" (x) \ - : "i" (offsetof (tcbhead_t, stack_guard))); x; }) + (*(uintptr_t __seg_fs *) offsetof (tcbhead_t, stack_guard)) #define POINTER_CHK_GUARD \ - ({ uintptr_t x; \ - asm ("mov %%fs:%c1, %0" : "=r" (x) \ - : "i" (offsetof (tcbhead_t, pointer_guard))); x; }) + (*(uintptr_t __seg_fs *) offsetof (tcbhead_t, pointer_guard))