Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: subramanian.vijay@gmail.com, therbert@google.com, netdev@vger.kernel.org
Subject: Re: Bug in computing data_len in tcp_sendmsg?
Date: Fri, 02 Dec 2011 19:36:29 +0100	[thread overview]
Message-ID: <1322850989.2762.47.camel@edumazet-laptop> (raw)
In-Reply-To: <20111202.131304.981034697414242002.davem@davemloft.net>

Le vendredi 02 décembre 2011 à 13:13 -0500, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.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@gmail.com>
> >> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.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 ?

  reply	other threads:[~2011-12-02 18:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01  1:48 Bug in computing data_len in tcp_sendmsg? Tom Herbert
2011-12-01  3:42 ` Eric Dumazet
2011-12-01  4:06   ` Tom Herbert
2011-12-01  4:16     ` David Miller
2011-12-01  4:17     ` Eric Dumazet
2011-12-01  5:09       ` Tom Herbert
2011-12-01  9:15         ` Eric Dumazet
2011-12-01 17:29           ` Jesse Brandeburg
2011-12-01 18:04             ` David Miller
2011-12-01 20:37             ` Eric Dumazet
2011-12-01 22:18       ` Vijay Subramanian
2011-12-01 22:30         ` Eric Dumazet
2011-12-02  6:18           ` Vijay Subramanian
2011-12-02 11:59             ` Eric Dumazet
2011-12-02 15:44               ` Eric Dumazet
2011-12-02 16:05                 ` Eric Dumazet
2011-12-02 18:13                   ` David Miller
2011-12-02 18:36                     ` Eric Dumazet [this message]
2011-12-02 18:40                       ` David Miller
2011-12-02 20:22                         ` Eric Dumazet
2011-12-02 20:24                           ` David Miller
2011-12-02 20:45                             ` Eric Dumazet
2011-12-02 20:48                               ` Eric Dumazet
2011-12-02 21:30                               ` David Miller
2011-12-03 15:09                                 ` Eric Dumazet
2011-12-04  7:39                                   ` [PATCH] tcp: take care of misalignments Eric Dumazet
2011-12-04 18:21                                     ` David Miller
2011-12-04 18:51                                       ` Eric Dumazet
2011-12-05 23:45                                         ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322850989.2762.47.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=subramanian.vijay@gmail.com \
    --cc=therbert@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox