Re: [PATCH 3/4] x86,module: Detect VMX vs SLD conflicts

From: Xiaoyao Li
Date: Tue Apr 07 2020 - 22:10:40 EST


On 4/7/2020 7:02 PM, Peter Zijlstra wrote:
It turns out that with Split-Lock-Detect enabled (default) any VMX
hypervisor needs at least a little modification in order to not blindly
inject the #AC into the guest without the guest being ready for it.

Since there is no telling which module implements a hypervisor, scan
all out-of-tree modules' text and look for VMX instructions and refuse
to load it when SLD is enabled (default) and the module isn't marked
'sld_safe'.

Hypervisors, which have been modified and are known to work correctly,
can add:

MODULE_INFO(sld_safe, "Y");

to explicitly tell the module loader they're good.


I'm thinking that it helps nothing other than telling the possible hypervisors "we have a new feature SLD enabled in kernel, but you seem not aware of it. To avoid something wrong with you and your VMs, you are not allowed to be loaded. Please tell me sld_safe as your assurance to get approval"

It's actually the bug/issue of hypervisor and it does no harm to (host) kernel. We can just leave it to hypervisor developer that they need to fix the bug in their hypervisor.

If we go the way like this patch, then whenever someone reports a similar bug due to new feature introduced and enabled in the future, we add a new xxx_safe module info?