amd64: expicitly re-init td_frame in copy_thread()

Otherwise we are using whatever the value was left from the previous
thread run on kernel entry from usermode. Typically it would be the
desired value as is, but it is not guaranteed.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D35888
This commit is contained in:
Konstantin Belousov 2022-07-21 19:26:26 +03:00
parent b3fd5464a9
commit 4a5ec55af6

View File

@ -170,6 +170,8 @@ copy_thread(struct thread *td1, struct thread *td2)
cpu_max_ext_state_size);
}
td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1;
/*
* Set registers for trampoline to user mode. Leave space for the
* return address on stack. These are the kernel mode register values.