Re: BUG: using smp_processor_id() in preemptible code in debug_smp_processor_id

From: Eric Biggers
Date: Fri Jun 05 2020 - 00:06:13 EST


On Thu, Jun 04, 2020 at 07:42:18AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit: 065fcfd4 selftests: net: ip_defrag: ignore EPERM
> git tree: net-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=15c3e516100000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d89141553e61b775
> dashboard link: https://syzkaller.appspot.com/bug?extid=9e0b179ae55eaf7a307a
> compiler: gcc (GCC) 9.0.0 20181231 (experimental)
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=131b5cf2100000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=176dfcf2100000
>
> The bug was bisected to:
>
> commit e42671084361302141a09284fde9bbc14fdd16bf
> Author: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> Date: Thu May 7 12:53:06 2020 +0000
>
> net: qrtr: Do not depend on ARCH_QCOM
>
> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1295eb91100000
> final crash: https://syzkaller.appspot.com/x/report.txt?x=1195eb91100000
> console output: https://syzkaller.appspot.com/x/log.txt?x=1695eb91100000
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+9e0b179ae55eaf7a307a@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: e42671084361 ("net: qrtr: Do not depend on ARCH_QCOM")
>
> RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000004
> RBP: 00000000006cb018 R08: 0000000000000001 R09: 00000000004002c8
> R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401e90
> R13: 0000000000401f20 R14: 0000000000000000 R15: 0000000000000000
> BUG: using smp_processor_id() in preemptible [00000000] code: syz-executor013/7182
> caller is radix_tree_node_alloc.constprop.0+0x200/0x330 lib/radix-tree.c:264
> CPU: 0 PID: 7182 Comm: syz-executor013 Not tainted 5.7.0-rc7-syzkaller #0
> 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+0x188/0x20d lib/dump_stack.c:118
> check_preemption_disabled lib/smp_processor_id.c:47 [inline]
> debug_smp_processor_id.cold+0x88/0x9b lib/smp_processor_id.c:57
> radix_tree_node_alloc.constprop.0+0x200/0x330 lib/radix-tree.c:264
> radix_tree_extend+0x234/0x4a0 lib/radix-tree.c:426
> idr_get_free+0x60c/0x8e0 lib/radix-tree.c:1494
> idr_alloc_u32+0x170/0x2d0 lib/idr.c:46
> idr_alloc+0xc2/0x130 lib/idr.c:87
> qrtr_port_assign net/qrtr/qrtr.c:703 [inline]
> __qrtr_bind.isra.0+0x12e/0x5c0 net/qrtr/qrtr.c:756
> qrtr_autobind net/qrtr/qrtr.c:787 [inline]
> qrtr_autobind+0xaf/0xf0 net/qrtr/qrtr.c:775
> qrtr_sendmsg+0x1d6/0x770 net/qrtr/qrtr.c:895
> sock_sendmsg_nosec net/socket.c:652 [inline]
> sock_sendmsg+0xcf/0x120 net/socket.c:672
> ____sys_sendmsg+0x6e6/0x810 net/socket.c:2352
> ___sys_sendmsg+0x100/0x170 net/socket.c:2406
> __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439
> do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
> entry_SYSCALL_64_after_hwframe+0x49/0xb3
> RIP: 0033:0x4405a9
> Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 5b 14 fc ff c3 66 2e 0f 1f 84 00 00 00 00
> RSP: 002b:00007ffe905331b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
> RAX: ffffffffffffffda RBX: 00000000004a1bd8 RCX: 00000000004405a9
> RDX: 0000000000000000 RSI: 00000000

#syz dup: BUG: using smp_processor_id() in preemptible code in radix_tree_node_alloc

See discussion at https://lkml.kernel.org/lkml/000000000000a363b205a74ca6a2@xxxxxxxxxx/T/#u