The PKRU state size is 4 bytes, its support makes the XSAVE area size
non-multiple of 64 bytes. Thereafter, the user state save area is misaligned, which triggers assertion in the debugging kernels, or segmentation violation on accesses for non-debugging configs. Force the desired alignment of the user save area as the fix (workaround is to disable bit 9 in the hw.xsave_mask loader tunable). This correction is required for booting on the upcoming Intel' Purley platform. Reported and tested by: "Pieper, Jeffrey E" <jeffrey.e.pieper@intel.com>, jimharris Sponsored by: The FreeBSD Foundation MFC after: 3 days
This commit is contained in:
parent
41527ba958
commit
3d336a82bd
@ -102,8 +102,8 @@ get_pcb_user_save_td(struct thread *td)
|
||||
vm_offset_t p;
|
||||
|
||||
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
|
||||
cpu_max_ext_state_size;
|
||||
KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
|
||||
roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
|
||||
KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
|
||||
return ((struct savefpu *)p);
|
||||
}
|
||||
|
||||
@ -122,7 +122,8 @@ get_pcb_td(struct thread *td)
|
||||
vm_offset_t p;
|
||||
|
||||
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
|
||||
cpu_max_ext_state_size - sizeof(struct pcb);
|
||||
roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
|
||||
sizeof(struct pcb);
|
||||
return ((struct pcb *)p);
|
||||
}
|
||||
|
||||
|
@ -127,8 +127,8 @@ get_pcb_user_save_td(struct thread *td)
|
||||
vm_offset_t p;
|
||||
|
||||
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
|
||||
cpu_max_ext_state_size;
|
||||
KASSERT((p % 64) == 0, ("Unaligned pcb_user_save area"));
|
||||
roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN);
|
||||
KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area"));
|
||||
return ((union savefpu *)p);
|
||||
}
|
||||
|
||||
@ -147,7 +147,8 @@ get_pcb_td(struct thread *td)
|
||||
vm_offset_t p;
|
||||
|
||||
p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE -
|
||||
cpu_max_ext_state_size - sizeof(struct pcb);
|
||||
roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) -
|
||||
sizeof(struct pcb);
|
||||
return ((struct pcb *)p);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user