kvm: x86: disable the narrow guest module parameter on unload
PATCH 1/1 kvm: x86: disable the narrow guest module parameter on unload
When the kvm_intel module unloads the module parameter 'allow_smaller_maxphyaddr' is not cleared because it is also used in the kvm module. As a result, if the module parameter's state was set before kvm_intel unloads, it will also be set when it reloads. Explicitly clear the state in vmx_exit() to prevent this from happening.
--- arch/x86/kvm/vmx/vmx.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/kvm/vmx/vmx.c +2 -0
@@ -7996,6 +7996,8 @@ static void vmx_exit(void) }#endif vmx_cleanup_l1d_flush (); + + allow_smaller_maxphyaddr = false; }module_exit (vmx_exit);
Signature · 1 line
2.32.0.93.g670b81a890-goog
Quoted 3 lines · Aaron Lewis
When the
kvm_intelmodule unloads the module parameter 'allow_smaller_maxphyaddr' is not cleared because it is also used in the
...because the backing variable is defined in the
(Or something like that.)
Quoted 14 lines
kvm module. As a result, if the module parameter's state was set before
kvm_intelunloads, it will also be set when it reloads. Explicitly clear the state invmx_exit()to prevent this from happening.Signed-off-by Aaron Lewis <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kvm/vmx/vmx.c +0
-0
arch/x86/kvm/vmx/vmx.c static void vmx_exit(void) · line 8002
Quoted 7 lines
arch/x86/kvm/vmx/vmx.c +2
-0@@ -7996,6 +7996,8 @@ static void vmx_exit(void) }#endif vmx_cleanup_l1d_flush (); + + allow_smaller_maxphyaddr = false; }module_exit (vmx_exit);
This seems reasonable to me. Another option is to move the backing variable to the kvm_intel module, given the recent suggestion that it should never be enabled for AMD.
Paolo Bonzini
maintainerQuoted 3 lines · Jim Mattson
This seems reasonable to me. Another option is to move the backing variable to the
kvm_intelmodule, given the recent suggestion that it should never be enabled for AMD.
Why wouldn't it be enabled for shadow paging, since the issue with AMD is specific to the ordering of nested vs. guest page faults?
Paolo
Quoted 17 lines · Aaron Lewis
When the
kvm_intelmodule unloads the module parameter 'allow_smaller_maxphyaddr' is not cleared because it is also used in the kvm module. As a result, if the module parameter's state was set beforekvm_intelunloads, it will also be set when it reloads. Explicitly clear the state invmx_exit()to prevent this from happening.Signed-off-by Aaron Lewis <[email protected]>--- arch/x86/kvm/vmx/vmx.c | 2 ++ 1 file changed, 2 insertions(+)arch/x86/kvm/vmx/vmx.c +0
-0
arch/x86/kvm/vmx/vmx.c static void vmx_exit(void) · line 8003
Quoted 8 lines
arch/x86/kvm/vmx/vmx.c +2
-0@@ -7996,6 +7996,8 @@ static void vmx_exit(void) }#endif vmx_cleanup_l1d_flush (); + + allow_smaller_maxphyaddr = false; }module_exit (vmx_exit);
Queued, thanks.
Paolo