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 <ubizjak@gmail.com>
Cc: H.J.Lu <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: Carlos O'Donell <carlos@redhat.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
This commit is contained in:
Uros Bizjak 2025-09-09 18:41:53 +02:00 committed by H.J. Lu
parent 4be94f6a9c
commit f402c54483
1 changed files with 2 additions and 6 deletions

View File

@ -1,11 +1,7 @@
#include <stdint.h>
#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))