public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/arm/morello/main] cheri: fix SYMBOL_ADDRESS to return RX derived pointer
@ 2022-10-12 14:17 Szabolcs Nagy
  0 siblings, 0 replies; only message in thread
From: Szabolcs Nagy @ 2022-10-12 14:17 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9912e5c608b276588a0e83926353c0632f516a02

commit 9912e5c608b276588a0e83926353c0632f516a02
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Sep 6 09:08:25 2022 +0100

    cheri: 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 9cded5fdbf..3cb35dbb93 100644
--- a/sysdeps/generic/ldsodefs.h
+++ b/sysdeps/generic/ldsodefs.h
@@ -121,13 +121,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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-12 14:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-12 14:17 [glibc/arm/morello/main] cheri: fix SYMBOL_ADDRESS to return RX derived pointer Szabolcs Nagy

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).