arm64: Fix kernel panic in get_arm64_sve during core dump
The coredump logic calls get_arm64_sve twice: once to get the note size,
and once to get the data. The note size calculation depended on the
volatile `PCB_FP_SVEVALID` flag. If this flag was cleared between the
two calls (e.g., due to a context switch clearing the flag to comply
with the ABI), the second call would expect a smaller buffer size than
the first, triggering a KASSERT panic ("invalid size").
Fix this by ensuring the SVE state is saved to the PCB before we decide
whether to use SVE or VFP.
PR: 292195
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D54532
This commit is contained in:
committed by
Andrew Turner
parent
c88f012faa
commit
93d3ac1daa
@@ -934,6 +934,9 @@ get_arm64_sve(struct regset *rs, struct thread *td, void *buf,
|
||||
|
||||
pcb = td->td_pcb;
|
||||
|
||||
if (td == curthread && (pcb->pcb_fpflags & PCB_FP_STARTED) != 0)
|
||||
vfp_save_state(td, pcb);
|
||||
|
||||
/* If there is no SVE support in HW then we don't support NT_ARM_SVE */
|
||||
if (pcb->pcb_sve_len == 0)
|
||||
return (false);
|
||||
@@ -955,9 +958,6 @@ get_arm64_sve(struct regset *rs, struct thread *td, void *buf,
|
||||
KASSERT(*sizep == sizeof(struct svereg_header) + buf_size,
|
||||
("%s: invalid size", __func__));
|
||||
|
||||
if (td == curthread && (pcb->pcb_fpflags & PCB_FP_STARTED) != 0)
|
||||
vfp_save_state(td, pcb);
|
||||
|
||||
header = buf;
|
||||
memset(header, 0, sizeof(*header));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user