git: e0c92dd2b7e6 - main - amd64: initialize td_frame stack area for init(8) main thread
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 26 Mar 2024 02:09:27 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=e0c92dd2b7e62e4f8281c9ad1d31465bb32f9e3b
commit e0c92dd2b7e62e4f8281c9ad1d31465bb32f9e3b
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-03-25 12:10:43 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-03-26 02:01:38 +0000
amd64: initialize td_frame stack area for init(8) main thread
Unitialized td_frame mostly does not matter since all registers are
overwritten on exec to activate init(8). Except PSL_T bit from the
%rflags which might leak into fresh init as garbage, causing spurious
SIGTRAPs delivered to init until first syscall is executed.
Reviewed by: emaste, jhb, jhibbits
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44498
---
sys/kern/init_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 3df4b1edf4a2..3e4f19d655e6 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -784,6 +784,7 @@ start_init(void *dummy)
*/
KASSERT((td->td_pflags & TDP_EXECVMSPC) == 0,
("nested execve"));
+ memset(td->td_frame, 0, sizeof(*td->td_frame));
oldvmspace = p->p_vmspace;
error = kern_execve(td, &args, NULL, oldvmspace);
KASSERT(error != 0,