netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: Tom Herbert <tom@herbertland.com>,
	David Miller <davem@davemloft.net>,
	Netdev <netdev@vger.kernel.org>, Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH net] net: Allow flow dissector to handle non 4-byte aligned headers
Date: Tue, 2 Feb 2016 13:35:09 -0500	[thread overview]
Message-ID: <20160202183509.GA26588@oracle.com> (raw)
In-Reply-To: <CAKgT0UfjLEBUeiV3WS2BC=yRkxi9JBF4mqJ=niXOUQnhkiMhvA@mail.gmail.com>

On (02/01/16 19:56), Alexander Duyck wrote:
> > @@ -394,7 +407,7 @@ ip_proto_again:
> >                                                    data, hlen, &_eth);
> >                         if (!eth)
> >                                 goto out_bad;
> > -                       proto = eth->h_proto;
> > +                       proto = get_unaligned_be16(&eth->h_proto);
> >                         nhoff += sizeof(*eth);
> >                 }
> 
> This piece doesn't make any sense to me.  It is already only 2 bytes
> wide.  I'm not sure why we should be seeing this trigger an unaligned
> access.  Are you sure it wasn't something like the keyid causing the
> issue?  I'd be interested in seeing what the compiler did here that it
> is triggering the problem.

You're right- I was getting blinded by all the unaligned-access
messages swimming by and making a mistake. It was actually the 

                memcpy(&key_addrs->v4addrs, &iph->saddr,
                       sizeof(key_addrs->v4addrs));

The assembler code is this:

   0x8d3298 <__skb_flow_dissect+500>:   ld  [ %l5 + 0xc ], %g3
   0x8d329c <__skb_flow_dissect+504>:   add  %i2, %g1, %g2
   0x8d32a0 <__skb_flow_dissect+508>:   st  %g3, [ %i2 + %g1 ]
   0x8d32a4 <__skb_flow_dissect+512>:   ld  [ %l5 + 0x10 ], %g1
   0x8d32a8 <__skb_flow_dissect+516>:   st  %g1, [ %g2 + 4 ]
   0x8d32ac <__skb_flow_dissect+520>:   mov  2, %g1

I get unaligned access traps at __skb_flow_dissect+500 and
__skb_flow_dissect+512 (corresponding to saddr and daddr), once for
each interface (gretap/eth0 and eth1). 

--Sowmini

  parent reply	other threads:[~2016-02-02 18:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-31 21:37 [PATCH net] net: Allow flow dissector to handle non 4-byte aligned headers Tom Herbert
2016-01-31 21:47 ` kbuild test robot
2016-01-31 22:06 ` Florian Westphal
2016-02-01  0:24 ` Eric Dumazet
2016-02-01  0:39   ` Florian Fainelli
2016-02-01 15:20     ` Nicolas Dichtel
2016-02-01 16:01       ` Sowmini Varadhan
2016-02-01  0:43   ` Sowmini Varadhan
2016-02-01 12:32 ` Sergei Shtylyov
2016-02-02  0:31 ` Sowmini Varadhan
2016-02-02  0:46   ` Tom Herbert
2016-02-02  3:56   ` Alexander Duyck
2016-02-02 13:41     ` Hannes Frederic Sowa
2016-02-02 18:35     ` Sowmini Varadhan [this message]
2016-02-03 17:07   ` Tom Herbert
2016-02-03 17:31     ` Sowmini Varadhan
2016-02-03 17:51       ` Tom Herbert
2016-02-03 17:59         ` Sowmini Varadhan

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=20160202183509.GA26588@oracle.com \
    --to=sowmini.varadhan@oracle.com \
    --cc=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.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;
as well as URLs for NNTP newsgroup(s).