]> 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>
Fri, 5 Aug 2022 18:45:19 +0000 (19:45 +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 7888915f12ed44f52fad5829966f790a981bab34..b4104e053958291efa33b4eb5c43fb34726f946e 100644 (file)
@@ -48,7 +48,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
 }