Bug 1222788 (CVE-2024-26803)

Summary: VUL-0: CVE-2024-26803: kernel: net: veth: clear GRO when clearing XDP even when down
Product: [Novell Products] SUSE Security Incidents Reporter: SMASH SMASH <smash_bz>
Component: IncidentsAssignee: Denis Kirjanov <denis.kirjanov>
Status: IN_PROGRESS --- QA Contact: Security Team bot <security-team>
Severity: Normal    
Priority: P3 - Medium CC: osalvador, rfrohl
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://smash.suse.de/issue/400355/
Whiteboard: CVSSv3.1:SUSE:CVE-2024-26803:5.5:(AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)
Found By: Security Response Team Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description SMASH SMASH 2024-04-15 08:16:05 UTC
In the Linux kernel, the following vulnerability has been resolved:

net: veth: clear GRO when clearing XDP even when down

veth sets NETIF_F_GRO automatically when XDP is enabled,
because both features use the same NAPI machinery.

The logic to clear NETIF_F_GRO sits in veth_disable_xdp() which
is called both on ndo_stop and when XDP is turned off.
To avoid the flag from being cleared when the device is brought
down, the clearing is skipped when IFF_UP is not set.
Bringing the device down should indeed not modify its features.

Unfortunately, this means that clearing is also skipped when
XDP is disabled _while_ the device is down. And there's nothing
on the open path to bring the device features back into sync.
IOW if user enables XDP, disables it and then brings the device
up we'll end up with a stray GRO flag set but no NAPI instances.

We don't depend on the GRO flag on the datapath, so the datapath
won't crash. We will crash (or hang), however, next time features
are sync'ed (either by user via ethtool or peer changing its config).
The GRO flag will go away, and veth will try to disable the NAPIs.
But the open path never created them since XDP was off, the GRO flag
was a stray. If NAPI was initialized before we'll hang in napi_disable().
If it never was we'll crash trying to stop uninitialized hrtimer.

Move the GRO flag updates to the XDP enable / disable paths,
instead of mixing them with the ndo_open / ndo_close paths.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2024-26803
https://www.cve.org/CVERecord?id=CVE-2024-26803
https://git.kernel.org/stable/c/16edf51f33f52dff70ed455bc40a6cc443c04664
https://git.kernel.org/stable/c/7985d73961bbb4e726c1be7b9cd26becc7be8325
https://git.kernel.org/stable/c/8f7a3894e58e6f5d5815533cfde60e3838947941
https://git.kernel.org/stable/c/f011c103e654d83dc85f057a7d1bd0960d02831c
https://git.kernel.org/stable/c/fe9f801355f0b47668419f30f1fac1cf4539e736
https://bugzilla.redhat.com/show_bug.cgi?id=2273425
https://git.kernel.org/pub/scm/linux/security/vulns.git/plain/cve/published/2024/CVE-2024-26803.mbox
Comment 1 Oscar Salvador 2024-04-19 10:28:11 UTC
@Denis: Can you have a look?

Thanks

./scripts/check-kernel-fix CVE-2024-26803
fe9f801355f0 ("net: veth: clear GRO when clearing XDP even when down") merged v6.8-rc7~26^2~26
Fixes: d3256efd8e8b ("veth: allow enabling NAPI even without XDP") merged v5.13-rc1~94^2~185^2~2
Security fix for CVE-2024-26803 bsc#1222788 with CVSS 5.5
..............................
ACTION NEEDED!
SLE15-SP5: MANUAL: backport fe9f801355f0b47668419f30f1fac1cf4539e736 (Fixes d3256efd8e8b