macvlan: observe an RCU grace period in macvlan_common_newlink() error path
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ cdedcd5aa3f3cb8b7ae0f87ab3a936d0bd583d66 · < d34f7a8aa9a25b7e64e0e46e444697c0f702374d| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
macvlan: observe an RCU grace period in macvlan_common_newlink() error path
valis reported that a race condition still happens after my prior patch.
macvlan_common_newlink() might have made @dev visible before detecting an error, and its caller will directly call free_netdev(dev).
We must respect an RCU period, either in macvlan or the core networking stack.
After adding a temporary mdelay(1000) in macvlan_forward_source_one() to open the race window, valis repro was:
ip link add p1 type veth peer p2 ip link set address 00:00:00:00:00:20 dev p1 ip link set up dev p1 ip link set up dev p2 ip link add mv0 link p2 type macvlan mode source
(ip link add invalid% link p2 type macvlan mode source macaddr add 00:00:00:00:00:20 &) ; sleep 0.5 ; ping -c1 -I p1 1.2.3.4 PING 1.2.3.4 (1.2.3.4): 56 data bytes RTNETLINK answers: Invalid argument
From the CVE record · Linux
A race in the Linux kernel’s macvlan link-creation error path can free a network device while it remains visible to readers. A local user creating a macvlan link that fails while network traffic is processed can trigger a use-after-free; the input does not specify the privileges required.
Engineers running Linux kernels with macvlan support should check their kernel; affected versions are not specified.