CVE-2026-142820: kgdb: Fix buffer overflow in the 'm' packet handler

Published Dec 3, 2026
·
Updated

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

kgdb: Fix buffer overflow in the 'm' packet handler

gdbcmdmemread() passes the length of the 'm' packet straight to kgdbmem2hex(), which hex-encodes the reply into remcomoutbuffer[BUFMAX] without checking that the reply fits. A client on the KGDB I/O console can ask for a read of any size, and the hex encoding runs off the end of the buffer. kgdbmem2hex() takes that length as an int count, so 2^31 truncates to a negative value and copyfromkernelnofault() is handed buf + count as its destination.

On x86 BUFMAX is 1024, so a read of 512 bytes overruns by the single byte that terminates the hex string:

BUG: KASAN: global-out-of-bounds in kgdbmem2hex+0x1dd/0x230 Write of size 1 at addr ffffffff87651780 by task sh/1 ... The buggy address belongs to the variable: remcomoutbuffer+0x400/0x420

Bounds check the length before the hex encoding:

if (length > (BUFMAX - 1) / 2) { errorpacket(remcomoutbuffer, -EINVAL); return; }

gdbstubmsgwrite() already bounds the count it hex-encodes against BUFMAX. Reads over the limit never returned valid data, so an error reply loses nothing.

Affected Software

8 affected componentsFixes available
Linux Linux kernel
linux/kernel>=2.6.26<5.10.275
5.10.275
linux/kernel>=5.11.0<5.15.226
5.15.226
linux/kernel>=5.16.0<6.1.193
6.1.193
linux/kernel>=6.2.0<6.6.163
6.6.163
linux/kernel>=6.7.0<6.12.117
6.12.117
linux/kernel>=6.13.0<6.18.63
6.18.63
linux/kernel>=6.19.0<7.3.4
7.3.4

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 5.10.275
  2. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 5.15.226
  3. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.1.193
  4. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.6.163
  5. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.12.117
  6. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 6.18.63
  7. Upgrade

    Upgrade linux/Kernel to a version that resolves this vulnerability.

    Fixed in 7.3.4
  8. Compensating control

    In the KGDB 'm' packet handler, reject reads where length > (BUFMAX - 1) / 2 with -EINVAL before calling kgdb_mem2hex().

Event History

Dec 3, 2026
CVE Published
via MITRE·03:20 AM
Data Sourced
via MITRE·03:20 AM
Description
Data Sourced
via OSV·03:20 AM
DescriptionAffected Software
Data Sourced
via NVD·04:18 AM
Description

Frequently Asked Questions

1

Who can trigger this issue?

A client with access to the KGDB I/O console can send an oversized GDB remote-protocol memory-read request. The issue is in the handling of the 'm' packet.

2

What request sizes are unsafe?

The reply is hex-encoded into a fixed BUFMAX-sized output buffer, so a request is unsafe when its encoded output plus terminator exceeds that buffer. On x86, where BUFMAX is 1024, a 512-byte read overruns the buffer by one byte for the terminating string character.

3

How can I identify a likely occurrence?

On a KASAN-enabled system, the described condition can produce a global-out-of-bounds report in kgdb_mem2hex(), with remcom_out_buffer identified as the affected variable. The provided data does not identify affected kernel versions.

4

What happens to oversized reads after the fix?

Requests whose encoded response would not fit are rejected with an -EINVAL error reply rather than returning memory data. The change notes that reads over this limit did not return valid data previously.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203