CVE-2026-99980: netdev: Hide the netdev_priv() origin from GCC in netdev_from_priv()

Published Nov 30, 2026
·
Updated

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

netdev: Hide the netdevpriv() origin from GCC in netdevfrompriv()

GCC 15.1 and later can compute an object size of 0 for a pointer that containerof() derives from a pointer into a countedby flexible array member[1]; Clang gets it right. netdevfrompriv() does this with struct netdevice's "priv" array, so when GCC can see that its argument came from netdevpriv(), FORTIFYSOURCE sees a zero-sized netdevice. Since commit 9027497a25e3c ("team: use netdevfrompriv()"), adding a port of another type to a team device can then fail the memcpy() to "dev->broadcast" in teamsetupbyport(), which GCC sees through after inlining teamportadd() into teamaddslave():

memcpy: detected buffer overflow: 4 byte write of buffer size 0 ... kernel BUG at lib/stringhelpers.c:1044! ... Call Trace: <TASK> teamaddslave.cold+0x88/0x201 dosetmaster+0x11c/0x180 dosetlink.isra.0+0x3a4/0x1410

Whether GCC inlines that far depends on the architecture and the configuration. It does on ppc64le, where this was reported, and on x8664 with defconfig plus hardening.config or with Debian's configuration, but not with allmodconfig.

Hide where "priv" came from with OPTIMIZERHIDEVAR(), so GCC sees a netdevice of unknown size whose members have their declared sizes. (An "unknown" size is considered uncheckable by FORTIFY.) FORTIFY still bounds writes to members; only the whole-object size becomes unknown, as it already is for any netdevice pointer GCC can't trace to its allocation. In an extracted PoC, the builtindynamicobjectsize() of "dev->broadcast" for the two types FORTIFY sees, before and after this patch:

GCC 16.2.0 Clang 22 and 24 before after plain pointer, whole object unknown unknown 44 containerof(), whole object 0 unknown 44 containerof(), member 0 32 32

In addition to getting the bogus "0" fixed in GCC, I'll be following up to solve the whole-object visiblity disparity as well.

Build tested with GCC 16.2.0: ARCH=x8664 defconfig with hardening.config, CONFIGNETTEAM=y, and CONFIGNETIPGRE=y; ARCH=arm64 defconfig with hardening.config, CONFIGNETTEAM=y, CONFIGPPP=y, and CONFIGNETAIROHA=m; and drivers/net/team/, drivers/net/ppp/, and drivers/net/ethernet/airoha/ in ARCH=x8664 allmodconfig. Under QEMU, the x8664 kernel hits the BUG above when adding the GRE fallback device "gre0" as a port of a new team device without this patch, and adds it with the patch.

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Compensating control

    In `netdev_from_priv()`, use `OPTIMIZER_HIDE_VAR()` to hide the origin of `priv` from GCC.

Event History

Nov 30, 2026
CVE Published
via MITRE·01:18 PM
Data Sourced
via MITRE·01:18 PM
Description

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