diff options
author | kib <kib@FreeBSD.org> | 2016-03-15 15:42:53 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2016-03-15 15:42:53 +0000 |
commit | 3d336a82bd544f54ac0afe5755b36affb62c7865 (patch) | |
tree | 3ee6414e119c0b62b9b270db73ed1f0224769aee /sys/i386 | |
parent | 41527ba958fb9ed0eaba4608fbedd17108780626 (diff) | |
download | FreeBSD-src-3d336a82bd544f54ac0afe5755b36affb62c7865.zip FreeBSD-src-3d336a82bd544f54ac0afe5755b36affb62c7865.tar.gz |
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
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 62e99aa..fe6297a 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -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); } |