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] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ff6b4cad51167c6226304483544a6828d3f7e0c.camel@infradead.org>
Date: Thu, 14 Aug 2025 13:13:32 +0200
From: David Woodhouse <dwmw2@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, 
 Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org, "H. Peter Anvin"
 <hpa@...or.com>, "Ahmed S. Darwish" <darwi@...utronix.de>,
 linux-kernel@...r.kernel.org, Konstantin Belousov <kib@....kiev.ua>,  John
 Baldwin <jhb@...ebsd.org>
Subject: Re: [RFC PATCH] x86/bhyve: Detect FreeBSD Bhyve hypervisor

On Thu, 2025-08-14 at 12:15 +0200, Borislav Petkov wrote:
> On Mon, Aug 11, 2025 at 01:16:42PM +0200, David Woodhouse wrote:
> > From: David Woodhouse <dwmw@...zon.co.uk>
> > 
> > This detects the Bhyve hypervisor
> 
> Users of this are?

FreeBSD and Illumos (and some other *BSD) users, presumably?

> Wikipedia says it already supports Linux :-P

It does, but Linux doesn't support *it*. Which mostly didn't matter
because all that's missing was a cosmetic 'Hypervisor detected: Bhyve'
in the kernel log. But now it's no longer just cosmetic because...

> > and enables 15-bit MSI support if available.

I have finally written up some proper documentation for that 15-bit MSI
enlightenment, btw: http://david.woodhou.se/ExtDestId.pdf

> > Signed-off-by: David Woodhouse <dwmw@...zon.co.uk>
> > ---
> > RFC because the CPUID_BHYVE_FEATURES leaf is submitted to FreeBSD in
> 
> Which makes it, what, 0x4000_0001?
> 
> I presume there's an agreement among all the hypervisors...?

There is no such agreement about CPUID; by *coincidence* most of them
seem to use 0x4000_0?01 as their feature leaf, but the feature bits in
each such leaf are completely different and the guest doesn't look at a
given leaf unless it knows that specific hypervisor. Which is why the
15-bit enlightenment is advertised differently by each hypervisor
despite being precisely the same enlightenment across them all.

(Digressing a little... the slight exception is the 0x4000_0010 leaf
which by coincidence I have *also* been looking at this week. VMware
proposed a common convention in https://lkml.org/lkml/2008/10/1/246 but
it was shot down in flames. However, the 'timing info' leaf didn't
quite die, and both XNU and FreeBSD guests actually look for it at
0x4000_0010 under *all* hypervisors. And it even got added in the EC2
Nitro hypervisor. I have patches pending to make KVM support it on both
host and guest side, which I'll post shortly.)

> > https://github.com/freebsd/freebsd-src/pull/1797 and not yet merged.
> > And because I haven't tested this patch at all other than building it.
> > 
> > It's tiny so I didn't put it behind a separate CONFIG_BHYVE_GUEST.
> > Should I?
> 
> Yeah, please do.
> 
> > +/* Features advertised in CPUID_BHYVE_FEATURES %eax */
> > +#define CPUID_BHYVE_FEAT_EXT_DEST_ID	(1UL << 0) /* MSI Extended Dest ID */
> > +
> > +static uint32_t __init bhyve_detect(void)
> > +{
> > +	if (boot_cpu_data.cpuid_level < 0 ||
> > +            !boot_cpu_has(X86_FEATURE_HYPERVISOR))
> 
> cpu_feature_enabled()
> 

Ack, v2 coming up shortly. Thanks.

Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ