public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/arm/morello/main] cheri: Setup RX, RW capabilities for static linking
@ 2022-10-27 13:55 Szabolcs Nagy
0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-27 13:55 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=be30cd722b60dedd532e7a0e73c3ef377cd263d6
commit be30cd722b60dedd532e7a0e73c3ef377cd263d6
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Wed Sep 7 10:38:29 2022 +0100
cheri: Setup RX, RW capabilities for static linking
At least tls image access requires RX capability of the main link_map.
Diff:
---
elf/dl-support.c | 5 +++++
sysdeps/unix/sysv/linux/dl-parse_auxv.h | 9 +++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 4af0b5b2ce..ffc1d8d01b 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -255,6 +255,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
for (int i = 0; i < array_length (auxv_values); ++i)
auxv_values[i] = 0;
_dl_parse_auxv (av, auxv_values);
+
+# ifdef __CHERI_PURE_CAPABILITY__
+ _dl_main_map.l_map_start = auxv_values[AT_CHERI_EXEC_RX_CAP];
+ _dl_main_map.l_rw_start = auxv_values[AT_CHERI_EXEC_RW_CAP];
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
index 48ca7736a0..a0770b4412 100644
--- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h
+++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
@@ -22,7 +22,12 @@
#include <ldsodefs.h>
#include <link.h>
-typedef elfptr_t dl_parse_auxv_t[AT_MINSIGSTKSZ + 1];
+#ifdef __CHERI_PURE_CAPABILITY__
+# define AT_MAX AT_ENVP
+#else
+# define AT_MAX AT_MINSIGSTKSZ
+#endif
+typedef elfptr_t dl_parse_auxv_t[AT_MAX + 1];
/* Copy the auxiliary vector into AUXV_VALUES and set up GLRO
variables. */
@@ -39,7 +44,7 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values)
auxv_values[AT_MINSIGSTKSZ] = CONSTANT_MINSIGSTKSZ;
for (; av->a_type != AT_NULL; av++)
- if (av->a_type <= AT_MINSIGSTKSZ)
+ if (av->a_type <= AT_MAX)
auxv_values[av->a_type] = av->a_un.a_val;
GLRO(dl_pagesize) = auxv_values[AT_PAGESZ];
^ permalink raw reply [flat|nested] 4+ messages in thread
* [glibc/arm/morello/main] cheri: Setup RX, RW capabilities for static linking
@ 2022-11-23 14:45 Szabolcs Nagy
0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-11-23 14:45 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=90c5142f771b318dc905faf02162a01b8f546460
commit 90c5142f771b318dc905faf02162a01b8f546460
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Wed Sep 7 10:38:29 2022 +0100
cheri: Setup RX, RW capabilities for static linking
At least tls image access requires RX capability of the main link_map.
Diff:
---
elf/dl-support.c | 5 +++++
sysdeps/unix/sysv/linux/dl-parse_auxv.h | 9 +++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 4af0b5b2ce..ffc1d8d01b 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -255,6 +255,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
for (int i = 0; i < array_length (auxv_values); ++i)
auxv_values[i] = 0;
_dl_parse_auxv (av, auxv_values);
+
+# ifdef __CHERI_PURE_CAPABILITY__
+ _dl_main_map.l_map_start = auxv_values[AT_CHERI_EXEC_RX_CAP];
+ _dl_main_map.l_rw_start = auxv_values[AT_CHERI_EXEC_RW_CAP];
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
index 48ca7736a0..a0770b4412 100644
--- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h
+++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
@@ -22,7 +22,12 @@
#include <ldsodefs.h>
#include <link.h>
-typedef elfptr_t dl_parse_auxv_t[AT_MINSIGSTKSZ + 1];
+#ifdef __CHERI_PURE_CAPABILITY__
+# define AT_MAX AT_ENVP
+#else
+# define AT_MAX AT_MINSIGSTKSZ
+#endif
+typedef elfptr_t dl_parse_auxv_t[AT_MAX + 1];
/* Copy the auxiliary vector into AUXV_VALUES and set up GLRO
variables. */
@@ -39,7 +44,7 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values)
auxv_values[AT_MINSIGSTKSZ] = CONSTANT_MINSIGSTKSZ;
for (; av->a_type != AT_NULL; av++)
- if (av->a_type <= AT_MINSIGSTKSZ)
+ if (av->a_type <= AT_MAX)
auxv_values[av->a_type] = av->a_un.a_val;
GLRO(dl_pagesize) = auxv_values[AT_PAGESZ];
^ permalink raw reply [flat|nested] 4+ messages in thread
* [glibc/arm/morello/main] cheri: Setup RX, RW capabilities for static linking
@ 2022-10-26 15:16 Szabolcs Nagy
0 siblings, 0 replies; 4+ messages in thread
From: Szabolcs Nagy @ 2022-10-26 15:16 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=61106ac6c2480e813c9f02aa4c142ca37fe77707
commit 61106ac6c2480e813c9f02aa4c142ca37fe77707
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Wed Sep 7 10:38:29 2022 +0100
cheri: Setup RX, RW capabilities for static linking
At least tls image access requires RX capability of the main link_map.
Diff:
---
elf/dl-support.c | 5 +++++
sysdeps/unix/sysv/linux/dl-parse_auxv.h | 9 +++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 4af0b5b2ce..ffc1d8d01b 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -255,6 +255,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
for (int i = 0; i < array_length (auxv_values); ++i)
auxv_values[i] = 0;
_dl_parse_auxv (av, auxv_values);
+
+# ifdef __CHERI_PURE_CAPABILITY__
+ _dl_main_map.l_map_start = auxv_values[AT_CHERI_EXEC_RX_CAP];
+ _dl_main_map.l_rw_start = auxv_values[AT_CHERI_EXEC_RW_CAP];
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
index 48ca7736a0..a0770b4412 100644
--- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h
+++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
@@ -22,7 +22,12 @@
#include <ldsodefs.h>
#include <link.h>
-typedef elfptr_t dl_parse_auxv_t[AT_MINSIGSTKSZ + 1];
+#ifdef __CHERI_PURE_CAPABILITY__
+# define AT_MAX AT_ENVP
+#else
+# define AT_MAX AT_MINSIGSTKSZ
+#endif
+typedef elfptr_t dl_parse_auxv_t[AT_MAX + 1];
/* Copy the auxiliary vector into AUXV_VALUES and set up GLRO
variables. */
@@ -39,7 +44,7 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values)
auxv_values[AT_MINSIGSTKSZ] = CONSTANT_MINSIGSTKSZ;
for (; av->a_type != AT_NULL; av++)
- if (av->a_type <= AT_MINSIGSTKSZ)
+ if (av->a_type <= AT_MAX)
auxv_values[av->a_type] = av->a_un.a_val;
GLRO(dl_pagesize) = auxv_values[AT_PAGESZ];
^ permalink raw reply [flat|nested] 4+ messages in thread
* [glibc/arm/morello/main] cheri: Setup RX, RW capabilities for static linking
@ 2022-10-12 14:17 Szabolcs Nagy
0 siblings, 0 replies; 4+ messages 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=87dffcda136a7d1b0c0f81ccf9ac084178181321
commit 87dffcda136a7d1b0c0f81ccf9ac084178181321
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date: Wed Sep 7 10:38:29 2022 +0100
cheri: Setup RX, RW capabilities for static linking
At least tls image access requires RX capability of the main link_map.
Diff:
---
elf/dl-support.c | 5 +++++
sysdeps/unix/sysv/linux/dl-parse_auxv.h | 9 +++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 599efb1d08..8551e18eb2 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -263,6 +263,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
for (int i = 0; i < array_length (auxv_values); ++i)
auxv_values[i] = 0;
_dl_parse_auxv (av, auxv_values);
+
+# ifdef __CHERI_PURE_CAPABILITY__
+ _dl_main_map.l_map_start = auxv_values[AT_CHERI_EXEC_RX_CAP];
+ _dl_main_map.l_rw_start = auxv_values[AT_CHERI_EXEC_RW_CAP];
+# endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
index 48ca7736a0..a0770b4412 100644
--- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h
+++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
@@ -22,7 +22,12 @@
#include <ldsodefs.h>
#include <link.h>
-typedef elfptr_t dl_parse_auxv_t[AT_MINSIGSTKSZ + 1];
+#ifdef __CHERI_PURE_CAPABILITY__
+# define AT_MAX AT_ENVP
+#else
+# define AT_MAX AT_MINSIGSTKSZ
+#endif
+typedef elfptr_t dl_parse_auxv_t[AT_MAX + 1];
/* Copy the auxiliary vector into AUXV_VALUES and set up GLRO
variables. */
@@ -39,7 +44,7 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values)
auxv_values[AT_MINSIGSTKSZ] = CONSTANT_MINSIGSTKSZ;
for (; av->a_type != AT_NULL; av++)
- if (av->a_type <= AT_MINSIGSTKSZ)
+ if (av->a_type <= AT_MAX)
auxv_values[av->a_type] = av->a_un.a_val;
GLRO(dl_pagesize) = auxv_values[AT_PAGESZ];
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-23 14:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 13:55 [glibc/arm/morello/main] cheri: Setup RX, RW capabilities for static linking Szabolcs Nagy
-- strict thread matches above, loose matches on Subject: below --
2022-11-23 14:45 Szabolcs Nagy
2022-10-26 15:16 Szabolcs Nagy
2022-10-12 14:17 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).