[DTrace-devel] [PATCH] libproc: remove const from declarations

Kris Van Hees kris.van.hees at oracle.com
Wed Sep 2 13:57:03 PDT 2020


The r_debug_offsets and link_map_offsets arrays were declared 'const'.
This is causing issues on some newer systems where these arrays are
stored in memory that is marked RO.  Performing memcpy) and memmove()
on these areas triggers on error.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libproc/mkoffsets.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libproc/mkoffsets.sh b/libproc/mkoffsets.sh
index d87265b0..91f85d4e 100755
--- a/libproc/mkoffsets.sh
+++ b/libproc/mkoffsets.sh
@@ -131,8 +131,8 @@ typedef struct rtld_offsets {
 	size_t size[2];
 } rtld_offsets_t;
 
-extern const rtld_offsets_t r_debug_offsets[R_LAST_OFFSET+1];
-extern const rtld_offsets_t link_map_offsets[L_LAST_OFFSET+1];
+extern rtld_offsets_t r_debug_offsets[R_LAST_OFFSET+1];
+extern rtld_offsets_t link_map_offsets[L_LAST_OFFSET+1];
 
 #endif
 EOF
@@ -183,8 +183,8 @@ cat > $INIT <<'EOF'
 #include <string.h>
 #include "rtld_offsets.h"
 
-const rtld_offsets_t r_debug_offsets[R_LAST_OFFSET+1];
-const rtld_offsets_t link_map_offsets[L_LAST_OFFSET+1];
+rtld_offsets_t r_debug_offsets[R_LAST_OFFSET+1];
+rtld_offsets_t link_map_offsets[L_LAST_OFFSET+1];
 static int initialized;
 
 _dt_constructor_(rtld_offsets_init)
-- 
2.28.0




More information about the DTrace-devel mailing list