diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-07-15 19:33:23 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-10-27 14:46:49 +0100 |
commit | 465880458a62761b9e976e49403485929634ebe9 (patch) | |
tree | 808b599990a651de497fb4fb5d38508979cfd1ba /sysdeps/unix | |
parent | f574dab01e3792fc4337744bf3853f38c15278c5 (diff) | |
download | glibc-465880458a62761b9e976e49403485929634ebe9.tar glibc-465880458a62761b9e976e49403485929634ebe9.tar.gz glibc-465880458a62761b9e976e49403485929634ebe9.tar.bz2 glibc-465880458a62761b9e976e49403485929634ebe9.zip |
TODO(gcc): cheri: work around a gcc bug in _dl_setup_stack_chk_guard
morello purecap gcc in some cases inlines 16byte memcpy as a capability
load, which is wrong if the source or dest may be unaligned.
stack guard only needs random for the address portion since only that
part is compared, so 8 byte is enough with 64 bit addresses, but the
current code is only right on little endian systems.
TODO: drop when gcc is fixed
Diffstat (limited to 'sysdeps/unix')
-rw-r--r-- | sysdeps/unix/sysv/linux/dl-osinfo.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h index 7888915f12..49d8f973c8 100644 --- a/sysdeps/unix/sysv/linux/dl-osinfo.h +++ b/sysdeps/unix/sysv/linux/dl-osinfo.h @@ -34,7 +34,11 @@ _dl_setup_stack_chk_guard (void *dl_random) /* We need in the moment only 8 bytes on 32-bit platforms and 16 bytes on 64-bit platforms. Therefore we can use the data directly and not use the kernel-provided data to seed a PRNG. */ +#ifdef __CHERI_PURE_CAPABILITY__ + memcpy (ret.bytes, dl_random, 8); +#else memcpy (ret.bytes, dl_random, sizeof (ret)); +#endif #if BYTE_ORDER == LITTLE_ENDIAN ret.num &= ~(uintptr_t) 0xff; #elif BYTE_ORDER == BIG_ENDIAN |