"WARNING: locking bug in do_ipv6_setsockopt" should share the same root cause with "WARNING: locking bug in do_ipv6_getsockopt"

2021-01-13 Thread 慕冬亮
I found that on the syzbot dashboard, “WARNING: locking bug in
do_ipv6_setsockopt”(https://syzkaller.appspot.com/bug?id=6a970baf20aa5a64455be86fb920f468def703c6)
and
"WARNING: locking bug in do_ipv6_getsockopt"
(https://syzkaller.appspot.com/bug?id=e97be0bf4d30813e951bcc6249e72c592a790164)
should share the same root cause.

The reason for my above statement is that their PoCs have a high
similarity except for the last syscall - "setsockopt vs getsockopt".
In the last syscall, when it invokes lock_sock(sk) and accesses
sk->sk_lock.slock, the WARNING happens.

If you can have any issues with this statement or our information is
useful to you, please let us know. Thanks very much.

--
My best regards to you.

 No System Is Safe!
 Dongliang Mu


Re: WARNING: locking bug in do_ipv6_getsockopt

2019-07-02 Thread Eric Dumazet



On 7/2/19 9:17 AM, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:    6fbc7275 Linux 5.2-rc7
> git tree:   upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=13fb8fe5a0
> kernel config:  https://syzkaller.appspot.com/x/.config?x=f6451f0da3d42d53
> dashboard link: https://syzkaller.appspot.com/bug?extid=babfdd7368c72aac3875
> compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=1460390ba0
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+babfdd7368c72aac3...@syzkaller.appspotmail.com
> 
> WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735 
> arch_local_save_flags arch/x86/include/asm/paravirt.h:762 [inline]
> WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735 
> arch_local_save_flags arch/x86/include/asm/paravirt.h:760 [inline]
> WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735 look_up_lock_class 
> kernel/locking/lockdep.c:726 [inline]
> WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735 
> register_lock_class+0xe10/0x1860 kernel/locking/lockdep.c:1079

WARN_ON_ONCE(class->name != lock->name);

Might be useful to trace the content of class->name and lock->name.


> Kernel panic - not syncing: panic_on_warn set ...
> CPU: 1 PID: 18374 Comm: syz-executor.0 Not tainted 5.2.0-rc7 #65
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS 
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:77 [inline]
>  dump_stack+0x172/0x1f0 lib/dump_stack.c:113
>  panic+0x2cb/0x744 kernel/panic.c:219
>  __warn.cold+0x20/0x4d kernel/panic.c:576
>  report_bug+0x263/0x2b0 lib/bug.c:186
>  fixup_bug arch/x86/kernel/traps.c:179 [inline]
>  fixup_bug arch/x86/kernel/traps.c:174 [inline]
>  do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:272
>  do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:291
>  invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:986
> RIP: 0010:look_up_lock_class kernel/locking/lockdep.c:735 [inline]
> RIP: 0010:register_lock_class+0xe10/0x1860 kernel/locking/lockdep.c:1079
> Code: 00 48 89 da 4d 8b 76 c0 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80 3c 
> 02 00 0f 85 23 07 00 00 4c 89 33 e9 e3 f4 ff ff 0f 0b <0f> 0b e9 ea f3 ff ff 
> 44 89 e0 4c 8b 95 50 ff ff ff 83 c0 01 4c 8b
> RSP: 0018:88809ea3f678 EFLAGS: 00010087
> RAX: dc00 RBX: 888090b948e0 RCX: 
> RDX: 11101217291f RSI:  RDI: 888090b948f8
> RBP: 88809ea3f740 R08: 111013d47ed7 R09: 8a65ad40
> R10: 8a2e9180 R11:  R12: 8a3243a0
> R13:  R14:  R15: 88023e60
>  __lock_acquire+0x116/0x5490 kernel/locking/lockdep.c:3674
>  lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303
>  __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
>  _raw_spin_lock_bh+0x33/0x50 kernel/locking/spinlock.c:175
>  spin_lock_bh include/linux/spinlock.h:343 [inline]
>  lock_sock_nested+0x41/0x120 net/core/sock.c:2913
>  lock_sock include/net/sock.h:1522 [inline]
>  do_ipv6_getsockopt.isra.0+0x289/0x2590 net/ipv6/ipv6_sockglue.c:1167
>  ipv6_getsockopt+0x186/0x280 net/ipv6/ipv6_sockglue.c:1391
>  udpv6_getsockopt+0x68/0xa0 net/ipv6/udp.c:1590
>  sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085
>  __sys_getsockopt+0x15f/0x240 net/socket.c:2109
>  __do_sys_getsockopt net/socket.c:2120 [inline]
>  __se_sys_getsockopt net/socket.c:2117 [inline]
>  __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117
>  do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> RIP: 0033:0x4597c9
> Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 
> 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 
> 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:7fb5fd78ac78 EFLAGS: 0246 ORIG_RAX: 0037
> RAX: ffda RBX: 0005 RCX: 004597c9
> RDX: 0036 RSI: 0029 RDI: 0004
> RBP: 0075bfc8 R08: 2080 R09: 
> R10:  R11: 0246 R12: 7fb5fd78b6d4
> R13: 004c0803 R14: 004d2b88 R15: 
> Kernel Offset: disabled
> Rebooting in 86400 seconds..
> 
> 
> ---
> This bug is generated by a bot. It may contain errors.
> See https://goo.gl/tpsmEJ for more information about syzbot.
> syzbot engineers can be reached at syzkal...@googlegroups.com.
> 
> syzbot will keep track of this bug report. See:
> https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> syzbot can test patches for this bug, for details see:
> https://goo.gl/tpsmEJ#testing-patches


WARNING: locking bug in do_ipv6_getsockopt

2019-07-02 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:6fbc7275 Linux 5.2-rc7
git tree:   upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13fb8fe5a0
kernel config:  https://syzkaller.appspot.com/x/.config?x=f6451f0da3d42d53
dashboard link: https://syzkaller.appspot.com/bug?extid=babfdd7368c72aac3875
compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=1460390ba0

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+babfdd7368c72aac3...@syzkaller.appspotmail.com

WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735  
arch_local_save_flags arch/x86/include/asm/paravirt.h:762 [inline]
WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735  
arch_local_save_flags arch/x86/include/asm/paravirt.h:760 [inline]
WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735  
look_up_lock_class kernel/locking/lockdep.c:726 [inline]
WARNING: CPU: 1 PID: 18374 at kernel/locking/lockdep.c:735  
register_lock_class+0xe10/0x1860 kernel/locking/lockdep.c:1079

Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 18374 Comm: syz-executor.0 Not tainted 5.2.0-rc7 #65
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x172/0x1f0 lib/dump_stack.c:113
 panic+0x2cb/0x744 kernel/panic.c:219
 __warn.cold+0x20/0x4d kernel/panic.c:576
 report_bug+0x263/0x2b0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:179 [inline]
 fixup_bug arch/x86/kernel/traps.c:174 [inline]
 do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:272
 do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:291
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:986
RIP: 0010:look_up_lock_class kernel/locking/lockdep.c:735 [inline]
RIP: 0010:register_lock_class+0xe10/0x1860 kernel/locking/lockdep.c:1079
Code: 00 48 89 da 4d 8b 76 c0 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 80  
3c 02 00 0f 85 23 07 00 00 4c 89 33 e9 e3 f4 ff ff 0f 0b <0f> 0b e9 ea f3  
ff ff 44 89 e0 4c 8b 95 50 ff ff ff 83 c0 01 4c 8b

RSP: 0018:88809ea3f678 EFLAGS: 00010087
RAX: dc00 RBX: 888090b948e0 RCX: 
RDX: 11101217291f RSI:  RDI: 888090b948f8
RBP: 88809ea3f740 R08: 111013d47ed7 R09: 8a65ad40
R10: 8a2e9180 R11:  R12: 8a3243a0
R13:  R14:  R15: 88023e60
 __lock_acquire+0x116/0x5490 kernel/locking/lockdep.c:3674
 lock_acquire+0x16f/0x3f0 kernel/locking/lockdep.c:4303
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline]
 _raw_spin_lock_bh+0x33/0x50 kernel/locking/spinlock.c:175
 spin_lock_bh include/linux/spinlock.h:343 [inline]
 lock_sock_nested+0x41/0x120 net/core/sock.c:2913
 lock_sock include/net/sock.h:1522 [inline]
 do_ipv6_getsockopt.isra.0+0x289/0x2590 net/ipv6/ipv6_sockglue.c:1167
 ipv6_getsockopt+0x186/0x280 net/ipv6/ipv6_sockglue.c:1391
 udpv6_getsockopt+0x68/0xa0 net/ipv6/udp.c:1590
 sock_common_getsockopt+0x94/0xd0 net/core/sock.c:3085
 __sys_getsockopt+0x15f/0x240 net/socket.c:2109
 __do_sys_getsockopt net/socket.c:2120 [inline]
 __se_sys_getsockopt net/socket.c:2117 [inline]
 __x64_sys_getsockopt+0xbe/0x150 net/socket.c:2117
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4597c9
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00

RSP: 002b:7fb5fd78ac78 EFLAGS: 0246 ORIG_RAX: 0037
RAX: ffda RBX: 0005 RCX: 004597c9
RDX: 0036 RSI: 0029 RDI: 0004
RBP: 0075bfc8 R08: 2080 R09: 
R10:  R11: 0246 R12: 7fb5fd78b6d4
R13: 004c0803 R14: 004d2b88 R15: 
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches