mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-27 15:30:07 +00:00
cheri: Setup RX, RW capabilities for static linking
At least tls image access requires RX capability of the main link_map.
This commit is contained in:
parent
a66d563c9e
commit
87dffcda13
@ -263,6 +263,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
|
|||||||
for (int i = 0; i < array_length (auxv_values); ++i)
|
for (int i = 0; i < array_length (auxv_values); ++i)
|
||||||
auxv_values[i] = 0;
|
auxv_values[i] = 0;
|
||||||
_dl_parse_auxv (av, auxv_values);
|
_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
|
#endif
|
||||||
|
|
||||||
|
@ -22,7 +22,12 @@
|
|||||||
#include <ldsodefs.h>
|
#include <ldsodefs.h>
|
||||||
#include <link.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
|
/* Copy the auxiliary vector into AUXV_VALUES and set up GLRO
|
||||||
variables. */
|
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;
|
auxv_values[AT_MINSIGSTKSZ] = CONSTANT_MINSIGSTKSZ;
|
||||||
|
|
||||||
for (; av->a_type != AT_NULL; av++)
|
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;
|
auxv_values[av->a_type] = av->a_un.a_val;
|
||||||
|
|
||||||
GLRO(dl_pagesize) = auxv_values[AT_PAGESZ];
|
GLRO(dl_pagesize) = auxv_values[AT_PAGESZ];
|
||||||
|
Loading…
Reference in New Issue
Block a user