HomeFreeBSD

arm64: Ensure that thread0's PCB flags are initialized

Description

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

Details

Provenance
markjAuthored on Mar 31 2023, 1:50 PM
Reviewer
andrew
Differential Revision
D39343: arm64: Ensure that thread0's PCB flags are initialized
Parents
rG960562652c7a: linux(4): Fix opt_netlink.h inclusion
Branches
Unknown
Tags
Unknown