lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160715192729.GA4712@fb.com>
Date:	Fri, 15 Jul 2016 15:27:29 -0400
From:	Dave Jones <dsj@...com>
To:	Linux Kernel <linux-kernel@...r.kernel.org>
CC:	Paolo Bonzini <pbonzini@...hat.com>,
	Radim Krčmář <rkrcmar@...hat.com>
Subject: RFC: silencing kvm unimplemented msr spew.

kvm is pretty noisy when you have guests poking at MSRs that the kernel
doesn't implement.  The conveniently named 'ignore_msrs' option initially seemed
like it was what I was looking for, but it changes the printk instead
of eliding it.

Untested patch below converts ignore_msrs to a bitmask and adds an option to be
completely silent. The idea being if after testing, things still work and you
don't care about those messages, you can deploy in production with the silence option.

Would something like this be acceptable ?

	Dave


diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7da5dd2057a9..f9db287118d0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -96,8 +96,12 @@ static void __kvm_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags);
 struct kvm_x86_ops *kvm_x86_ops __read_mostly;
 EXPORT_SYMBOL_GPL(kvm_x86_ops);
 
-static bool __read_mostly ignore_msrs = 0;
-module_param(ignore_msrs, bool, S_IRUGO | S_IWUSR);
+#define UNHANDLED_UNIMPL_MSR 0
+#define IGNORE_UNIMPL_MSR    1
+#define SILENT_UNHANDLED_MSR 2
+#define SILENT_IGNORED_MSR   3
+static int __read_mostly ignore_msrs = UNHANDLED_UNIMPL_MSR;
+module_param(ignore_msrs, int, S_IRUGO | S_IWUSR);
 
 unsigned int min_timer_period_us = 500;
 module_param(min_timer_period_us, uint, S_IRUGO | S_IWUSR);
@@ -2228,15 +2232,22 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 			return xen_hvm_config(vcpu, data);
 		if (kvm_pmu_is_valid_msr(vcpu, msr))
 			return kvm_pmu_set_msr(vcpu, msr_info);
-		if (!ignore_msrs) {
+
+		switch (ignore_msrs) {
+		case UNHANDLED_UNIMPL_MSR:
 			vcpu_unimpl(vcpu, "unhandled wrmsr: 0x%x data %llx\n",
-				    msr, data);
+				msr, data);
+			/* fallthrough */
+		case SILENT_UNHANDLED_MSR:
 			return 1;
-		} else {
+		case IGNORE_UNIMPL_MSR:
 			vcpu_unimpl(vcpu, "ignored wrmsr: 0x%x data %llx\n",
-				    msr, data);
+				msr, data);
+			/* fallthrough */
+		case SILENT_IGNORED_MSR:
 			break;
 		}
+		break;
 	}
 	return 0;
 }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ