Lucene search

K
cvelistLinuxCVELIST:CVE-2024-26992
HistoryMay 01, 2024 - 5:27 a.m.

CVE-2024-26992 KVM: x86/pmu: Disable support for adaptive PEBS

2024-05-0105:27:57
Linux
www.cve.org
cve-2024-26992
linux kernel
vulnerability
kvm
x86/pmu
adaptive pebs
lbr leak
live migration
qemu

7.3 High

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

15.7%

In the Linux kernel, the following vulnerability has been resolved:

KVM: x86/pmu: Disable support for adaptive PEBS

Drop support for virtualizing adaptive PEBS, as KVM’s implementation is
architecturally broken without an obvious/easy path forward, and because
exposing adaptive PEBS can leak host LBRs to the guest, i.e. can leak
host kernel addresses to the guest.

Bug #1 is that KVM doesn’t account for the upper 32 bits of
IA32_FIXED_CTR_CTRL when (re)programming fixed counters, e.g
fixed_ctrl_field() drops the upper bits, reprogram_fixed_counters()
stores local variables as u8s and truncates the upper bits too, etc.

Bug #2 is that, because KVM always sets precise_ip to a non-zero value
for PEBS events, perf will always generate an adaptive record, even if
the guest requested a basic record. Note, KVM will also enable adaptive
PEBS in individual counter, even if adaptive PEBS isn’t exposed to the
guest, but this is benign as MSR_PEBS_DATA_CFG is guaranteed to be zero,
i.e. the guest will only ever see Basic records.

Bug #3 is in perf. intel_pmu_disable_fixed() doesn’t clear the upper
bits either, i.e. leaves ICL_FIXED_0_ADAPTIVE set, and
intel_pmu_enable_fixed() effectively doesn’t clear ICL_FIXED_0_ADAPTIVE
either. I.e. perf always enables ADAPTIVE counters, regardless of what
KVM requests.

Bug #4 is that adaptive PEBS might effectively bypass event filters set
by the host, as “Updated Memory Access Info Group” records information
that might be disallowed by userspace via KVM_SET_PMU_EVENT_FILTER.

Bug #5 is that KVM doesn’t ensure LBR MSRs hold guest values (or at least
zeros) when entering a vCPU with adaptive PEBS, which allows the guest
to read host LBRs, i.e. host RIPs/addresses, by enabling “LBR Entries”
records.

Disable adaptive PEBS support as an immediate fix due to the severity of
the LBR leak in particular, and because fixing all of the bugs will be
non-trivial, e.g. not suitable for backporting to stable kernels.

Note! This will break live migration, but trying to make KVM play nice
with live migration would be quite complicated, wouldn’t be guaranteed to
work (i.e. KVM might still kill/confuse the guest), and it’s not clear
that there are any publicly available VMMs that support adaptive PEBS,
let alone live migrate VMs that support adaptive PEBS, e.g. QEMU doesn’t
support PEBS in any capacity.

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "arch/x86/kvm/vmx/vmx.c"
    ],
    "versions": [
      {
        "version": "c59a1f106f5c",
        "lessThan": "0fb74c00d140",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "c59a1f106f5c",
        "lessThan": "037e48ceccf1",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "c59a1f106f5c",
        "lessThan": "7a7650b3ac23",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "c59a1f106f5c",
        "lessThan": "9e985cbf2942",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "arch/x86/kvm/vmx/vmx.c"
    ],
    "versions": [
      {
        "version": "6.0",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "6.0",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.1.88",
        "lessThanOrEqual": "6.1.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.6.29",
        "lessThanOrEqual": "6.6.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.8.8",
        "lessThanOrEqual": "6.8.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.9",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

7.3 High

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

15.7%