diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-03-01 09:44:14 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-10-27 14:46:52 +0100 |
commit | 1865211ef5d027f10033397b8c5d46052f069cec (patch) | |
tree | 5833ab089f8747f0eaaaa9354b1b3ec41ecdcae2 /sysdeps | |
parent | 29844295c53af4dae2f88a62464a596414b4d269 (diff) | |
download | glibc-1865211ef5d027f10033397b8c5d46052f069cec.zip glibc-1865211ef5d027f10033397b8c5d46052f069cec.tar.gz glibc-1865211ef5d027f10033397b8c5d46052f069cec.tar.bz2 |
cheri: rseq: remove const to avoid readonly permission
Using const on the definition does not work for a pure capability ABI:
the capability permissions when accessing the object will be read only.
Use a hack to hide the public declaration in the TU where the const
objects are initialized. (This should work on non-capability targets
too, but to err on the safe side only enable the hack on capability
targets.)
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/nptl/dl-tls_init_tp.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index 53fba77..e4d7bb7 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -16,6 +16,15 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ +#ifdef __CHERI_PURE_CAPABILITY__ +/* This hack ensures that the later indirectly included public const + declaration does not conflict with the non-const definition here. */ +# define __rseq_size __rseq_size_public_const +# define __rseq_offset __rseq_offset_public_const +# include <sys/rseq.h> +# undef __rseq_size +# undef __rseq_offset +#endif #include <kernel-features.h> #include <ldsodefs.h> #include <list.h> @@ -45,8 +54,13 @@ rtld_mutex_dummy (pthread_mutex_t *lock) #endif const unsigned int __rseq_flags; +#ifdef __CHERI_PURE_CAPABILITY__ +unsigned int __rseq_size attribute_relro; +ptrdiff_t __rseq_offset attribute_relro; +#else const unsigned int __rseq_size attribute_relro; const ptrdiff_t __rseq_offset attribute_relro; +#endif void __tls_pre_init_tp (void) |