Date: Wed, 27 May 2026 14:59:18 +0000 From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Alfredo Mazzinghi <am2419@cl.cam.ac.uk> Subject: git: a1e07f21dc74 - main - arm64: Adjust the kernel stack pointer at the end of fork_trampoline Message-ID: <6a1706c6.22d42.2f82f92c@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a1e07f21dc7458d85bd0d04c294f0389d4591666 commit a1e07f21dc7458d85bd0d04c294f0389d4591666 Author: Alfredo Mazzinghi <am2419@cl.cam.ac.uk> AuthorDate: 2026-04-22 23:46:14 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2026-05-27 13:43:09 +0000 arm64: Adjust the kernel stack pointer at the end of fork_trampoline All other paths that return from the kernel to userspace pop the user trapframe off of the kernel stack pointer before returning to userspace in restore_registers. fork_trampoline was missing this, so all of the user faults after fork pushed another trapframe leaving a trapframe's worth of wasted space on the kstack. This would be fatal after a future change to remove duplicate initialization of td_frame in cpu_fork() as without this fix each time a thread was recycled it would "lose" another trapframe's worth of space. Reviewed by: kib, andrew Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/23 --- sys/arm64/arm64/swtch.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index b3bf88135e57..0cc0d7462ae6 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -276,6 +276,8 @@ ENTRY(fork_trampoline) ldp x26, x27, [sp, #TF_X + 26 * 8] ldp x28, x29, [sp, #TF_X + 28 * 8] + add sp, sp, #(TF_SIZE) + /* * No need for interrupts reenabling since PSR * will be set to the desired value anyway.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a1706c6.22d42.2f82f92c>
