exec: inherit HWCAPs from the parent process
Subsystems (6)
v2 cover exec: inherit HWCAPs from the parent process
This patch series introduces a mechanism to inherit hardware capabilities (AT_HWCAP, AT_HWCAP2, etc.) from a parent process when they have been modified via prctl.
To support C/R operations (snapshots, live migration) in heterogeneous clusters, we must ensure that processes utilize CPU features available on all potential target nodes. To solve this, we need to advertise a common feature set across the cluster.
Initially, a cgroup-based approach was considered, but it was decided that inheriting HWCAPs from a parent process that has set its own auxiliary vector via prctl is a simpler and more flexible solution.
This implementation adds a new mm flag MMF_USER_HWCAP, which is set when the auxiliary vector is modified via prctl(PR_SET_MM_AUXV). When execve() is called, if the current process has MMF_USER_HWCAP set, the HWCAP values are extracted from the current auxiliary vector and inherited by the new process.
The first patch fixes AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4 in binfmt_elf_fdpic and updates AT_VECTOR_SIZE_BASE.
The second patch implements the core inheritance logic in execve().
The third patch adds a selftest to verify that HWCAPs are correctly inherited across execve().
v1: https://lkml.org/lkml/2025/12/5/65
Andrei Vagin (3):
binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4
exec: inherit HWCAPs from the parent process
selftests/exec: add test for HWCAP inheritance
fs/binfmt_elf.c | 8 +- fs/binfmt_elf_fdpic.c | 14 ++- fs/exec.c | 58 +++++++++++ include/linux/auxvec.h | 2 +- include/linux/binfmts.h | 11 ++ include/linux/mm_types.h | 2 + kernel/fork.c | 3 + kernel/sys.c | 5 +- tools/testing/selftests/exec/.gitignore | 1 + tools/testing/selftests/exec/Makefile | 1 + tools/testing/selftests/exec/hwcap_inherit.c | 102 +++++++++++++++++++ 11 files changed, 197 insertions(+), 10 deletions(-) create mode 100644 tools/testing/selftests/exec/hwcap_inherit.c
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
PATCH v2 1/3 binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4
Commit 4e6e8c2b757f ("binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4") added support for AT_HWCAP3 and AT_HWCAP4, but it missed updating the AUX vector size calculation in create_elf_fdpic_tables() and AT_VECTOR_SIZE_BASE in include/linux/auxvec.h.
Similar to the fix for ELF_HWCAP2 in commit c6a09e342f8e ("binfmt_elf_fdpic: fix AUXV size calculation when ELF_HWCAP2 is defined"), this omission leads to a mismatch between the reserved space and the actual number of AUX entries, eventually triggering a kernel BUG_ON(csp != sp).
Fix this by incrementing nitems when ELF_HWCAP3 or ELF_HWCAP4 are defined and updating AT_VECTOR_SIZE_BASE.
--- fs/binfmt_elf_fdpic.c | 6 ++++++ include/linux/auxvec.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
fs/binfmt_elf_fdpic.c +6 -0
@@ -595,6 +595,12 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,#ifdef ELF_HWCAP2 nitems++;#endif +#ifdef ELF_HWCAP3 + nitems++; +#endif +#ifdef ELF_HWCAP4 + nitems++; +#endif csp = sp; sp -= nitems *2 *sizeof (unsigned long );
include/linux/auxvec.h +1 -1
@@ -4,6 +4,6 @@#include <uapi/linux/auxvec.h> -#define AT_VECTOR_SIZE_BASE 22/* NEW_AUX_ENT entries in auxiliary table */ +#define AT_VECTOR_SIZE_BASE 24/* NEW_AUX_ENT entries in auxiliary table */ /* number of "#define AT_.*" above, minus {AT_NULL, AT_IGNORE, AT_NOTELF} */ #endif /* _LINUX_AUXVEC_H */
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
PATCH v2 2/3 exec: inherit HWCAPs from the parent process
In reply to Andrei VaginIntroduces a mechanism to inherit hardware capabilities (AT_HWCAP, AT_HWCAP2, etc.) from a parent process when they have been modified via prctl.
To support C/R operations (snapshots, live migration) in heterogeneous clusters, we must ensure that processes utilize CPU features available on all potential target nodes. To solve this, we need to advertise a common feature set across the cluster.
This patch adds a new mm flag MMF_USER_HWCAP, which is set when the auxiliary vector is modified via prctl(PR_SET_MM, PR_SET_MM_AUXV). When execve() is called, if the current process has MMF_USER_HWCAP set, the HWCAP values are extracted from the current auxiliary vector and stored in the linux_binprm structure. These values are then used to populate the auxiliary vector of the new process, effectively inheriting the hardware capabilities.
The inherited HWCAPs are masked with the hardware capabilities supported by the current kernel to ensure that we don't report more features than actually supported. This is important to avoid unexpected behavior, especially for processes with additional privileges.
--- fs/binfmt_elf.c | 8 +++--- fs/binfmt_elf_fdpic.c | 8 +++--- fs/exec.c | 58 ++++++++++++++++++++++++++++++++++++++++ include/linux/binfmts.h | 11 ++++++++ include/linux/mm_types.h | 2 ++ kernel/fork.c | 3 +++ kernel/sys.c | 5 +++- 7 files changed, 86 insertions(+), 9 deletions(-)
fs/binfmt_elf.c +4 -4
@@ -246,7 +246,7 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,*/ ARCH_DLINFO ;#endif -NEW_AUX_ENT (AT_HWCAP ,ELF_HWCAP ); +NEW_AUX_ENT (AT_HWCAP , bprm->hwcap);NEW_AUX_ENT (AT_PAGESZ ,ELF_EXEC_PAGESIZE );NEW_AUX_ENT (AT_CLKTCK ,CLOCKS_PER_SEC );NEW_AUX_ENT (AT_PHDR , phdr_addr);
@@ -264,13 +264,13 @@ create_elf_tables(struct linux_binprm *bprm, const struct elfhdr *exec,NEW_AUX_ENT (AT_SECURE , bprm->secureexec);NEW_AUX_ENT (AT_RANDOM , (elf_addr_t )(unsigned long )u_rand_bytes);#ifdef ELF_HWCAP2 -NEW_AUX_ENT (AT_HWCAP2 ,ELF_HWCAP2 ); +NEW_AUX_ENT (AT_HWCAP2 , bprm->hwcap2);#endif #ifdef ELF_HWCAP3 -NEW_AUX_ENT (AT_HWCAP3 ,ELF_HWCAP3 ); +NEW_AUX_ENT (AT_HWCAP3 , bprm->hwcap3);#endif #ifdef ELF_HWCAP4 -NEW_AUX_ENT (AT_HWCAP4 ,ELF_HWCAP4 ); +NEW_AUX_ENT (AT_HWCAP4 , bprm->hwcap4);#endif NEW_AUX_ENT (AT_EXECFN , bprm->exec);if (k_platform) {
fs/binfmt_elf_fdpic.c +4 -4
@@ -629,15 +629,15 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,*/ ARCH_DLINFO ;#endif -NEW_AUX_ENT (AT_HWCAP ,ELF_HWCAP ); +NEW_AUX_ENT (AT_HWCAP , bprm->hwcap);#ifdef ELF_HWCAP2 -NEW_AUX_ENT (AT_HWCAP2 ,ELF_HWCAP2 ); +NEW_AUX_ENT (AT_HWCAP2 , bprm->hwcap2);#endif #ifdef ELF_HWCAP3 -NEW_AUX_ENT (AT_HWCAP3 ,ELF_HWCAP3 ); +NEW_AUX_ENT (AT_HWCAP3 , bprm->hwcap3);#endif #ifdef ELF_HWCAP4 -NEW_AUX_ENT (AT_HWCAP4 ,ELF_HWCAP4 ); +NEW_AUX_ENT (AT_HWCAP4 , bprm->hwcap4);#endif NEW_AUX_ENT (AT_PAGESZ ,PAGE_SIZE );NEW_AUX_ENT (AT_CLKTCK ,CLOCKS_PER_SEC );
fs/exec.c +58 -0
76 lines not on this page · raw message
include/linux/binfmts.h +11 -0
@@ -2,6 +2,7 @@#ifndef _LINUX_BINFMTS_H#define _LINUX_BINFMTS_H +#include <linux/elf.h> #include <linux/sched.h> #include <linux/unistd.h> #include <asm/exec.h>
@@ -67,6 +68,16 @@ struct linux_binprm {unsigned long exec;struct rlimit rlim_stack;/* Saved RLIMIT_STACK used during exec. */ +unsigned long hwcap; +#ifdef ELF_HWCAP2 +unsigned long hwcap2; +#endif +#ifdef ELF_HWCAP3 +unsigned long hwcap3; +#endif +#ifdef ELF_HWCAP4 +unsigned long hwcap4; +#endif char buf[BINPRM_BUF_SIZE ]; } __randomize_layout;
include/linux/mm_types.h +2 -0
@@ -1862,6 +1862,8 @@ enum {#define MMF_TOPDOWN 31/* mm searches top down by default */ #define MMF_TOPDOWN_MASK BIT(MMF_TOPDOWN) +#define MMF_USER_HWCAP 32/* user-defined HWCAPs */ +#define MMF_INIT_LEGACY_MASK (MMF_DUMPABLE_MASK | MMF_DUMP_FILTER_MASK |\ MMF_DISABLE_THP_MASK | MMF_HAS_MDWE_MASK |\ MMF_VM_MERGE_ANY_MASK | MMF_TOPDOWN_MASK)
kernel/fork.c +3 -0
@@ -1103,6 +1103,9 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,__mm_flags_overwrite_word (mm,mmf_init_legacy_flags (flags)); mm->def_flags = current->mm->def_flags &VM_INIT_DEF_MASK ; + +if (mm_flags_test (MMF_USER_HWCAP , current->mm)) +mm_flags_set (MMF_USER_HWCAP , mm); }else {__mm_flags_overwrite_word (mm, default_dump_filter); mm->def_flags =0 ;
kernel/sys.c +4 -1
@@ -2157,8 +2157,10 @@ static int prctl_set_mm_map(int opt, const void __user *addr, unsigned long data* not introduce additional locks here making the kernel * more complex. */ -if (prctl_map.auxv_size) +if (prctl_map.auxv_size) {memcpy (mm->saved_auxv, user_auxv,sizeof (user_auxv)); +mm_flags_set (MMF_USER_HWCAP , current->mm); + }mmap_read_unlock (mm);return 0 ;
@@ -2191,6 +2193,7 @@ static int prctl_set_auxv(struct mm_struct *mm, unsigned long addr,task_lock (current);memcpy (mm->saved_auxv, user_auxv, len);task_unlock (current); +mm_flags_set (MMF_USER_HWCAP , current->mm);return 0 ; }
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
PATCH v2 3/3 selftests/exec: add test for HWCAP inheritance
In reply to Andrei VaginVerify that HWCAPs are correctly inherited/preserved across execve() when modified via prctl(PR_SET_MM_AUXV).
The test performs the following steps:
* reads the current AUXV using prctl(PR_GET_AUXV);
* finds an HWCAP entry and toggles its most significant bit;
* replaces the AUXV of the current process with the modified one using prctl(PR_SET_MM, PR_SET_MM_AUXV);
* executes itself to verify that the new program sees the modified HWCAP value.
--- tools/testing/selftests/exec/.gitignore | 1 + tools/testing/selftests/exec/Makefile | 1 + tools/testing/selftests/exec/hwcap_inherit.c | 104 +++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 tools/testing/selftests/exec/hwcap_inherit.c
tools/testing/selftests/exec/.gitignore +1 -0
@@ -19,3 +19,4 @@ null-argv xxxxxxxx* pipe S_I*.test +hwcap_inherit
tools/testing/selftests/exec/Makefile +1 -0
@@ -20,6 +20,7 @@ TEST_FILES := Makefile TEST_GEN_PROGS += recursion-depth TEST_GEN_PROGS += null-argv TEST_GEN_PROGS += check-exec +TEST_GEN_PROGS += hwcap_inherit EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \ $(OUTPUT)/S_I*.test
tools/testing/selftests/exec/hwcap_inherit.c new file +104 -0
104 lines not on this page · raw message
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
Re: [PATCH 1/3] binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4
In reply to Andrei VaginQuoted 9 lines · Andrei Vagin
Commit
4e6e8c2b757f("binfmt_elf: Wire upAT_HWCAP3atAT_HWCAP4") added support forAT_HWCAP3andAT_HWCAP4, but it missed updating the AUX vector size calculation increate_elf_fdpic_tables()andAT_VECTOR_SIZE_BASEininclude/linux/auxvec.h.Similar to the fix for
ELF_HWCAP2in commitc6a09e342f8e("binfmt_elf_fdpic: fix AUXV size calculation whenELF_HWCAP2is defined"), this omission leads to a mismatch between the reserved space and the actual number of AUX entries, eventually triggering a kernelBUG_ON(csp != sp).
Sorry, missed fdpic here:
Re: [PATCH 1/3] binfmt_elf_fdpic: fix AUXV size calculation for ELF_HWCAP3 and ELF_HWCAP4
In reply to Andrei VaginQuoted 13 lines · Andrei Vagin
Commit
4e6e8c2b757f("binfmt_elf: Wire upAT_HWCAP3atAT_HWCAP4") added support forAT_HWCAP3andAT_HWCAP4, but it missed updating the AUX vector size calculation increate_elf_fdpic_tables()andAT_VECTOR_SIZE_BASEininclude/linux/auxvec.h.Similar to the fix for
ELF_HWCAP2in commitc6a09e342f8e("binfmt_elf_fdpic: fix AUXV size calculation whenELF_HWCAP2is defined"), this omission leads to a mismatch between the reserved space and the actual number of AUX entries, eventually triggering a kernelBUG_ON(csp != sp).Fix this by incrementing nitems when
ELF_HWCAP3orELF_HWCAP4are defined and updatingAT_VECTOR_SIZE_BASE.
Quoted 8 lines
Cc Mark Brown <[email protected]>Cc Max Filippov <[email protected]>Fixes 4e6e8c2b757f ("binfmt_elf: Wire up AT_HWCAP3 at AT_HWCAP4")Signed-off-by Andrei Vagin <[email protected]>--- fs/binfmt_elf_fdpic.c | 6 ++++++ include/linux/auxvec.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)
Good catch.
Quoted 7 lines · Andrei Vagin
fs/exec.c +3
-0@@ -1780,6 +1791,50 @@ static int bprm_execve(struct linux_binprm *bprm)return retval; } +static void inherit_hwcap (struct linux_binprm *bprm) +{ +int i, n;
fs/exec.c static int bprm_execve(struct linux_binprm *bprm) · line 1806
Quoted 10 lines
fs/exec.c +10
-0+ +#ifdef ELF_HWCAP4 + n =4 ; +#elif defined(ELF_HWCAP3 ) + n =3 ; +#elif defined(ELF_HWCAP2 ) + n =2 ; +#else + n =1 ; +#endif
Is it guaranteed that HWCAP n+1 exists only when n does? (To make this work.)
Quoted 19 lines
fs/exec.c +19
-0+ +for (i =0 ; n && i <AT_VECTOR_SIZE ; i +=2 ) { +long val = current->mm->saved_auxv[i +1 ]; + +switch (current->mm->saved_auxv[i]) { +case AT_HWCAP : + bprm->hwcap = val &ELF_HWCAP ; +break ; +#ifdef ELF_HWCAP2 +case AT_HWCAP2 : + bprm->hwcap2 = val &ELF_HWCAP2 ; +break ; +#endif +#ifdef ELF_HWCAP3 +case AT_HWCAP3 : + bprm->hwcap3 = val &ELF_HWCAP3 ; +break ; +#endif +#ifdef ELF_HWCAP4
fs/exec.c static int bprm_execve(struct linux_binprm *bprm) · line 1835
Quoted 10 lines
fs/exec.c +10
-0+case AT_HWCAP4 : + bprm->hwcap4 = val &ELF_HWCAP4 ; +break ; +#endif +default : +continue ; + } + n--; + } +mm_flags_set (MMF_USER_HWCAP , bprm->mm);
Will this work when mm->saved_auxv isn't set by the prctl (it is zeroes?)?
Thanks,
Michal
Quoted 2 lines · Michal Koutný
On Thu, Jan 08, 2026 at 05:07:47AM +0000, Andrei Vagin <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
fs/exec.c +0
-0@@ -1780,6 +1791,50 @@ static int bprm_execve(struct linux_binprm *bprm)return retval; }
Quoted 16 lines
fs/exec.c static int bprm_execve(struct linux_binprm *bprm) · line 1806
Quoted 13 lines
fs/exec.c +13
-0+static void inherit_hwcap (struct linux_binprm *bprm) +{ +int i, n; + +#ifdef ELF_HWCAP4 + n =4 ; +#elif defined(ELF_HWCAP3 ) + n =3 ; +#elif defined(ELF_HWCAP2 ) + n =2 ; +#else + n =1 ; +#endif Is it guaranteed that HWCAP n+1 exists only when n does? (To make this work.)
It is just a small optimization to stop iterating after handling all entries.
Quoted 25 lines
Quoted 25 lines
fs/exec.c +24
-0+ +for (i =0 ; n && i <AT_VECTOR_SIZE ; i +=2 ) { +long val = current->mm->saved_auxv[i +1 ]; + +switch (current->mm->saved_auxv[i]) { +case AT_HWCAP : + bprm->hwcap = val &ELF_HWCAP ; +break ; +#ifdef ELF_HWCAP2 +case AT_HWCAP2 : + bprm->hwcap2 = val &ELF_HWCAP2 ; +break ; +#endif +#ifdef ELF_HWCAP3 +case AT_HWCAP3 : + bprm->hwcap3 = val &ELF_HWCAP3 ; +break ; +#endif +#ifdef ELF_HWCAP4 +case AT_HWCAP4 : + bprm->hwcap4 = val &ELF_HWCAP4 ; +break ; +#endif +default :
Quoted 8 lines
fs/exec.c static int bprm_execve(struct linux_binprm *bprm) · line 1835
Quoted 5 lines
fs/exec.c +5
-0+continue ; + } + n--; + } +mm_flags_set (MMF_USER_HWCAP , bprm->mm);Will this work when
mm->saved_auxvisn't set by the prctl (it is zeroes?)?
The inherit_hwcap function is only called if MMF_USER_HWCAP is set (auxv was modified via prctl). However, even if mm->saved_auxv hasn't been modified, it still
contains valid values.
Thanks,
Andrei
Quoted 6 lines · Michal Koutný
Quoted 4 lines · Andrei Vagin
fs/exec.c +0
-0@@ -1780,6 +1791,50 @@ static int bprm_execve(struct linux_binprm *bprm)return retval; }
Quoted 17 lines
fs/exec.c static int bprm_execve(struct linux_binprm *bprm) · line 1806
Quoted 13 lines
fs/exec.c +13
-0+static void inherit_hwcap (struct linux_binprm *bprm) +{ +int i, n; + +#ifdef ELF_HWCAP4 + n =4 ; +#elif defined(ELF_HWCAP3 ) + n =3 ; +#elif defined(ELF_HWCAP2 ) + n =2 ; +#else + n =1 ; +#endif Is it guaranteed that HWCAP n+1 exists only when n does? (To make this work.)
It is true for all existing arch-es. I can't imagine why we would want to define ELF_HWCAP{n+1} without having ELF_HWCAP{n}. If you think we need to handle this case, I can address it in the next version.
It is just a small optimization to stop iterating after handling all entries. The code will work correctly even when HWCAP n+1 exists but n doesn't.
Quoted 25 lines
Quoted 25 lines
fs/exec.c +24
-0+ +for (i =0 ; n && i <AT_VECTOR_SIZE ; i +=2 ) { +long val = current->mm->saved_auxv[i +1 ]; + +switch (current->mm->saved_auxv[i]) { +case AT_HWCAP : + bprm->hwcap = val &ELF_HWCAP ; +break ; +#ifdef ELF_HWCAP2 +case AT_HWCAP2 : + bprm->hwcap2 = val &ELF_HWCAP2 ; +break ; +#endif +#ifdef ELF_HWCAP3 +case AT_HWCAP3 : + bprm->hwcap3 = val &ELF_HWCAP3 ; +break ; +#endif +#ifdef ELF_HWCAP4 +case AT_HWCAP4 : + bprm->hwcap4 = val &ELF_HWCAP4 ; +break ; +#endif +default :
Quoted 8 lines
fs/exec.c static int bprm_execve(struct linux_binprm *bprm) · line 1835
Quoted 5 lines
fs/exec.c +5
-0+continue ; + } + n--; + } +mm_flags_set (MMF_USER_HWCAP , bprm->mm);Will this work when
mm->saved_auxvisn't set by the prctl (it is zeroes?)?
The inherit_hwcap function is only called if MMF_USER_HWCAP is set (auxv was modified via prctl). However, even if mm->saved_auxv hasn't been modified, it still
contains valid values.
Thanks,
Andrei
ps: Please ignore the html version I mistakenly sent.
Quoted 7 lines · Andrei Vagin
It is true for all existing arch-es. I can't imagine why we would want to define ELF_HWCAP{n+1} without having ELF_HWCAP{n}. If you think we need to handle this case, I can address it in the next version.
It is just a small optimization to stop iterating after handling all entries. The code will work correctly even when HWCAP n+1 exists but n doesn't.
Indeed (I accidentally ignored the AT_VECTOR_SIZE condition), it turns out no big deal then.
I like that it's not needlessly searched (and copied altogether).
Quoted 3 lines
The
inherit_hwcapfunction is only called ifMMF_USER_HWCAPis set (auxv was modified via prctl). However, even ifmm->saved_auxvhasn't been modified, it still contains valid values.
Hm, bprm_mm_init/mm_alloc/mm_init would tranfser the flag from current, I'm still unclear whether it is necessary here. (It should make no harm though.)
saved_auxv validity seems OK then.
One more thing came up to my mind -- synchronization between prctl'ing and exec'ing threads (I see de_thread() is relatively late after bprm__mm_init()).
Thanks,
Michal
Quoted 14 lines · Michal Koutný
Quoted 7 lines · Andrei Vagin
It is true for all existing arch-es. I can't imagine why we would want to define ELF_HWCAP{n+1} without having ELF_HWCAP{n}. If you think we need to handle this case, I can address it in the next version.
It is just a small optimization to stop iterating after handling all entries. The code will work correctly even when HWCAP n+1 exists but n doesn't.
Indeed (I accidentally ignored the
AT_VECTOR_SIZEcondition), it turns out no big deal then.
I like that it's not needlessly searched (and copied altogether).
Quoted 7 lines
Quoted 3 lines
The
inherit_hwcapfunction is only called ifMMF_USER_HWCAPis set (auxv was modified via prctl). However, even ifmm->saved_auxvhasn't been modified, it still contains valid values.Hm, bprm_mm_init/mm_alloc/mm_init would tranfser the flag from current, I'm still unclear whether it is necessary here. (It should make no harm though.)
It is just another optimization. Without this flag, we would need to parse mm->saved_auxv even when it hasn't been changed.
Quoted 6 lines
saved_auxvvalidity seems OK then.One more thing came up to my mind -- synchronization between prctl'ing and exec'ing threads (I see
de_thread()is relatively late afterbprm__mm_init()).
Currently, it is a user responsibility to synchronize these calls. The comment in prctl_set_mm_map states:
Note this update of @saved_auxv is lockless thus
if someone reads this member in procfs while we're updating -- it may get partly updated results. It's known and acceptable trade off: we leave it as is to not introduce additional locks here making the kernel more complex.
Without synchronization between threads calling prctl() and execve(), a new process could be executed with inconsistent HWCAPs. However, this would not trigger any issues within the kernel. If we decide to synchronize access to saved_auxv, we can use mm->arg_lock for that purpose.
Thanks,
Andrei