public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/arm/morello/main] cheri: elf: fix SYMBOL_ADDRESS to return RX derived pointer Date: Thu, 27 Oct 2022 13:58:43 +0000 (GMT) [thread overview] Message-ID: <20221027135843.75BFA385153C@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=045b941a879b4a62b5b7c3b1bdc1eef269dfbdd2 commit 045b941a879b4a62b5b7c3b1bdc1eef269dfbdd2 Author: Szabolcs Nagy <szabolcs.nagy@arm.com> Date: Tue Sep 6 09:08:25 2022 +0100 cheri: elf: fix SYMBOL_ADDRESS to return RX derived pointer All symbol addresses can be derived from the RX capability of the module (l_map_start). For RW object symbols pointer will have to be rederived from l_rw_start. Diff: --- sysdeps/generic/ldsodefs.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 563b440aab..81b6356460 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -122,13 +122,16 @@ dl_rw_ptr (const struct link_map *l, ElfW(Addr) vaddr) typedef struct link_map *lookup_t; #define LOOKUP_VALUE(map) map #define LOOKUP_VALUE_ADDRESS(map, set) ((set) || (map) ? (map)->l_addr : 0) +#define LOOKUP_VALUE_START(map, set) ((set) || (map) ? (map)->l_map_start : 0) /* Calculate the address of symbol REF using the base address from map MAP, if non-NULL. Don't check for NULL map if MAP_SET is TRUE. */ #define SYMBOL_ADDRESS(map, ref, map_set) \ ((ref) == NULL ? 0 \ - : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? 0 \ - : LOOKUP_VALUE_ADDRESS (map, map_set)) + (ref)->st_value) + : (__glibc_unlikely ((ref)->st_shndx == SHN_ABS) ? (ref)->st_value \ + : dl_get_ptr (LOOKUP_VALUE_START (map, map_set), \ + LOOKUP_VALUE_ADDRESS (map, map_set), \ + (ref)->st_value))) /* Type of a constructor function, in DT_INIT, DT_INIT_ARRAY, DT_PREINIT_ARRAY. */
next reply other threads:[~2022-10-27 13:58 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-27 13:58 Szabolcs Nagy [this message] -- strict thread matches above, loose matches on Subject: below -- 2022-11-23 14:48 Szabolcs Nagy 2022-10-26 15:20 Szabolcs Nagy
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221027135843.75BFA385153C@sourceware.org \ --to=nsz@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).