]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86: Simplify stack and pointer guard macros
authorUros Bizjak <ubizjak@gmail.com>
Thu, 25 Sep 2025 07:50:13 +0000 (09:50 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 8 Oct 2025 07:35:15 +0000 (09:35 +0200)
Replace manual casts with a direct `(__tcbhead_t __seg_gs *)0`
dereferences for `stack_guard` and `pointer_guard`.  This makes
the macros more straightforward and removes the dependency on
<stdint.h>.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
sysdeps/i386/stackguard-macros.h
sysdeps/x86_64/stackguard-macros.h

index 574a4095842c28dfa7bf64092dae2c8085f54dc1..2939934ef198d16352fad66ca4d829e2eb2fff6f 100644 (file)
@@ -1,7 +1,3 @@
-#include <stdint.h>
+#define STACK_CHK_GUARD (((tcbhead_t __seg_gs *)0)->stack_guard)
 
-#define STACK_CHK_GUARD \
-  (*(uintptr_t __seg_gs *) offsetof (tcbhead_t, stack_guard))
-
-#define POINTER_CHK_GUARD \
-  (*(uintptr_t __seg_gs *) offsetof (tcbhead_t, pointer_guard))
+#define POINTER_CHK_GUARD (((tcbhead_t __seg_gs *)0)->pointer_guard)
index 1d4c620ff1b86f365e3be60619bd502dee3f95cc..77f13c986d878842543dd0626c7991d3cf0822bc 100644 (file)
@@ -1,7 +1,3 @@
-#include <stdint.h>
+#define STACK_CHK_GUARD (((tcbhead_t __seg_fs *)0)->stack_guard)
 
-#define STACK_CHK_GUARD \
-  (*(uintptr_t __seg_fs *) offsetof (tcbhead_t, stack_guard))
-
-#define POINTER_CHK_GUARD \
-  (*(uintptr_t __seg_fs *) offsetof (tcbhead_t, pointer_guard))
+#define POINTER_CHK_GUARD (((tcbhead_t __seg_fs *)0)->pointer_guard)