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
This commit is contained in:
Konstantin Belousov 2024-03-25 14:10:43 +02:00
parent 960d151eaa
commit e0c92dd2b7

View file

@ -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,