public inbox for linux-sctp@vger.kernel.org
 help / color / mirror / Atom feed
From: Neil Horman <nhorman@tuxdriver.com>
To: linux-sctp@vger.kernel.org
Subject: Re: Ooops with SCTP
Date: Sun, 06 Jul 2014 12:21:33 +0000	[thread overview]
Message-ID: <20140706122132.GA23875@localhost.localdomain> (raw)
In-Reply-To: <20140705001606.GA29369@obsidianresearch.com>

On Sat, Jul 05, 2014 at 10:39:09AM -0600, Jason Gunthorpe wrote:
> On Sat, Jul 05, 2014 at 09:03:49AM -0400, Neil Horman wrote:
> 
> > >  1) Requesting COOKIE_ACK to be auth'd but not COOKIE_ECHO (or vice
> > >     versa) caused an immediate panic in a IRQ context, 'go reboot your
> > >     machine' with sctp traceback. I would need to setup in a VM to
> > >     capture the oops text..
> > 
> > Do you have the panic backtrace?
> 
> No, the machine crashed in a way that produced no permanent log. I
> will have to reproduce it in a VM.
>  
Ok, please do, otherwise you don't have enough information for us to help you
here.

> > >  2) SCTP_I_WANT_MAPPED_V4_ADDR returns a 0 AF_INET6 for all IPv4
> > >     addresses, looking at the code I think the functionality is just
> > >     not implemented?
> > No, its implemented, not sure why you would get a 0 address here.
> 
> Sorry, I see I was unclear, SCTP_I_WANT_MAPPED_V4_ADDR=1 (the
> default works fine), it is SCTP_I_WANT_MAPPED_V4_ADDR=0 that doesn't
> seem implemented.
> 
> Look at functions like this:
> 
> /* Initialize sk->sk_rcv_saddr from sctp_addr. */
> static void sctp_v6_to_sk_saddr(union sctp_addr *addr, struct sock *sk)
> {
>         if (addr->sa.sa_family = AF_INET && sctp_sk(sk)->v4mapped) {
>                 inet6_sk(sk)->rcv_saddr.s6_addr32[0] = 0;
>                 inet6_sk(sk)->rcv_saddr.s6_addr32[1] = 0;
>                 inet6_sk(sk)->rcv_saddr.s6_addr32[2] > 		htonl(0x0000ffff);
>                 inet6_sk(sk)->rcv_saddr.s6_addr32[3] >                         addr->v4.sin_addr.s_addr;
>         } else {
>                 inet6_sk(sk)->rcv_saddr = addr->v6.sin6_addr;
>         }
> }
> 
> There is no if block to handle 'addr->sa.sa_family = AF_INET &&
> !sctp_sk(sk)->v4mapped'
> 
Yes, there is, its the else clause there.  This is the ipv6 to_sk_saddr
function.  If you don't want a v4mapped address, you should assign a real ipv6
address to the socket.  What seems wierd is that there isn't an extra check to
ensure that the family is AF_INET6 in the else clause, but I think its done
higher up the call stack.  Although if its not, that could be a problem

> Instead it falls through to copying memory beyond the end of the
> socket address. This has always resulted in a zero AF_INET6 address in
> my handful of tests.
> 
Hmm, looking at the code, I'm not sure how we reach that point.  You need to set
you sa_family code to AF_INET6 to get the v6 mapping function to be called, but
it only does the v4mapping above if the sa_family is AF_INET.  Looks like that
might need fixing.  I'll look at that on monday.


Neil


  parent reply	other threads:[~2014-07-06 12:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-05  0:16 Ooops with SCTP Jason Gunthorpe
2014-07-05 13:03 ` Neil Horman
2014-07-05 16:39 ` Jason Gunthorpe
2014-07-06 12:21 ` Neil Horman [this message]
2014-07-07  4:48 ` Jason Gunthorpe
2014-07-07 12:44 ` Neil Horman
2014-07-07 17:45 ` Jason Gunthorpe
2014-07-07 18:22 ` Neil Horman
2014-07-07 19:39 ` Jason Gunthorpe
2014-07-09 15:50 ` Neil Horman
2014-07-09 16:28 ` Jason Gunthorpe
2014-07-09 18:27 ` Neil Horman
2014-07-09 18:51 ` Jason Gunthorpe
2014-07-10 11:33 ` Neil Horman
2014-07-10 19:58 ` Jason Gunthorpe
2014-07-10 20:14 ` Neil Horman
2014-07-21 11:15 ` Neil Horman
2014-07-23 17:22 ` Jason Gunthorpe

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=20140706122132.GA23875@localhost.localdomain \
    --to=nhorman@tuxdriver.com \
    --cc=linux-sctp@vger.kernel.org \
    /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