Page MenuHomeFreeBSD

Correct undesirable interaction between caching of %cr4 in bhyve and invltlb_glob().
ClosedPublic

Authored by kib on Apr 19 2018, 11:28 PM.
Tags
None
Referenced Files
F103279484: D15138.diff
Sat, Nov 23, 12:19 AM
Unknown Object (File)
Wed, Nov 13, 7:22 PM
Unknown Object (File)
Tue, Oct 29, 12:10 PM
Unknown Object (File)
Oct 8 2024, 7:47 AM
Unknown Object (File)
Oct 3 2024, 3:55 PM
Unknown Object (File)
Oct 1 2024, 3:13 PM
Unknown Object (File)
Sep 28 2024, 12:08 PM
Unknown Object (File)
Sep 23 2024, 2:31 AM
Subscribers

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 16229

Event Timeline

Update comment (actually commit the last edits).

This looks sensible to me.

This revision is now accepted and ready to land.Apr 20 2018, 5:00 PM
grehan added a subscriber: grehan.

This looks fine, though I'm interested in the circumstances that this can happen - can module-load pre-empt an existing kernel thread that is in the midst of invltlb_glob() ?

This looks fine, though I'm interested in the circumstances that this can happen - can module-load pre-empt an existing kernel thread that is in the midst of invltlb_glob() ?

Yes, exactly. I did not see anything in the vmm.ko load code which disabled preemption, and preemption can happen while pmap does an invalidation in the kernel pmap. We only pin the thread, we do not enter critical section there.

Of course, it is very bad luck to actually get it in real life. I did not, I just read the code.

BTW, there is another similar 'unlikely thing I saw in vmx_support.S. vmx_enter_guest uses stack space below the bottom to form the INVEPT descriptor. Until very recent time, we could get e.g. MCE executed on the thread stack with interrupts disabled. MCE was changed to use IST, but IMO we should be more careful. And, amd64 kernel does not use red zone.

This revision was automatically updated to reflect the committed changes.