linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: syzbot <syzbot+0e4699d000d8b874d8dc@syzkaller.appspotmail.com>
Cc: davem@davemloft.net, kuba@kernel.org,
	linux-kernel@vger.kernel.org, linux-sctp@vger.kernel.org,
	netdev@vger.kernel.org, nhorman@tuxdriver.com,
	syzkaller-bugs@googlegroups.com, vyasevich@gmail.com, hch@lst.de
Subject: Re: KASAN: slab-out-of-bounds Write in sctp_setsockopt
Date: Wed, 22 Jul 2020 19:02:50 +0000	[thread overview]
Message-ID: <20200722190250.GE3307@localhost.localdomain> (raw)
In-Reply-To: <0000000000003b813605ab0bd243@google.com>

On Wed, Jul 22, 2020 at 11:22:23AM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    4f1b4da5 Merge branch 'net-atlantic-various-features'
> git tree:       net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x\x14b3a040900000
> kernel config:  https://syzkaller.appspot.com/x/.config?x+7b67c0c1819c87
> dashboard link: https://syzkaller.appspot.com/bug?extid\x0e4699d000d8b874d8dc
> compiler:       gcc (GCC) 10.1.0-syz 20200507
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x\x14c93358900000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x\x14ab61f0900000

The syz repo has:
setsockopt$inet_sctp6_SCTP_MAX_BURST(r0, 0x84, 0x10, &(0x7f0000000100)=@assoc_value, 0x8)
                      ^^^^^^^^^^^^^^           ^^^^

#define SCTP_DELAYED_ACK_TIME   16
#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
#define SCTP_MAX_BURST  20              /* Set/Get max burst */

C repro has:
  syscall(__NR_setsockopt, r[0], 0x84, 0x10, 0x20000100ul, 8ul);
                                       ^^^^

So I'm wondering, what was the real intention of the call?


Anyhow, the issue is real, introduced by ebb25defdc17 ("sctp: pass a
kernel pointer to sctp_setsockopt_delayed_ack"). It used to use a
local storage bigger than the data provided by the user and used
one struct to read another's content on top of it. Quite masked.
I'll cook a fix.

  Marcelo

      reply	other threads:[~2020-07-22 19:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 18:22 KASAN: slab-out-of-bounds Write in sctp_setsockopt syzbot
2020-07-22 19:02 ` Marcelo Ricardo Leitner [this message]

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=20200722190250.GE3307@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hch@lst.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=syzbot+0e4699d000d8b874d8dc@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@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;
as well as URLs for NNTP newsgroup(s).