aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorSean Christopherson <[email protected]>2024-12-21 01:16:47 +0000
committerSean Christopherson <[email protected]>2025-01-08 22:08:25 +0000
commit4c20cd4cee929aef89118ac8820cefab427c6ae1 (patch)
treeb5a42f0bf35bf9e7d428a58d0e6c69c7fbc66f32 /net/unix/af_unix.c
parentKVM: x86: Use LVT_TIMER instead of an open coded literal (diff)
downloadkernel-4c20cd4cee929aef89118ac8820cefab427c6ae1.tar.gz
kernel-4c20cd4cee929aef89118ac8820cefab427c6ae1.zip
KVM: x86: Avoid double RDPKRU when loading host/guest PKRU
Use the raw wrpkru() helper when loading the guest/host's PKRU on switch to/from guest context, as the write_pkru() wrapper incurs an unnecessary rdpkru(). In both paths, KVM is guaranteed to have performed RDPKRU since the last possible write, i.e. KVM has a fresh cache of the current value in hardware. This effectively restores KVM's behavior to that of KVM prior to commit c806e88734b9 ("x86/pkeys: Provide *pkru() helpers"), which renamed the raw helper from __write_pkru() => wrpkru(), and turned __write_pkru() into a wrapper. Commit 577ff465f5a6 ("x86/fpu: Only write PKRU if it is different from current") then added the extra RDPKRU to avoid an unnecessary WRPKRU, but completely missed that KVM already optimized away pointless writes. Reported-by: Adrian Hunter <[email protected]> Fixes: 577ff465f5a6 ("x86/fpu: Only write PKRU if it is different from current") Signed-off-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
Diffstat (limited to 'net/unix/af_unix.c')
0 files changed, 0 insertions, 0 deletions