From: Jakub Kicinski <kuba@kernel.org> Date: 2021-11-15 16:32:15
Commit d8873315065f ("net: add IFF_SKB_TX_SHARED flag to priv_flags")
introduced IFF_SKB_TX_SHARED to protect drivers which are not ready
for getting shared skbs from pktgen sending such frames.
Some drivers dutifully clear the flag but most don't, even though
they modify the skb or call skb helpers which expect private skbs.
syzbot has also discovered more sources of shared skbs than just
pktgen (e.g. llc).
I think defaulting to opt-in is doing more harm than good, those
who care about fast pktgen should inspect their drivers and opt-in.
It's far too risky to enable this flag in ether_setup().
Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/dummy.c | 1 +
net/core/dev.c | 4 ++++
net/ethernet/eth.c | 1 -
3 files changed, 5 insertions(+), 1 deletion(-)
From: Eric Dumazet <hidden> Date: 2021-11-15 16:56:24
On 11/15/21 8:32 AM, Jakub Kicinski wrote:
quoted hunk
Commit d8873315065f ("net: add IFF_SKB_TX_SHARED flag to priv_flags")
introduced IFF_SKB_TX_SHARED to protect drivers which are not ready
for getting shared skbs from pktgen sending such frames.
Some drivers dutifully clear the flag but most don't, even though
they modify the skb or call skb helpers which expect private skbs.
syzbot has also discovered more sources of shared skbs than just
pktgen (e.g. llc).
I think defaulting to opt-in is doing more harm than good, those
who care about fast pktgen should inspect their drivers and opt-in.
It's far too risky to enable this flag in ether_setup().
Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/dummy.c | 1 +
net/core/dev.c | 4 ++++
net/ethernet/eth.c | 1 -
3 files changed, 5 insertions(+), 1 deletion(-)
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-11-15 17:56:55
On Mon, 15 Nov 2021 08:56:10 -0800 Eric Dumazet wrote:
On 11/15/21 8:32 AM, Jakub Kicinski wrote:
quoted
Commit d8873315065f ("net: add IFF_SKB_TX_SHARED flag to priv_flags")
introduced IFF_SKB_TX_SHARED to protect drivers which are not ready
for getting shared skbs from pktgen sending such frames.
Some drivers dutifully clear the flag but most don't, even though
they modify the skb or call skb helpers which expect private skbs.
syzbot has also discovered more sources of shared skbs than just
pktgen (e.g. llc).
I think defaulting to opt-in is doing more harm than good, those
who care about fast pktgen should inspect their drivers and opt-in.
It's far too risky to enable this flag in ether_setup().
Likely. I haven't checked why LLC thinks it's a good idea to send
shared skbs, probably convenience.
I am sad we are adding so much tests in fast path.
What's our general stance on shared skbs in the Tx path? If we think
that it's okay maybe it's time to turn the BUG_ON(shared_skb)s in pskb
functions into return -EINVALs?
The IFF_TX_SKB_SHARING flag is pretty toothless as it stands.
From: Eric Dumazet <hidden> Date: 2021-11-15 19:11:24
On 11/15/21 9:35 AM, Jakub Kicinski wrote:
On Mon, 15 Nov 2021 08:56:10 -0800 Eric Dumazet wrote:
quoted
On 11/15/21 8:32 AM, Jakub Kicinski wrote:
quoted
Commit d8873315065f ("net: add IFF_SKB_TX_SHARED flag to priv_flags")
introduced IFF_SKB_TX_SHARED to protect drivers which are not ready
for getting shared skbs from pktgen sending such frames.
Some drivers dutifully clear the flag but most don't, even though
they modify the skb or call skb helpers which expect private skbs.
syzbot has also discovered more sources of shared skbs than just
pktgen (e.g. llc).
I think defaulting to opt-in is doing more harm than good, those
who care about fast pktgen should inspect their drivers and opt-in.
It's far too risky to enable this flag in ether_setup().
Likely. I haven't checked why LLC thinks it's a good idea to send
shared skbs, probably convenience.
quoted
I am sad we are adding so much tests in fast path.
What's our general stance on shared skbs in the Tx path? If we think
that it's okay maybe it's time to turn the BUG_ON(shared_skb)s in pskb
functions into return -EINVALs?
Yes, I think that a WARN_ON_ONCE() should be enough to keep syzbot reports
from alerting us, while not crashing regular hosts.
The IFF_TX_SKB_SHARING flag is pretty toothless as it stands.
skb_padto() needs to be replaced by something better.
so that skb can be cloned if needed.
static inline int skb_padto(struct sk_buff *skb, unsigned int len)
->
static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
{
}
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-11-16 01:28:07
On Mon, 15 Nov 2021 09:59:56 -0800 Eric Dumazet wrote:
quoted
The IFF_TX_SKB_SHARING flag is pretty toothless as it stands.
skb_padto() needs to be replaced by something better.
so that skb can be cloned if needed.
static inline int skb_padto(struct sk_buff *skb, unsigned int len)
->
static inline struct sk_buff *skb_padto(struct sk_buff *skb, unsigned int len)
Indeed, that was my first instinct but I wasn't up for fixing up all
the drivers which call skb_pad(), skb_cow_head() etc.
Let me leave this be for now..