mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-12 04:00:17 +00:00
TODO(uapi): cheri: start: restrict auxv capability permissions
TODO: not needed with full pcuabi
This commit is contained in:
parent
df30ef1b0d
commit
e8d0e61aa2
@ -258,7 +258,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
|
||||
|
||||
# ifdef __CHERI_PURE_CAPABILITY__
|
||||
_dl_main_map.l_map_start = auxv_values[AT_CHERI_EXEC_RX_CAP];
|
||||
_dl_main_map.l_map_start = __builtin_cheri_perms_and (_dl_main_map.l_map_start, CAP_PERM_MASK_RX);
|
||||
_dl_main_map.l_rw_start = auxv_values[AT_CHERI_EXEC_RW_CAP];
|
||||
_dl_main_map.l_rw_start = __builtin_cheri_perms_and (_dl_main_map.l_rw_start, CAP_PERM_MASK_RW);
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
@ -1724,9 +1724,11 @@ dl_main (const ElfW(Phdr) *phdr,
|
||||
{
|
||||
case AT_CHERI_EXEC_RX_CAP:
|
||||
main_map->l_map_start = av->a_un.a_val;
|
||||
main_map->l_map_start = __builtin_cheri_perms_and (main_map->l_map_start, CAP_PERM_MASK_RX);
|
||||
break;
|
||||
case AT_CHERI_EXEC_RW_CAP:
|
||||
main_map->l_rw_start = av->a_un.a_val;
|
||||
main_map->l_rw_start = __builtin_cheri_perms_and (main_map->l_rw_start, CAP_PERM_MASK_RW);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
@ -152,6 +152,8 @@ elf_machine_rtld_base_setup (struct link_map *map, void *args)
|
||||
cap_rw = cap_exe_rw;
|
||||
ldso_base = cap_rx; /* Assume load segments start at vaddr 0. */
|
||||
}
|
||||
cap_rx = __builtin_cheri_perms_and (cap_rx, CAP_PERM_MASK_RX);
|
||||
cap_rw = __builtin_cheri_perms_and (cap_rw, CAP_PERM_MASK_RW);
|
||||
map->l_addr = ldso_base;
|
||||
map->l_map_start = cap_rx;
|
||||
map->l_rw_start = cap_rw;
|
||||
|
@ -124,9 +124,11 @@ get_caps (uintptr_t *cap_rx, uintptr_t *cap_rw, const uintptr_t *auxv)
|
||||
return;
|
||||
case AT_CHERI_EXEC_RX_CAP:
|
||||
*cap_rx = auxv[1];
|
||||
*cap_rx = __builtin_cheri_perms_and (*cap_rx, CAP_PERM_MASK_RX);
|
||||
break;
|
||||
case AT_CHERI_EXEC_RW_CAP:
|
||||
*cap_rw = auxv[1];
|
||||
*cap_rw = __builtin_cheri_perms_and (*cap_rw, CAP_PERM_MASK_RW);
|
||||
break;
|
||||
}
|
||||
auxv += 2;
|
||||
|
Loading…
Reference in New Issue
Block a user