arm64: Ensure that thread0's PCB flags are initialized
On arm64, the PCB is stored at the top of the thread stack. For thread0 this comes from the static "initstack" region, which is placed in the .init_pagetable section, which is not part of the BSS and thus doesn't get zeroed by locore. (See the comment in ldscript.arm64.) It is thus possible for the pcb_flags field to be uninitialized, which can result in PCB_SINGLE_STEP being set. Fix this by simply initializing the field. A separate commit will move initstack out of the .init_pagetable section, since it has no reason to be there, but it is preferable to explicitly initialize PCB fields anyway. In particular, regular kernel stacks are not zeroed upon allocation, so we should be consistent here. Reviewed by: andrew MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D39343
This commit is contained in:
parent
e0cac84ae0
commit
b8f88877a5
@ -380,6 +380,7 @@ init_proc0(vm_offset_t kstack)
|
||||
#endif
|
||||
thread0.td_pcb = (struct pcb *)(thread0.td_kstack +
|
||||
thread0.td_kstack_pages * PAGE_SIZE) - 1;
|
||||
thread0.td_pcb->pcb_flags = 0;
|
||||
thread0.td_pcb->pcb_fpflags = 0;
|
||||
thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate;
|
||||
thread0.td_pcb->pcb_vfpcpu = UINT_MAX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user