git: 4a5ec55af6d0 - main - amd64: expicitly re-init td_frame in copy_thread()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Aug 2022 18:12:15 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4a5ec55af6d0bfa659f67483e346d55f90ba0856 commit 4a5ec55af6d0bfa659f67483e346d55f90ba0856 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2022-07-21 16:26:26 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-08-02 18:11:09 +0000 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 --- sys/amd64/amd64/vm_machdep.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index c9c498180c7e..cc90e659ff11 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -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.