public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail•com>
To: syzbot <syzbot+c0ea2226f77a42936bf7@syzkaller•appspotmail.com>
Cc: adobriyan@gmail•com, davem@davemloft•net,
	gregkh@linuxfoundation•org, kraig@google•com,
	linux-kernel@vger•kernel.org, netdev@vger•kernel.org,
	pombredanne@nexb•com, syzkaller-bugs@googlegroups•com,
	tglx@linutronix•de
Subject: Re: WARNING in reuseport_add_sock
Date: Thu, 1 Feb 2018 15:30:12 -0800	[thread overview]
Message-ID: <20180201233012.fgcve3ohufcspb2c@gmail.com> (raw)
In-Reply-To: <94eb2c1fcf4cdda26b05629d08d4@google.com>

On Fri, Jan 12, 2018 at 03:58:01PM -0800, syzbot wrote:
> Hello,
> 
> syzkaller hit the following crash on
> 30a7acd573899fd8b8ac39236eff6468b195ac7d
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
> C reproducer is attached
> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> for information about syzkaller reproducers
> 
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+c0ea2226f77a42936bf7@syzkaller•appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.
> 
> ------------[ cut here ]------------
> socket already in reuseport group
> WARNING: CPU: 0 PID: 3496 at net/core/sock_reuseport.c:119
> reuseport_add_sock+0x742/0x9b0 net/core/sock_reuseport.c:117
> Kernel panic - not syncing: panic_on_warn set ...
> 
> CPU: 0 PID: 3496 Comm: syzkaller869503 Not tainted 4.15.0-rc6+ #245
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x194/0x257 lib/dump_stack.c:53
>  panic+0x1e4/0x41c kernel/panic.c:183
>  __warn+0x1dc/0x200 kernel/panic.c:547
>  report_bug+0x211/0x2d0 lib/bug.c:184
>  fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
>  fixup_bug arch/x86/kernel/traps.c:247 [inline]
>  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
>  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
>  invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1079
> RIP: 0010:reuseport_add_sock+0x742/0x9b0 net/core/sock_reuseport.c:117
> RSP: 0018:ffff8801bf5f7968 EFLAGS: 00010286
> RAX: dffffc0000000008 RBX: ffff8801bf4905c0 RCX: ffffffff8159d9de
> RDX: 0000000000000000 RSI: 1ffff10037ebeee8 RDI: 0000000000000293
> RBP: ffff8801bf5f7b00 R08: 1ffff10037ebeeaa R09: 0000000000000000
> R10: ffff8801bf5f7820 R11: 0000000000000000 R12: 1ffff10037ebef37
> R13: ffff8801bf47b930 R14: ffff8801bf5f7ad8 R15: 1ffff10037ebef3b
>  inet_reuseport_add_sock net/ipv4/inet_hashtables.c:456 [inline]
>  __inet_hash+0x767/0xb90 net/ipv4/inet_hashtables.c:477
>  inet_hash+0x61/0x90 net/ipv4/inet_hashtables.c:501
>  inet_csk_listen_start+0x38f/0x460 net/ipv4/inet_connection_sock.c:885
>  inet_listen+0x19a/0x440 net/ipv4/af_inet.c:228
>  SYSC_listen net/socket.c:1483 [inline]
>  SyS_listen+0x1aa/0x350 net/socket.c:1469
>  entry_SYSCALL_64_fastpath+0x23/0x9a
> RIP: 0033:0x445639
> RSP: 002b:00007f2966197db8 EFLAGS: 00000246 ORIG_RAX: 0000000000000032
> RAX: ffffffffffffffda RBX: 00000000006dac24 RCX: 0000000000445639
> RDX: 0000000000445639 RSI: 0000000000000000 RDI: 0000000000000006
> RBP: 00000000006dac20 R08: 0000000000000000 R09: 0000000000000000
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
> R13: 00007ffc328a273f R14: 00007f29661989c0 R15: 0000000000000008
> Dumping ftrace buffer:
>    (ftrace buffer empty)
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
> 

Still happens.  Here's a simplified reproducer:

#include <linux/filter.h>
#include <linux/in.h>
#include <sys/socket.h>

int main()
{
	struct sock_filter filt = { .code = 6 };
	struct sock_fprog prog = { .len = 1, .filter = &filt };
	struct sockaddr_in addr = {
		.sin_family = AF_INET,
		.sin_port = htobe16(20000),
	};

	for (;;) {
		int fd = socket(AF_INET, SOCK_STREAM, 0);
		setsockopt(fd, IPPROTO_TCP, IP_TRANSPARENT, &(int){ 1 }, 4);
		setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &(int){ 1 }, 4);
		setsockopt(fd, SOL_SOCKET, SO_ATTACH_REUSEPORT_CBPF,
			   &prog, sizeof(prog));
		bind(fd, (void *)&addr, sizeof(addr));
		listen(fd, 0);
	}
}

  reply	other threads:[~2018-02-01 23:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 23:58 WARNING in reuseport_add_sock syzbot
2018-02-01 23:30 ` Eric Biggers [this message]
2018-02-01 23:43   ` Eric Dumazet
2018-02-02 18:27     ` [PATCH net] soreuseport: fix mem leak in reuseport_add_sock() Eric Dumazet
2018-02-02 18:57       ` Craig Gallek
2018-02-03  0:47       ` 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=20180201233012.fgcve3ohufcspb2c@gmail.com \
    --to=ebiggers3@gmail$(echo .)com \
    --cc=adobriyan@gmail$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=gregkh@linuxfoundation$(echo .)org \
    --cc=kraig@google$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pombredanne@nexb$(echo .)com \
    --cc=syzbot+c0ea2226f77a42936bf7@syzkaller$(echo .)appspotmail.com \
    --cc=syzkaller-bugs@googlegroups$(echo .)com \
    --cc=tglx@linutronix$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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