bpf: Unshare cloned skb before devmap egress XDP program#12402
bpf: Unshare cloned skb before devmap egress XDP program#12402kernel-patches-daemon-bpf[bot] wants to merge 1 commit into
Conversation
|
Upstream branch: b9452b5 |
68b80e2 to
9978c13
Compare
|
Upstream branch: dd0f968 |
c18b415 to
3bff632
Compare
9978c13 to
e25ce50
Compare
|
Upstream branch: f1a660b |
3bff632 to
f821f98
Compare
e25ce50 to
a572b20
Compare
|
Upstream branch: 68f4e48 |
f821f98 to
6a96564
Compare
a572b20 to
3a26044
Compare
|
Upstream branch: c15261b |
6a96564 to
ec73b72
Compare
3a26044 to
818f7b1
Compare
|
Upstream branch: 140fa23 |
ec73b72 to
ef2e63a
Compare
818f7b1 to
d9ed865
Compare
|
Upstream branch: 2e8ad1f |
ef2e63a to
995933f
Compare
d9ed865 to
1b36123
Compare
|
Upstream branch: 30dee2c |
dev_map_redirect_clone() uses skb_clone() when redirecting a generic XDP skb to multiple devmap destinations. The cloned skb can share packet data with other clones. If the destination devmap entry has an egress XDP program, that program can modify packet data. Such modifications can then be observed by other clones sharing the same packet data. This can be reproduced by strengthening xdp_veth_egress to configure a different source MAC for each egress device and checking that store_mac_1/2 observe the MAC configured for their own egress devices. Without the fix, the SKB_MODE subtest observes store_mac_1 receiving the MAC configured for the next egress device. Fix this by unsharing the cloned skb before running the devmap egress XDP program. Limit the extra copy to destinations with an attached egress program. Tested with: ./test_progs -t xdp_veth_egress ./test_progs -t xdp_veth ./test_progs -t xdp Fixes: e624d4e ("xdp: Extend xdp_redirect_map with broadcast support") Signed-off-by: Sun Jian <sun.jian.kdev@gmail.com>
995933f to
dd89b01
Compare
Pull request for series with
subject: bpf: Unshare cloned skb before devmap egress XDP program
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1108462