diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2016-03-15 15:42:53 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2016-03-15 15:42:53 +0000 |
commit | 3ef966c4c0b0932cb2296313a9b4b529b9beb431 (patch) | |
tree | 3ee6414e119c0b62b9b270db73ed1f0224769aee /sys/i386 | |
parent | 4e3d35d76e33b4f1c40f312d482b7c3769892304 (diff) | |
download | src-3ef966c4c0b0932cb2296313a9b4b529b9beb431.tar.gz src-3ef966c4c0b0932cb2296313a9b4b529b9beb431.zip |
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
Notes
Notes:
svn path=/head/; revision=296908
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 62e99aa7f2c9..fe6297a8ecd0 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); } |