platform/x86: intel-uncore-freq: Prevent driver loading in guests
Subsystems (2)
Srinivas Pandruvada
maintainerPATCH 1/1 platform/x86: intel-uncore-freq: Prevent driver loading in guests
Loading this driver in guests results in unchecked MSR access error for MSR 0x620.
There is no use of reading and modifying package/die scoped uncore MSRs in guests. So check for CPU feature X86_FEATURE_HYPERVISOR to prevent loading of this driver in guests.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215870
--- drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +3 -0
@@ -212,6 +212,9 @@ static int __init intel_uncore_init(void)const struct x86_cpu_id *id;int ret; +if (cpu_feature_enabled (X86_FEATURE_HYPERVISOR )) +return -ENODEV ; + id =x86_match_cpu (intel_uncore_cpu_ids);if (!id)return -ENODEV ;
Signature · 1 line
2.31.1
Hi,
Quoted 10 lines · Srinivas Pandruvada
Loading this driver in guests results in unchecked MSR access error for MSR
0x620.There is no use of reading and modifying package/die scoped uncore MSRs in guests. So check for CPU feature
X86_FEATURE_HYPERVISORto prevent loading of this driver in guests.Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=215870
Suggested-by Borislav Petkov <[email protected]>Signed-off-by Srinivas Pandruvada <[email protected]>
Thank you for your patch, I've applied this patch to my review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be added to the platform-drivers-x86/for-next branch and eventually will be included in the pdx86 pull-request to Linus for the next merge-window.
Regards,
Hans
Quoted 18 lines
--- drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c | 3 +++ 1 file changed, 3 insertions(+)drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c +3
-0@@ -212,6 +212,9 @@ static int __init intel_uncore_init(void)const struct x86_cpu_id *id;int ret; +if (cpu_feature_enabled (X86_FEATURE_HYPERVISOR )) +return -ENODEV ; + id =x86_match_cpu (intel_uncore_cpu_ids);if (!id)return -ENODEV ;