public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Vladislav Yasevich <vyasevich@gmail.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	David Miller <davem@davemloft.net>,
	linux-sctp@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	Eric Dumazet <edumazet@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	syzkaller <syzkaller@googlegroups.com>,
	Xin Long <lucien.xin@gmail.com>
Subject: Re: net/sctp: GPF in sctp_addr_id2transport
Date: Tue, 7 Feb 2017 09:09:39 -0200	[thread overview]
Message-ID: <20170207110939.GA3414@localhost.localdomain> (raw)
In-Reply-To: <CACT4Y+Yv7GmjqiewgA3PS2U-VhF89966t4M7wBKAceK-v0h0UQ@mail.gmail.com>

On Tue, Feb 07, 2017 at 10:42:38AM +0100, Dmitry Vyukov wrote:
> Hello,
> 
> The following program triggers GPF in sctp_addr_id2transport:
> 
> // autogenerated by syzkaller (http://github.com/google/syzkaller)
> #include <string.h>
> #include <stdint.h>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <linux/in.h>
> #include <linux/sctp.h>
> 
> int main()
> {
>   int sock = socket(AF_INET6, SOCK_SEQPACKET, IPPROTO_SCTP);
>   struct sctp_paddrinfo info;
>   memset(&info, 0, sizeof(info));
>   int sz = sizeof(info);
>   getsockopt(sock, IPPROTO_SCTP, SCTP_GET_PEER_ADDR_INFO, &info, &sz);
>   return 0;
> }
> 
...
> RIP: 0010:sctp_addr_id2transport+0xb7/0x350 net/sctp/socket.c:242
...
>  sctp_getsockopt_peer_addr_info+0x211/0x620 net/sctp/socket.c:4628
>  sctp_getsockopt+0x2813/0x66a0 net/sctp/socket.c:6503
>  sock_common_getsockopt+0x95/0xd0 net/core/sock.c:2685
>  SYSC_getsockopt net/socket.c:1819 [inline]
>  SyS_getsockopt+0x240/0x380 net/socket.c:1801
>  entry_SYSCALL_64_fastpath+0x1f/0xc2

Xin, I believe 6f29a1306131 ("sctp: sctp_addr_id2transport should verify
the addr before looking up assoc") introduced this issue.

As info is all 0'ed in this test,
+       struct sctp_af *af = sctp_get_af_specific(addr->ss_family);
will return NULL, and then boom at:
+       if (sctp_verify_addr(sk, laddr, af->sockaddr_len))
                                        ^^^^

  Marcelo

  reply	other threads:[~2017-02-07 11:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07  9:42 net/sctp: GPF in sctp_addr_id2transport Dmitry Vyukov
2017-02-07 11:09 ` Marcelo Ricardo Leitner [this message]
2017-02-07 11:56   ` Xin Long

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=20170207110939.GA3414@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=syzkaller@googlegroups.com \
    --cc=vyasevich@gmail.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