[COMMITTED] Remove unused THREAD_SET_POINTER_GUARD and THREAD_COPY_POINTER_GUARD
Adhemerval Zanella
adhemerval.zanella@linaro.org
Fri Jun 19 17:25:59 GMT 2026
Commit a5ec880f808ee7268d985bed4f961799bdc0a4bf ("Consolidate pointer
guard to use a relro variable instead of the TCB") moved the pointer
guard to the module-local relro variable __pointer_chk_guard_local and
dropped the THREAD_{SET,COPY}_POINTER_GUARD macros, which are no longer
defined by any target.
Checked on a build for all afftected targets.
---
csu/libc-start.c | 8 --------
elf/rtld.c | 7 -------
elf/rtld_static_init.c | 2 --
manual/llio.texi | 1 -
nptl/pthread_create.c | 5 -----
sysdeps/mach/hurd/init-first.c | 2 +-
6 files changed, 1 insertion(+), 24 deletions(-)
diff --git a/csu/libc-start.c b/csu/libc-start.c
index 1614e932c29..1bd2184e460 100644
--- a/csu/libc-start.c
+++ b/csu/libc-start.c
@@ -51,11 +51,7 @@ extern void __libc_init_first (int argc, char **argv, char **envp);
in thread local area. */
uintptr_t __stack_chk_guard attribute_relro;
# endif
-# ifndef THREAD_SET_POINTER_GUARD
-/* Only exported for architectures that don't store the pointer guard
- value in thread local area. */
uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
-# endif
#endif
#ifndef SHARED
@@ -297,11 +293,7 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL),
/* Set up the pointer guard value. */
uintptr_t pointer_chk_guard = _dl_setup_pointer_guard (_dl_random,
stack_chk_guard);
-# ifdef THREAD_SET_POINTER_GUARD
- THREAD_SET_POINTER_GUARD (pointer_chk_guard);
-# else
__pointer_chk_guard_local = pointer_chk_guard;
-# endif
/* We do not need the _dl_random value anymore. Scrub the AT_RANDOM
bytes and clear the pointer; on targets with an entropy source, refill
diff --git a/elf/rtld.c b/elf/rtld.c
index ebb5446681a..f2be6239b31 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -167,12 +167,8 @@ rtld_hidden_data_def (_dl_argv)
uintptr_t __stack_chk_guard attribute_relro;
#endif
-/* Only exported for architectures that don't store the pointer guard
- value in thread local area. */
uintptr_t __pointer_chk_guard_local attribute_relro attribute_hidden;
-#ifndef THREAD_SET_POINTER_GUARD
strong_alias (__pointer_chk_guard_local, __pointer_chk_guard)
-#endif
/* Check that AT_SECURE=0, or that the passed name does not contain
directories and is not overly long. Reject empty names
@@ -828,9 +824,6 @@ security_init (void)
/* Set up the pointer guard as well, if necessary. */
uintptr_t pointer_chk_guard
= _dl_setup_pointer_guard (_dl_random, stack_chk_guard);
-#ifdef THREAD_SET_POINTER_GUARD
- THREAD_SET_POINTER_GUARD (pointer_chk_guard);
-#endif
__pointer_chk_guard_local = pointer_chk_guard;
/* We do not need the _dl_random value anymore. Scrub the AT_RANDOM
diff --git a/elf/rtld_static_init.c b/elf/rtld_static_init.c
index fecde954407..959a44beb4f 100644
--- a/elf/rtld_static_init.c
+++ b/elf/rtld_static_init.c
@@ -81,7 +81,6 @@ __rtld_static_init (struct link_map *map)
dl->_dl_find_object = _dl_find_object;
dl->_dl_readonly_area = _dl_readonly_area;
-#ifndef THREAD_SET_POINTER_GUARD
extern uintptr_t __pointer_chk_guard_local attribute_hidden;
const ElfW(Sym) *guard_sym
= _dl_lookup_direct (map, "__pointer_chk_guard",
@@ -91,7 +90,6 @@ __rtld_static_init (struct link_map *map)
assert (guard_sym != NULL);
*(uintptr_t *) DL_SYMBOL_ADDRESS (map, guard_sym)
= __pointer_chk_guard_local;
-#endif
__rtld_static_init_arch (map, dl);
}
diff --git a/manual/llio.texi b/manual/llio.texi
index 7094ff4145e..b5c0061b257 100644
--- a/manual/llio.texi
+++ b/manual/llio.texi
@@ -2863,7 +2863,6 @@ aiocb64}, since the LFS transparently replaces the old interface.
@c _dl_deallocate_tls dup
@c munmap ok
@c THREAD_COPY_STACK_GUARD ok
-@c THREAD_COPY_POINTER_GUARD ok
@c atomic_exchange_acquire ok
@c lll_futex_wake ok
@c deallocate_stack @asulock @ascuheap @aculock @acsmem
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 9a0cefb0f5a..fcb06c68c71 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -740,11 +740,6 @@ __pthread_create_2_1 (pthread_t *newthread, const pthread_attr_t *attr,
THREAD_COPY_STACK_GUARD (pd);
#endif
- /* Copy the pointer guard value. */
-#ifdef THREAD_COPY_POINTER_GUARD
- THREAD_COPY_POINTER_GUARD (pd);
-#endif
-
/* Setup tcbhead. */
tls_setup_tcbhead (pd);
diff --git a/sysdeps/mach/hurd/init-first.c b/sysdeps/mach/hurd/init-first.c
index 74517aab674..401088b2c52 100644
--- a/sysdeps/mach/hurd/init-first.c
+++ b/sysdeps/mach/hurd/init-first.c
@@ -38,7 +38,7 @@ extern int __libc_argc attribute_hidden;
extern char **__libc_argv attribute_hidden;
extern char **_dl_argv;
-#if !defined (SHARED) && (defined (THREAD_SET_STACK_GUARD) || defined (THREAD_SET_POINTER_GUARD))
+#if !defined (SHARED) && defined (THREAD_SET_STACK_GUARD)
/* In the static case, we need to set up TLS early so that the stack
protection guard can be read at from TLS by the GCC-generated snippets,
on architectures that store the guard in TLS and not globally. */
--
2.43.0
More information about the Libc-alpha
mailing list