Skip to content

[Bug]: is_virtual yields true on OpenBSD inside QEMU/Cloud hypervisors #61

@klemensn

Description

@klemensn

Is this a critical security issue?

  • This is not a security issue.

Describe the Bug

is_virtual => false contradicts dmi.manufacturer => QEMU for several VMs I tried.

Two false-positive examples:

$ sysctl hw.{vendor,product,version}
hw.vendor=QEMU
hw.product=Ubuntu 18.04 PC (i440FX + PIIX, 1996)
hw.version=pc-i440fx-bionic

$ facter is_virtual dmi
dmi => {
  bios => {
    vendor => "QEMU",
    version => "pc-i440fx-bionic"
  },
  manufacturer => "QEMU",
  product => {
    name => "Ubuntu 18.04 PC (i440FX + PIIX, 1996)",
    uuid => "869bd75a-4081-5242-ab38-057fe2edfcf8"
  }
}
is_virtual => false
test# sysctl hw.{vendor,product,version}                                       
hw.vendor=Yandex
hw.product=xeon-gold-6338
hw.version=pc-q35-yc-5.0
test# facter is_virtual dmi
dmi => {
  bios => {
    vendor => "Yandex",
    version => "pc-q35-yc-5.0"
  },
  manufacturer => "Yandex",
  product => {
    name => "xeon-gold-6338",
    serial_number => "YC-fv48s2h90civif2uo4qn",
    uuid => "07000023-88fc-a2e0-9032-5f93c5ec1357"
  }
}
is_virtual => false

With OpenBSD's vmm(4) as hypervisor it works already:

test# sysctl hw.{vendor,product,version}
hw.vendor=OpenBSD
hw.product=VMM
sysctl: hw.version: value is not available
test# facter is_virtual dmi              
dmi => {
  bios => {
    vendor => "OpenBSD"
  },
  manufacturer => "OpenBSD",
  product => {
    name => "VMM"
  }
}
is_virtual => true

Expected Behavior

is_virtual should yield true when run inside a VM, at least when obvious indicators like "QEMU" somewhere under dmi show up.

Steps to Reproduce

  • create a VM
  • run facter is_virtual inside

Environment

openfact 5.2.0
OpenBSD 7.8-current

Additional Context

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions