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-prev] [day] [month] [year] [list]
Message-ID: <aXkLDOM4ZmVfbWiT@google.com>
Date: Tue, 27 Jan 2026 10:59:24 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Chao Gao <chao.gao@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Mathias Krause <minipli@...ecurity.net>, John Allen <john.allen@....com>, 
	Rick Edgecombe <rick.p.edgecombe@...el.com>, Binbin Wu <binbin.wu@...ux.intel.com>, 
	Xiaoyao Li <xiaoyao.li@...el.com>, Jim Mattson <jmattson@...gle.com>
Subject: Re: [PATCH 3/3] KVM: VMX: Print out "bad" offsets+value on VMCS
 config mismatch

On Tue, Jan 27, 2026, Chao Gao wrote:
> On Mon, Jan 26, 2026 at 06:57:26AM -0800, Sean Christopherson wrote:
> >On Fri, Jan 23, 2026, Sean Christopherson wrote:
> >> +			pr_cont("  Offset %lu REF = 0x%08x, CPU%u = 0x%08x, mismatch = 0x%08x\n",
> >> +				i * sizeof(u32), gold[i], cpu, mine[i], gold[i] ^ mine[i]);
> >
> >As pointed out by the kernel bot, sizeof() isn't an unsigned long on 32-bit.
> >Simplest fix is to force it to an int.
> >
> >			pr_cont("  Offset %u REF = 0x%08x, CPU%u = 0x%08x, mismatch = 0x%08x\n",
> >				i * (int)sizeof(u32), gold[i], cpu, mine[i], gold[i] ^ mine[i]);
> 
> Why pr_cont()? The previous line ends with '\n'. so, a plain pr_err() should work.

To avoid the "kvm_intel:" formatting.  E.g. with pr_cont():

[    5.355958] kvm_intel: VMCS config on CPU 0 doesn't match reference config:
[    5.355986]   Offset 76 REF = 0x107fffff, CPU0 = 0x007fffff, mismatch = 0x10000000
[    5.356019]   Offset 84 REF = 0x0010f3ff, CPU0 = 0x0000f3ff, mismatch = 0x00100000
[    5.356048] kvm: enabling virtualization on CPU0 failed


versus with pr_err():

[    6.527945] kvm_intel: VMCS config on CPU 0 doesn't match reference config:
[    6.527979] kvm_intel:   Offset 76 REF = 0x107fffff, CPU0 = 0x007fffff, mismatch = 0x10000000
[    6.528013] kvm_intel:   Offset 84 REF = 0x0010f3ff, CPU0 = 0x0000f3ff, mismatch = 0x00100000
[    6.528048] kvm: enabling virtualization on CPU0 failed

Ugh, but my use of pr_cont() isn't right, because the '\n' resets to KERN_DEFAULT,
i.e. not captured in the above is that the continuations are printed at "warn",
not "err" as intended.

Ah, and fixing that by shoving the newline into pr_cont():

		pr_err("VMCS config on CPU %d doesn't match reference config:", cpu);
		for (i = 0; i < sizeof(struct vmcs_config) / sizeof(u32); i++) {
			if (gold[i] == mine[i])
				continue;

			pr_cont("\n  Offset %u REF = 0x%08x, CPU%u = 0x%08x, mismatch = 0x%08x",
				i * (int)sizeof(u32), gold[i], cpu, mine[i], gold[i] ^ mine[i]);
		}
		pr_cont("\n");


avoids generating new timestamps too, which is even more desirable.

[    5.239320] kvm_intel: VMCS config on CPU 0 doesn't match reference config:
                 Offset 76 REF = 0x107fffff, CPU0 = 0x007fffff, mismatch = 0x10000000
                 Offset 84 REF = 0x0010f3ff, CPU0 = 0x0000f3ff, mismatch = 0x00100000
[    5.239397] kvm: enabling virtualization on CPU0 failed

Unless someone strongly prefers re-printing the timestamp+kvm-intel, I'll go with
the above approach for v2.

Thanks for the reviews!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ