[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1322850989.2762.47.camel@edumazet-laptop>
Date: Fri, 02 Dec 2011 19:36:29 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: subramanian.vijay@...il.com, therbert@...gle.com,
netdev@...r.kernel.org
Subject: Re: Bug in computing data_len in tcp_sendmsg?
Le vendredi 02 décembre 2011 à 13:13 -0500, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@...il.com>
> Date: Fri, 02 Dec 2011 17:05:35 +0100
>
> > Le vendredi 02 décembre 2011 à 16:44 +0100, Eric Dumazet a écrit :
> >
> >> [PATCH net-next] tcp: fix tcp_trim_head()
> >>
> >> commit f07d960df3 (tcp: avoid frag allocation for small frames)
> >> breaked assumption in tcp stack that skb is either linear (data_len ==
> >> 0), either fully fragged (data_len == len)
> >>
> >> Thanks to Vijay for providing a very detailed explanation.
> >>
> >> Reported-by: Vijay Subramanian <subramanian.vijay@...il.com>
> >> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> >> ---
> >
> > Another problem is the possible misalignement of skb->data if/when we
> > receive an ACK of an odd (not a 4 multiple) tcp sequence.
> >
> > So when/if packet is restransmited, tcp header (and IP header as well)
> > could be misaligned.
> >
> > Hmm, I probably miss something obvious, since this problem could happen
> > for linear skbs before my patch ?
>
> Unfortunately, even if netfilter or the packet scheduler pulled data, this
> misalignment wouldn't happen before your change.
>
> Maybe we should revert your frag allocation avoidance change until we can
> sort this out.
The patch I posted should solve the problem Vijay spotted.
(It really does, I tested it, allowing mtu probing)
What I ask now is following problem (even prior to my frag allocation
patch) :
1) We allocate a linear skb (SG being off) to cook a tcp frame of length
XXX bytes.
2) We send it.
3) We receive an ACK for first 31 bytes.
4) We trim 31 bytes from the head of skb. (skb_pull(skb, 31))
skb->data is now not anymore aligned to a 4 bytes boundary.
5) Later, we need to retransmit skb (XXX minus 31 bytes already ACKed)
We push TCP header, and skb->data is not aligned.
TCP header is not aligned anymore. x86 doesnt care, but what about
other arches with misalign traps ?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists