net: Validate size of non-TSO packets in validate_xmit_skb().
Subsystems (2)
RFC PATCH 1/1 net: Validate size of non-TSO packets in validate_xmit_skb().
There have been reports of oversize UDP packets being sent to the driver to be transmitted, causing error conditions. The issue is likely caused by the dst of the SKB switching between 'lo' with 64K MTU and the hardware device with a smaller MTU. Patches are being proposed by Mahesh Bandewar <[email protected]> to fix the issue.
Separately, we should add a length check in validate_xmit_skb() to drop these oversize packets before they reach the driver. This patch only validates non-TSO packets. Complete validation of segmented TSO packet size will probably be too slow.
--- net/core/dev.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/core/dev.c +7 -0
@@ -3373,6 +3373,13 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device } } +if (!skb_is_gso (skb) && + skb->len > (dev->mtu + dev->hard_header_len +VLAN_HLEN )) { +net_warn_ratelimited ("%s(): Dropping %d bytes oversize skb.\n" , + __func__, skb->len); + goto out_kfree_skb; + } + skb =validate_xmit_xfrm (skb, features, again);return skb;
Signature · 1 line
2.5.1
Quoted 9 lines · Michael Chan
There have been reports of oversize UDP packets being sent to the driver to be transmitted, causing error conditions. The issue is likely caused by the dst of the SKB switching between 'lo' with 64K MTU and the hardware device with a smaller MTU. Patches are being proposed by Mahesh Bandewar <[email protected]> to fix the issue.
Separately, we should add a length check in
validate_xmit_skb()to drop these oversize packets before they reach the driver.
Why ?
We keep adding checks in the 'fast path' and make slower and slower after each release.
We need to fix the root cause really.
Quoted 27 lines
This patch only validates non-TSO packets. Complete validation of segmented TSO packet size will probably be too slow.
Signed-off-by Michael Chan <[email protected]>--- net/core/dev.c | 7 +++++++ 1 file changed, 7 insertions(+)net/core/dev.c +7
-0@@ -3373,6 +3373,13 @@ static struct sk_buff *validate_xmit_skb(struct sk_buff *skb, struct net_device } } +if (!skb_is_gso (skb) && + skb->len > (dev->mtu + dev->hard_header_len +VLAN_HLEN )) { +net_warn_ratelimited ("%s(): Dropping %d bytes oversize skb.\n" , + __func__, skb->len); + goto out_kfree_skb; + } + skb =validate_xmit_xfrm (skb, features, again);return skb;
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Tue, 26 Feb 2019 05:56:41 -0500
Quoted 7 lines
There have been reports of oversize UDP packets being sent to the driver to be transmitted, causing error conditions. The issue is likely caused by the dst of the SKB switching between 'lo' with 64K MTU and the hardware device with a smaller MTU. Patches are being proposed by Mahesh Bandewar <[email protected]> to fix the issue.
Quoted 6 lines
Separately, we should add a length check in
validate_xmit_skb()to drop these oversize packets before they reach the driver. This patch only validates non-TSO packets. Complete validation of segmented TSO packet size will probably be too slow.Signed-off-by Michael Chan <[email protected]>
Anything which changes the dst of an SKB really is responsible for fixing up whatever became "incompatible" in the new path.
So like Eric I want to see this out of the fast path.
Quoted 16 lines · David Miller
From: Michael Chan <[email protected]>
Date: Tue, 26 Feb 2019 05:56:41 -0500Quoted 12 lines
There have been reports of oversize UDP packets being sent to the driver to be transmitted, causing error conditions. The issue is likely caused by the dst of the SKB switching between 'lo' with 64K MTU and the hardware device with a smaller MTU. Patches are being proposed by Mahesh Bandewar <[email protected]> to fix the issue.
Separately, we should add a length check in
validate_xmit_skb()to drop these oversize packets before they reach the driver. This patch only validates non-TSO packets. Complete validation of segmented TSO packet size will probably be too slow.
Quoted 6 lines
Quoted 1 line
Signed-off-by Michael Chan <[email protected]>Anything which changes the dst of an SKB really is responsible for fixing up whatever became "incompatible" in the new path.
So like Eric I want to see this out of the fast path.
Ok. In the meantime, will you take a 2-line bnxt_en patch that will prevent this issue in kernel 5.0?
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Tue, 26 Feb 2019 10:22:42 -0800
Quoted 19 lines · David Miller
Quoted 18 lines
From: Michael Chan <[email protected]>
Date: Tue, 26 Feb 2019 05:56:41 -0500Quoted 13 lines
There have been reports of oversize UDP packets being sent to the driver to be transmitted, causing error conditions. The issue is likely caused by the dst of the SKB switching between 'lo' with 64K MTU and the hardware device with a smaller MTU. Patches are being proposed by Mahesh Bandewar <[email protected]> to fix the issue.
Separately, we should add a length check in
validate_xmit_skb()to drop these oversize packets before they reach the driver. This patch only validates non-TSO packets. Complete validation of segmented TSO packet size will probably be too slow.Signed-off-by Michael Chan <[email protected]>
Quoted 7 lines
Quoted 4 lines
Anything which changes the dst of an SKB really is responsible for fixing up whatever became "incompatible" in the new path.
So like Eric I want to see this out of the fast path.
Ok. In the meantime, will you take a 2-line
bnxt_enpatch that will prevent this issue in kernel 5.0?
Sure, but we will have to remember to remove it when it is no longer necessary...