{"id":"CVE-2026-99980","aliases":["CVE-2026-99980"],"related":[],"kind":"vulnerability","state":"published","title":"netdev: Hide the netdev_priv() origin from GCC in netdev_from_priv()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetdev: Hide the netdev_priv() origin from GCC in netdev_from_priv()\n\nGCC 15.1 and later can compute an object size of 0 for a pointer that\ncontainer_of() derives from a pointer into a __counted_by flexible array\nmember[1]; Clang gets it right. netdev_from_priv() does this with struct\nnet_device's \"priv\" array, so when GCC can see that its argument came\nfrom netdev_priv(), FORTIFY_SOURCE sees a zero-sized net_device. Since\ncommit 9027497a25e3c (\"team: use netdev_from_priv()\"), adding a port of\nanother type to a team device can then fail the memcpy() to\n\"dev->broadcast\" in team_setup_by_port(), which GCC sees through after\ninlining team_port_add() into team_add_slave():\n\n  memcpy: detected buffer overflow: 4 byte write of buffer size 0\n  ...\n  kernel BUG at lib/string_helpers.c:1044!\n  ...\n  Call Trace:\n   <TASK>\n   team_add_slave.cold+0x88/0x201\n   do_set_master+0x11c/0x180\n   do_setlink.isra.0+0x3a4/0x1410\n\nWhether GCC inlines that far depends on the architecture and the\nconfiguration. It does on ppc64le, where this was reported, and on\nx86_64 with defconfig plus hardening.config or with Debian's\nconfiguration, but not with allmodconfig.\n\nHide where \"priv\" came from with OPTIMIZER_HIDE_VAR(), so GCC sees a\nnet_device of unknown size whose members have their declared sizes. (An\n\"unknown\" size is considered uncheckable by FORTIFY.)  FORTIFY still\nbounds writes to members; only the whole-object size becomes unknown,\nas it already is for any net_device pointer GCC can't trace to its\nallocation. In an extracted PoC, the __builtin_dynamic_object_size()\nof \"dev->broadcast\" for the two types FORTIFY sees, before and after\nthis patch:\n\n                                   GCC 16.2.0      Clang 22 and 24\n                                 before   after\n  plain pointer, whole object   unknown  unknown        44\n  container_of(), whole object        0  unknown        44\n  container_of(), member              0       32        32\n\nIn addition to getting the bogus \"0\" fixed in GCC, I'll be following up\nto solve the whole-object visiblity disparity as well.\n\nBuild tested with GCC 16.2.0: ARCH=x86_64 defconfig with hardening.config,\nCONFIG_NET_TEAM=y, and CONFIG_NET_IPGRE=y; ARCH=arm64 defconfig with\nhardening.config, CONFIG_NET_TEAM=y, CONFIG_PPP=y, and CONFIG_NET_AIROHA=m;\nand drivers/net/team/, drivers/net/ppp/, and drivers/net/ethernet/airoha/\nin ARCH=x86_64 allmodconfig. Under QEMU, the x86_64 kernel hits the BUG\nabove when adding the GRE fallback device \"gre0\" as a port of a new team\ndevice without this patch, and adds it with the patch.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nnetdev: Hide the netdev_priv() origin from GCC in netdev_from_priv()\n\nGCC 15.1 and later can compute an object size of 0 for a pointer that\ncontainer_of() derives from a pointer into a __counted_by flexible array\nmember[1]; Clang gets it right. netdev_from_priv() does this with struct\nnet_device's \"priv\" array, so when GCC can see that its argument came\nfrom netdev_priv(), FORTIFY_SOURCE sees a zero-sized net_device. Since\ncommit 9027497a25e3c (\"team: use netdev_from_priv()\"), adding a port of\nanother type to a team device can then fail the memcpy() to\n\"dev->broadcast\" in team_setup_by_port(), which GCC sees through after\ninlining team_port_add() into team_add_slave():\n\n  memcpy: detected buffer overflow: 4 byte write of buffer size 0\n  ...\n  kernel BUG at lib/string_helpers.c:1044!\n  ...\n  Call Trace:\n   <TASK>\n   team_add_slave.cold+0x88/0x201\n   do_set_master+0x11c/0x180\n   do_setlink.isra.0+0x3a4/0x1410\n\nWhether GCC inlines that far depends on the architecture and the\nconfiguration. It does on ppc64le, where this was reported, and on\nx86_64 with defconfig plus hardening.config or with Debian's\nconfiguration, but not with allmodconfig.\n\nHide where \"priv\" came from with OPTIMIZER_HIDE_VAR(), so GCC sees a\nnet_device of unknown size whose members have their declared sizes. (An\n\"unknown\" size is considered uncheckable by FORTIFY.)  FORTIFY still\nbounds writes to members; only the whole-object size becomes unknown,\nas it already is for any net_device pointer GCC can't trace to its\nallocation. In an extracted PoC, the __builtin_dynamic_object_size()\nof \"dev->broadcast\" for the two types FORTIFY sees, before and after\nthis patch:\n\n                                   GCC 16.2.0      Clang 22 and 24\n                                 before   after\n  plain pointer, whole object   unknown  unknown        44\n  container_of(), whole object        0  unknown        44\n  container_of(), member              0       32        32\n\nIn addition to getting the bogus \"0\" fixed in GCC, I'll be following up\nto solve the whole-object visiblity disparity as well.\n\nBuild tested with GCC 16.2.0: ARCH=x86_64 defconfig with hardening.config,\nCONFIG_NET_TEAM=y, and CONFIG_NET_IPGRE=y; ARCH=arm64 defconfig with\nhardening.config, CONFIG_NET_TEAM=y, CONFIG_PPP=y, and CONFIG_NET_AIROHA=m;\nand drivers/net/team/, drivers/net/ppp/, and drivers/net/ethernet/airoha/\nin ARCH=x86_64 allmodconfig. Under QEMU, the x86_64 kernel hits the BUG\nabove when adding the GRE fallback device \"gre0\" as a port of a new team\ndevice without this patch, and adds it with the patch.","source":"cvelist"}],"published":"2026-11-30T13:18:50.711Z","modified":"2026-11-30T14:20:41.003Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"9027497a25e3c92b5053b2643e0c18f910865625","fixed":"964b693376ff329071575dadd9dd531d989d12e5","status":"affected"},{"type":"git","introduced":"9027497a25e3c92b5053b2643e0c18f910865625","fixed":"56f8d919739b588e2ad8cb9fb9eff704f32afaab","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"7.1","status":"affected"},{"type":"semver","introduced":"0","fixed":"7.1","status":"unaffected"},{"type":"semver","introduced":"7.3.4","lastAffected":"7.3.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.4-rc1","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/964b693376ff329071575dadd9dd531d989d12e5","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/56f8d919739b588e2ad8cb9fb9eff704f32afaab","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-99980","url":"https://www.cve.org/CVERecord?id=CVE-2026-99980","licence":"CVE Terms of Use","modified":"2026-11-30T13:18:50.711Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-99980","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-99980","licence":"Public domain","modified":"2026-11-30T14:20:41.003Z"}],"updatedAt":"2026-11-30T14:33:20.857Z","epss":{"score":0.00316,"percentile":0.265,"date":"2026-12-01T12:00:22.000Z"}}