]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
cheri: don't use dl_random for pointer mangling
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Tue, 1 Mar 2022 17:36:12 +0000 (17:36 +0000)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Thu, 27 Oct 2022 13:46:51 +0000 (14:46 +0100)
Pointer mangling cannot be supported on capability architectures.
And there is not enough bytes in dl_random for 128 bit pointers.

Stack guard is still loaded from dl_random: stack protection is
unlikely to be useful on a capability architecture, but it works.

sysdeps/unix/sysv/linux/dl-osinfo.h

index 49d8f973c81213307a668e4d3cb9b55f8f2bc984..c5d864f5ba97a086bccca31e19040db1c613a54c 100644 (file)
@@ -52,7 +52,12 @@ _dl_setup_stack_chk_guard (void *dl_random)
 static inline uintptr_t __attribute__ ((always_inline))
 _dl_setup_pointer_guard (void *dl_random, uintptr_t stack_chk_guard)
 {
+#ifdef __CHERI_PURE_CAPABILITY__
+  /* Pointer mangling is not supported on capability architectures.  */
+  return 0;
+#else
   uintptr_t ret;
   memcpy (&ret, (char *) dl_random + sizeof (ret), sizeof (ret));
   return ret;
+#endif
 }