mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 06:01:53 +02:00
kselftest/arm64: tpidr2: Adjust to new clone() behaviour
In order to fix an ABI problem, we recently changed the way that a clone() syscall manipulates TPIDR2 and PSTATE.ZA. Historically the child would inherit the parent's TPIDR2 value unless CLONE_SETTLS was set, and now the child will inherit the parent's TPIDR2 value unless CLONE_VM is set. Update the tpidr2 test for the new behaviour. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Daniel Kiss <daniel.kiss@arm.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Mark Brown <broonie@kernel.org> Cc: Richard Sandiford <richard.sandiford@arm.com> Cc: Sander De Smalen <sander.desmalen@arm.com> Cc: Tamas Petz <tamas.petz@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Yury Khrustalev <yury.khrustalev@arm.com> Link: https://lore.kernel.org/r/20250508132644.1395904-23-mark.rutland@arm.com Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
78b23877db
commit
be45e63f79
|
|
@ -169,8 +169,10 @@ static int sys_clone(unsigned long clone_flags, unsigned long newsp,
|
|||
child_tidptr);
|
||||
}
|
||||
|
||||
#define __STACK_SIZE (8 * 1024 * 1024)
|
||||
|
||||
/*
|
||||
* If we clone with CLONE_SETTLS then the value in the parent should
|
||||
* If we clone with CLONE_VM then the value in the parent should
|
||||
* be unchanged and the child should start with zero and be able to
|
||||
* set its own value.
|
||||
*/
|
||||
|
|
@ -179,11 +181,19 @@ static int write_clone_read(void)
|
|||
int parent_tid, child_tid;
|
||||
pid_t parent, waiting;
|
||||
int ret, status;
|
||||
void *stack;
|
||||
|
||||
parent = getpid();
|
||||
set_tpidr2(parent);
|
||||
|
||||
ret = sys_clone(CLONE_SETTLS, 0, &parent_tid, 0, &child_tid);
|
||||
stack = malloc(__STACK_SIZE);
|
||||
if (!stack) {
|
||||
putstr("# malloc() failed\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = sys_clone(CLONE_VM, (unsigned long)stack + __STACK_SIZE,
|
||||
&parent_tid, 0, &child_tid);
|
||||
if (ret == -1) {
|
||||
putstr("# clone() failed\n");
|
||||
putnum(errno);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user