diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2021-06-24 13:29:19 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-08-05 19:45:19 +0100 |
commit | d257d001c3f16ccc4e4692201d3c03f67a0a9b18 (patch) | |
tree | 4d496a9a94e531e7046f5a0b5f021d055c4fefb9 | |
parent | 8536404f41d411e2e6deaafdd51c9c6dfb3ba22a (diff) | |
download | glibc-d257d001c3f16ccc4e4692201d3c03f67a0a9b18.tar.gz glibc-d257d001c3f16ccc4e4692201d3c03f67a0a9b18.tar.xz glibc-d257d001c3f16ccc4e4692201d3c03f67a0a9b18.zip |
TODO(l_addr): cheri: in static exe initialize l_addr to a zero capability
The base should be 0, but also a valid capability. Initialize to a zero capability instead of relying on AT_BASE. TODO: this is a hack. we will need stricter bounds and possibly separate l_addr and bounds info.
-rw-r--r-- | elf/dl-support.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c index 4af0b5b2ce..599efb1d08 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -248,6 +248,14 @@ _dl_aux_init (ElfW(auxv_t) *av) GL(dl_sysinfo) = DL_SYSINFO_DEFAULT; #endif +#ifdef __CHERI_PURE_CAPABILITY__ + /* Base is 0 in non-pie static executable, but it needs to be a valid + capability. Use the zero capability instead of AT_BASE. */ + elfptr_t zerocap; + asm volatile ("cvtd %0,xzr" : "=r"(zerocap)); + _dl_main_map.l_addr = zerocap; +#endif + _dl_auxv = av; dl_parse_auxv_t auxv_values; /* Use an explicit initialization loop here because memset may not |