# CVE-2024-42240: x86/bhi: Avoid warning in \#DB handler due to BHI mitigation

- Priority: **Routine**
- Reason: Not severe (CVSS 5.5, local access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2024-08-07 · Modified: 2026-05-23
- Aliases: UBUNTU-CVE-2024-42240, DEBIAN-CVE-2024-42240
- Record: https://cvemate.com/vulnerability/CVE-2024-42240 · JSON: https://cvemate.com/vulnerability/CVE-2024-42240/json

## Description

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

x86/bhi: Avoid warning in #DB handler due to BHI mitigation

When BHI mitigation is enabled, if SYSENTER is invoked with the TF flag set
then entry_SYSENTER_compat() uses CLEAR_BRANCH_HISTORY and calls the
clear_bhb_loop() before the TF flag is cleared. This causes the #DB handler
(exc_debug_kernel()) to issue a warning because single-step is used outside the
entry_SYSENTER_compat() function.

To address this issue, entry_SYSENTER_compat() should use CLEAR_BRANCH_HISTORY
after making sure the TF flag is cleared.

The problem can be reproduced with the following sequence:

  $ cat sysenter_step.c
  int main()
  { asm("pushf; pop %ax; bts $8,%ax; push %ax; popf; sysenter"); }

  $ gcc -o sysenter_step sysenter_step.c

  $ ./sysenter_step
  Segmentation fault (core dumped)

The program is expected to crash, and the #DB handler will issue a warning.

Kernel log:

  WARNING: CPU: 27 PID: 7000 at arch/x86/kernel/traps.c:1009 exc_debug_kernel+0xd2/0x160
  ...
  RIP: 0010:exc_debug_kernel+0xd2/0x160
  ...
  Call Trace:
  <#DB>
   ? show_regs+0x68/0x80
   ? __warn+0x8c/0x140
   ? exc_debug_kernel+0xd2/0x160
   ? report_bug+0x175/0x1a0
   ? handle_bug+0x44/0x90
   ? exc_invalid_op+0x1c/0x70
   ? asm_exc_invalid_op+0x1f/0x30
   ? exc_debug_kernel+0xd2/0x160
   exc_debug+0x43/0x50
   asm_exc_debug+0x1e/0x40
  RIP: 0010:clear_bhb_loop+0x0/0xb0
  ...
  </#DB>
  <TASK>
   ? entry_SYSENTER_compat_after_hwframe+0x6e/0x8d
  </TASK>

  [ bp: Massage commit message. ]
```

## Signals

- CVSS: 5.5 medium (v3.1, NVD) CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- EPSS: 0.221%, percentile 13.49%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 133)

- debian linux (Debian): \< 6.1.106-1 \| \< 6.9.10-1
- ubuntu linux (Ubuntu): \< 4.4.0-261.295 \| \< 4.15.0-231.243 \| \< 5.4.0-202.222 \| \< 5.15.0-121.131 \| \< 6.8.0-48.48
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): \< 4.4.0-1138.144 \| \< 4.4.0-1176.191 \| \< 4.15.0-1175.188 \| \< 5.4.0-1136.146 \| \< 5.15.0-1069.75 \| \< 6.8.0-1018.20
- ubuntu linux-aws-5.0 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.11 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.13 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.15 (Ubuntu): \< 5.15.0-1069.75~20.04.1
- ubuntu linux-aws-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.3 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.4 (Ubuntu): \< 5.4.0-1136.146~18.04.1
- ubuntu linux-aws-5.8 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.2 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.5 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.8 (Ubuntu): \< 6.8.0-1018.19~22.04.1
- ubuntu linux-aws-fips (Ubuntu): \< 4.15.0-2113.119 \| \< 5.4.0-1136.146+fips1 \| \< 5.15.0-1069.75+fips1
- ubuntu linux-aws-hwe (Ubuntu): \< 4.15.0-1175.188~16.04.1
- ubuntu linux-azure (Ubuntu): \< 4.15.0-1183.198~14.04.1 \| \< 4.15.0-1183.198~16.04.1 \| All versions (No fix recorded) \| \< 5.4.0-1142.149 \| \< 5.15.0-1072.81 \| \< 6.8.0-1017.20
- ubuntu linux-azure-4.15 (Ubuntu): \< 4.15.0-1183.198
- ubuntu linux-azure-5.11 (Ubuntu): All versions (No fix recorded)

## References (first 20 of 38)

- <https://git.kernel.org/stable/c/db56615e96c439e13783d7715330e824b4fd4b84>
- <https://git.kernel.org/stable/c/a765679defe1dc1b8fa01928a6ad6361e72a1364>
- <https://git.kernel.org/stable/c/dae3543db8f0cf8ac1a198c3bb4b6e3c24d576cf>
- <https://git.kernel.org/stable/c/08518d48e5b744620524f0acd7c26c19bda7f513>
- <https://git.kernel.org/stable/c/ac8b270b61d48fcc61f052097777e3b5e11591e0>
- <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>
- <https://ubuntu.com/security/CVE-2024-42240>
- <https://www.cve.org/CVERecord?id=CVE-2024-42240>
- <https://git.kernel.org/linus/ac8b270b61d48fcc61f052097777e3b5e11591e0>
- <https://ubuntu.com/security/notices/USN-7007-1>
- <https://ubuntu.com/security/notices/USN-7009-1>
- <https://ubuntu.com/security/notices/USN-7019-1>
- <https://ubuntu.com/security/notices/USN-7007-2>
- <https://ubuntu.com/security/notices/USN-7007-3>
- <https://ubuntu.com/security/notices/USN-7009-2>
- <https://ubuntu.com/security/notices/USN-7089-1>
- <https://ubuntu.com/security/notices/USN-7090-1>
- <https://ubuntu.com/security/notices/USN-7089-2>
- <https://ubuntu.com/security/notices/USN-7089-3>
- <https://ubuntu.com/security/notices/USN-7095-1>

---

Data as of 2026-12-05T05:33:18.169Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
