Skip to content

Commit 781c64b

Browse files
KAGA-KOKOsuryasaimadhu
authored andcommitted
x86/fpu/xstate: Handle supervisor states in XSTATE permissions
The size calculation in __xstate_request_perm() fails to take supervisor states into account because the permission bitmap is only relevant for user states. Up to 5.17 this does not matter because there are no supervisor states supported, but the (re-)enabling of ENQCMD makes them available. Fixes: 7c1ef59 ("x86/cpufeatures: Re-enable ENQCMD") Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7aa5128 commit 781c64b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/x86/kernel/fpu/xstate.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,9 @@ static int __xstate_request_perm(u64 permitted, u64 requested, bool guest)
15711571

15721572
/* Calculate the resulting kernel state size */
15731573
mask = permitted | requested;
1574+
/* Take supervisor states into account on the host */
1575+
if (!guest)
1576+
mask |= xfeatures_mask_supervisor();
15741577
ksize = xstate_calculate_size(mask, compacted);
15751578

15761579
/* Calculate the resulting user state size */

0 commit comments

Comments
 (0)