Page MenuHomeFreeBSD

amd64: do not enable PKRU if user disabled saving PKRU register in xsave mask
ClosedPublic

Authored by kib on Jan 27 2023, 10:53 AM.
Tags
None
Referenced Files
F101714958: D38219.id.diff
Sat, Nov 2, 5:28 PM
Unknown Object (File)
Wed, Oct 30, 2:42 PM
Unknown Object (File)
Fri, Oct 18, 11:15 AM
Unknown Object (File)
Tue, Oct 15, 11:52 PM
Unknown Object (File)
Mon, Oct 14, 9:55 PM
Unknown Object (File)
Mon, Oct 14, 2:40 AM
Unknown Object (File)
Sat, Oct 12, 11:05 AM
Unknown Object (File)
Fri, Oct 11, 3:13 AM
Subscribers

Details

Summary
This is done by reverting CR4_PKE bit, because we perform %CR4
initialization in initializecpu(), and the function is called before
xsave_mask is read.  To not redo the whole early initialization
sequence for the corner case, this should be good enough.

Reported by:    jhb

Also

x86: add more definitions for XCR0 bits

This covers all currently defined bits, adding PKRU and TILE.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Jan 27 2023, 10:53 AM
This revision is now accepted and ready to land.Jan 27 2023, 2:44 PM

I think for bhyve I might need to mask PKU as well, but I can deal with that part. bhyve also has to prevent guests from setting the CR4 bit.