WARNING in strp_data_ready

7 messages, 4 authors, 2017-12-27 · open the first message on its own page

WARNING in strp_data_ready

From: syzbot <hidden>
Date: 2017-10-24 15:20:58

Hello,

syzkaller hit the following crash on  
73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me  
include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user  
include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505  
strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  <IRQ>
  __dump_stack lib/dump_stack.c:16 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:52
  panic+0x1e4/0x417 kernel/panic.c:181
  __warn+0x1c4/0x1d9 kernel/panic.c:542
  report_bug+0x211/0x2d0 lib/bug.c:183
  fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
  do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
  do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
  do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
  invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
  psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
  tcp_child_process+0x559/0x990 net/ipv4/tcp_minisocks.c:818
  tcp_v4_rcv+0x17e1/0x2f20 net/ipv4/tcp_ipv4.c:1682
  ip_local_deliver_finish+0x2e2/0xba0 net/ipv4/ip_input.c:216
  NF_HOOK include/linux/netfilter.h:249 [inline]
  ip_local_deliver+0x1ce/0x6e0 net/ipv4/ip_input.c:257
  dst_input include/net/dst.h:464 [inline]
  ip_rcv_finish+0x887/0x19a0 net/ipv4/ip_input.c:397
  NF_HOOK include/linux/netfilter.h:249 [inline]
  ip_rcv+0xc3f/0x17d0 net/ipv4/ip_input.c:493
  __netif_receive_skb_core+0x19af/0x33d0 net/core/dev.c:4428
  __netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4466
  process_backlog+0x203/0x740 net/core/dev.c:5144
  napi_poll net/core/dev.c:5542 [inline]
  net_rx_action+0x792/0x1910 net/core/dev.c:5608
  __do_softirq+0x2d7/0xb85 kernel/softirq.c:284
  do_softirq_own_stack+0x2a/0x40 arch/x86/entry/entry_64.S:957
  </IRQ>
  do_softirq.part.22+0x14d/0x190 kernel/softirq.c:328
  do_softirq kernel/softirq.c:176 [inline]
  __local_bh_enable_ip+0x135/0x160 kernel/softirq.c:181
  local_bh_enable include/linux/bottom_half.h:31 [inline]
  rcu_read_unlock_bh include/linux/rcupdate.h:726 [inline]
  ip_finish_output2+0x8ad/0x1460 net/ipv4/ip_output.c:231
  ip_finish_output+0x85e/0xd10 net/ipv4/ip_output.c:317
  NF_HOOK_COND include/linux/netfilter.h:238 [inline]
  ip_output+0x1cc/0x860 net/ipv4/ip_output.c:405
  dst_output include/net/dst.h:458 [inline]
  ip_local_out+0x95/0x160 net/ipv4/ip_output.c:124
  ip_queue_xmit+0x8c6/0x18e0 net/ipv4/ip_output.c:504
  tcp_transmit_skb+0x19a1/0x3450 net/ipv4/tcp_output.c:1123
  tcp_send_ack.part.34+0x386/0x610 net/ipv4/tcp_output.c:3557
  tcp_send_ack+0x49/0x60 net/ipv4/tcp_output.c:3527
  tcp_rcv_synsent_state_process net/ipv4/tcp_input.c:5756 [inline]
  tcp_rcv_state_process+0x4a25/0x4d10 net/ipv4/tcp_input.c:5891
  tcp_v4_do_rcv+0x55c/0x7d0 net/ipv4/tcp_ipv4.c:1482
  sk_backlog_rcv include/net/sock.h:909 [inline]
  __release_sock+0x124/0x360 net/core/sock.c:2264
  release_sock+0xa4/0x2a0 net/core/sock.c:2776
  inet_wait_for_connect net/ipv4/af_inet.c:557 [inline]
  __inet_stream_connect+0x651/0xf00 net/ipv4/af_inet.c:643
  inet_stream_connect+0x58/0xa0 net/ipv4/af_inet.c:682
  SYSC_connect+0x204/0x470 net/socket.c:1642
  SyS_connect+0x24/0x30 net/socket.c:1623
  entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x43ff69
RSP: 002b:00007ffcf59753a8 EFLAGS: 00000217 ORIG_RAX: 000000000000002a
RAX: ffffffffffffffda RBX: ffffffffffffffff RCX: 000000000043ff69
RDX: 0000000000000010 RSI: 00000000200d1ff0 RDI: 0000000000000004
RBP: 0000000000000082 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000217 R12: 00000000004018d0
R13: 0000000000401960 R14: 0000000000000000 R15: 0000000000000000
Dumping ftrace buffer:
    (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzkaller@googlegroups.com.

syzbot will keep track of this bug report.
Once a fix for this bug is committed, please reply to this email with:
#syz fix: exact-commit-title
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug  
report.

Re: WARNING in strp_data_ready

From: John Fastabend <john.fastabend@gmail.com>
Date: 2017-10-30 21:44:27

On 10/24/2017 08:20 AM, syzbot wrote:
Hello,

syzkaller hit the following crash on 73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:181
 __warn+0x1c4/0x1d9 kernel/panic.c:542
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
 do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
 invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
 psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
Looks like KCM is calling sk_data_ready() without first taking the
sock lock.

/* Called with lower sock held */
static void kcm_rcv_strparser(struct strparser *strp, struct sk_buff *skb)
{
 [...]
	if (kcm_queue_rcv_skb(&kcm->sk, skb)) {

In this case kcm->sk is not the same lock the comment is referring to.
And kcm_queue_rcv_skb() will eventually call sk_data_ready().

@Tom, how about wrapping the sk_data_ready call in {lock|release}_sock?
I don't have anything better in mind immediately.

Thanks,
John

Re: WARNING in strp_data_ready

From: Tom Herbert <hidden>
Date: 2017-10-30 22:07:01

On Mon, Oct 30, 2017 at 2:44 PM, John Fastabend
[off-list ref] wrote:
On 10/24/2017 08:20 AM, syzbot wrote:
quoted
Hello,

syzkaller hit the following crash on 73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:181
 __warn+0x1c4/0x1d9 kernel/panic.c:542
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
 do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
 invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
 psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
Looks like KCM is calling sk_data_ready() without first taking the
sock lock.

/* Called with lower sock held */
static void kcm_rcv_strparser(struct strparser *strp, struct sk_buff *skb)
{
 [...]
        if (kcm_queue_rcv_skb(&kcm->sk, skb)) {

In this case kcm->sk is not the same lock the comment is referring to.
And kcm_queue_rcv_skb() will eventually call sk_data_ready().

@Tom, how about wrapping the sk_data_ready call in {lock|release}_sock?
I don't have anything better in mind immediately.
The sock locks are taken in reverse order in the send path so so
grabbing kcm sock lock with lower lock held to call sk_data_ready may
lead to deadlock like I think.

It might be possible to change the order in the send path to do this.
Something like:

trylock on lower socket lock
-if trylock fails
  - release kcm sock lock
  - lock lower sock
  - lock kcm sock
- call sendpage locked function

I admit that dealing with two levels of socket locks in the data path
is quite a pain :-)

Tom
Thanks,
John

Re: WARNING in strp_data_ready

From: Dmitry Vyukov <dvyukov@google.com>
Date: 2017-12-06 15:44:42

On Mon, Oct 30, 2017 at 11:06 PM, Tom Herbert [off-list ref] wrote:
On Mon, Oct 30, 2017 at 2:44 PM, John Fastabend
[off-list ref] wrote:
quoted
On 10/24/2017 08:20 AM, syzbot wrote:
quoted
Hello,

syzkaller hit the following crash on 73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:181
 __warn+0x1c4/0x1d9 kernel/panic.c:542
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
 do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
 invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
 psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
Looks like KCM is calling sk_data_ready() without first taking the
sock lock.

/* Called with lower sock held */
static void kcm_rcv_strparser(struct strparser *strp, struct sk_buff *skb)
{
 [...]
        if (kcm_queue_rcv_skb(&kcm->sk, skb)) {

In this case kcm->sk is not the same lock the comment is referring to.
And kcm_queue_rcv_skb() will eventually call sk_data_ready().

@Tom, how about wrapping the sk_data_ready call in {lock|release}_sock?
I don't have anything better in mind immediately.
The sock locks are taken in reverse order in the send path so so
grabbing kcm sock lock with lower lock held to call sk_data_ready may
lead to deadlock like I think.

It might be possible to change the order in the send path to do this.
Something like:

trylock on lower socket lock
-if trylock fails
  - release kcm sock lock
  - lock lower sock
  - lock kcm sock
- call sendpage locked function

I admit that dealing with two levels of socket locks in the data path
is quite a pain :-)
up

still happening and we've lost 50K+ test VMs on this

Re: WARNING in strp_data_ready

From: Dmitry Vyukov <dvyukov@google.com>
Date: 2017-12-27 18:25:58

On Wed, Dec 6, 2017 at 4:44 PM, Dmitry Vyukov [off-list ref] wrote:
quoted
[off-list ref] wrote:
quoted
On 10/24/2017 08:20 AM, syzbot wrote:
quoted
Hello,

syzkaller hit the following crash on 73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:181
 __warn+0x1c4/0x1d9 kernel/panic.c:542
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
 do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
 invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
 psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
Looks like KCM is calling sk_data_ready() without first taking the
sock lock.

/* Called with lower sock held */
static void kcm_rcv_strparser(struct strparser *strp, struct sk_buff *skb)
{
 [...]
        if (kcm_queue_rcv_skb(&kcm->sk, skb)) {

In this case kcm->sk is not the same lock the comment is referring to.
And kcm_queue_rcv_skb() will eventually call sk_data_ready().

@Tom, how about wrapping the sk_data_ready call in {lock|release}_sock?
I don't have anything better in mind immediately.
The sock locks are taken in reverse order in the send path so so
grabbing kcm sock lock with lower lock held to call sk_data_ready may
lead to deadlock like I think.

It might be possible to change the order in the send path to do this.
Something like:

trylock on lower socket lock
-if trylock fails
  - release kcm sock lock
  - lock lower sock
  - lock kcm sock
- call sendpage locked function

I admit that dealing with two levels of socket locks in the data path
is quite a pain :-)
up

still happening and we've lost 50K+ test VMs on this
up

Still happens and number of crashes crossed 60K, can we do something
with this please?

Re: WARNING in strp_data_ready

From: Tom Herbert <hidden>
Date: 2017-12-27 19:09:25

Did you try the patch I posted?


On Wed, Dec 27, 2017 at 10:25 AM, Dmitry Vyukov [off-list ref] wrote:
On Wed, Dec 6, 2017 at 4:44 PM, Dmitry Vyukov [off-list ref] wrote:
quoted
quoted
[off-list ref] wrote:
quoted
On 10/24/2017 08:20 AM, syzbot wrote:
quoted
Hello,

syzkaller hit the following crash on 73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:181
 __warn+0x1c4/0x1d9 kernel/panic.c:542
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
 do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
 invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
 psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
Looks like KCM is calling sk_data_ready() without first taking the
sock lock.

/* Called with lower sock held */
static void kcm_rcv_strparser(struct strparser *strp, struct sk_buff *skb)
{
 [...]
        if (kcm_queue_rcv_skb(&kcm->sk, skb)) {

In this case kcm->sk is not the same lock the comment is referring to.
And kcm_queue_rcv_skb() will eventually call sk_data_ready().

@Tom, how about wrapping the sk_data_ready call in {lock|release}_sock?
I don't have anything better in mind immediately.
The sock locks are taken in reverse order in the send path so so
grabbing kcm sock lock with lower lock held to call sk_data_ready may
lead to deadlock like I think.

It might be possible to change the order in the send path to do this.
Something like:

trylock on lower socket lock
-if trylock fails
  - release kcm sock lock
  - lock lower sock
  - lock kcm sock
- call sendpage locked function

I admit that dealing with two levels of socket locks in the data path
is quite a pain :-)
up

still happening and we've lost 50K+ test VMs on this
up

Still happens and number of crashes crossed 60K, can we do something
with this please?

Re: WARNING in strp_data_ready

From: Dmitry Vyukov <dvyukov@google.com>
Date: 2017-12-27 19:21:10

On Wed, Dec 27, 2017 at 8:09 PM, Tom Herbert [off-list ref] wrote:
Did you try the patch I posted?
Hi Tom,

No. And I didn't know I need to. Why?
If you think the patch needs additional testing, you can ask syzbot to
test it. See https://github.com/google/syzkaller/blob/master/docs/syzbot.md#communication-with-syzbot
Otherwise proceed with committing it. Or what are we waiting for?

Thanks


On Wed, Dec 27, 2017 at 10:25 AM, Dmitry Vyukov [off-list ref] wrote:
quoted
On Wed, Dec 6, 2017 at 4:44 PM, Dmitry Vyukov [off-list ref] wrote:
quoted
quoted
[off-list ref] wrote:
quoted
On 10/24/2017 08:20 AM, syzbot wrote:
quoted
Hello,

syzkaller hit the following crash on 73d3393ada4f70fa3df5639c8d438f2f034c0ecb
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


WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_me include/net/sock.h:1505 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 sock_owned_by_user include/net/sock.h:1511 [inline]
WARNING: CPU: 0 PID: 2996 at ./include/net/sock.h:1505 strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 2996 Comm: syzkaller142210 Not tainted 4.14.0-rc5+ #138
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:16 [inline]
 dump_stack+0x194/0x257 lib/dump_stack.c:52
 panic+0x1e4/0x417 kernel/panic.c:181
 __warn+0x1c4/0x1d9 kernel/panic.c:542
 report_bug+0x211/0x2d0 lib/bug.c:183
 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:178
 do_trap_no_signal arch/x86/kernel/traps.c:212 [inline]
 do_trap+0x260/0x390 arch/x86/kernel/traps.c:261
 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:298
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:311
 invalid_op+0x18/0x20 arch/x86/entry/entry_64.S:905
RIP: 0010:sock_owned_by_me include/net/sock.h:1505 [inline]
RIP: 0010:sock_owned_by_user include/net/sock.h:1511 [inline]
RIP: 0010:strp_data_ready+0x2b7/0x390 net/strparser/strparser.c:404
RSP: 0018:ffff8801db206b18 EFLAGS: 00010206
RAX: ffff8801d1e02080 RBX: ffff8801dad74c48 RCX: 0000000000000000
RDX: 0000000000000100 RSI: ffff8801d29fa0a0 RDI: ffffffff85cbede0
RBP: ffff8801db206b38 R08: 0000000000000005 R09: 1ffffffff0ce0bcd
R10: ffff8801db206a00 R11: dffffc0000000000 R12: ffff8801d29fa000
R13: ffff8801dad74c50 R14: ffff8801d4350a92 R15: 0000000000000001
 psock_data_ready+0x56/0x70 net/kcm/kcmsock.c:353
Looks like KCM is calling sk_data_ready() without first taking the
sock lock.

/* Called with lower sock held */
static void kcm_rcv_strparser(struct strparser *strp, struct sk_buff *skb)
{
 [...]
        if (kcm_queue_rcv_skb(&kcm->sk, skb)) {

In this case kcm->sk is not the same lock the comment is referring to.
And kcm_queue_rcv_skb() will eventually call sk_data_ready().

@Tom, how about wrapping the sk_data_ready call in {lock|release}_sock?
I don't have anything better in mind immediately.
The sock locks are taken in reverse order in the send path so so
grabbing kcm sock lock with lower lock held to call sk_data_ready may
lead to deadlock like I think.

It might be possible to change the order in the send path to do this.
Something like:

trylock on lower socket lock
-if trylock fails
  - release kcm sock lock
  - lock lower sock
  - lock kcm sock
- call sendpage locked function

I admit that dealing with two levels of socket locks in the data path
is quite a pain :-)
up

still happening and we've lost 50K+ test VMs on this
up

Still happens and number of crashes crossed 60K, can we do something
with this please?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help