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

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

commit d0cc3969d4982626a4e465ff10d3ae2803662a35
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.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/arm/morello/main] cheri: elf: fix SYMBOL_ADDRESS to return RX derived pointer
@ 2022-10-27 13:58 Szabolcs Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2022-10-27 13:58 UTC (permalink / raw)
  To: glibc-cvs

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.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/arm/morello/main] cheri: elf: fix SYMBOL_ADDRESS to return RX derived pointer
@ 2022-10-26 15:20 Szabolcs Nagy
  0 siblings, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2022-10-26 15:20 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1807fa54edb05736b71efa964826fca288daeec9

commit 1807fa54edb05736b71efa964826fca288daeec9
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.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-23 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23 14:48 [glibc/arm/morello/main] cheri: elf: fix SYMBOL_ADDRESS to return RX derived pointer Szabolcs Nagy
  -- strict thread matches above, loose matches on Subject: below --
2022-10-27 13:58 Szabolcs Nagy
2022-10-26 15:20 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).