general protection fault in bpf_prog_kallsyms_add

From: syzbot
Date: Thu Nov 29 2018 - 06:46:07 EST


Hello,

syzbot found the following crash on:

HEAD commit: 295daee4ba10 selftests/bpf: add config fragment CONFIG_FTR..
git tree: bpf-next
console output: https://syzkaller.appspot.com/x/log.txt?x=177cc5f5400000
kernel config: https://syzkaller.appspot.com/x/.config?x=c36a72af2123e78a
dashboard link: https://syzkaller.appspot.com/bug?extid=876c69d3b667c06f1971
compiler: gcc (GCC) 8.0.1 20180413 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+876c69d3b667c06f1971@xxxxxxxxxxxxxxxxxxxxxxxxx

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 30162 Comm: syz-executor4 Not tainted 4.20.0-rc3+ #158
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__read_once_size include/linux/compiler.h:182 [inline]
RIP: 0010:list_empty include/linux/list.h:226 [inline]
RIP: 0010:bpf_prog_ksym_node_add kernel/bpf/core.c:473 [inline]
RIP: 0010:bpf_prog_kallsyms_add+0x18f/0x9b0 kernel/bpf/core.c:505
Code: 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 d3 07 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 74 24 20 49 8d 5e 68 48 89 da 48 c1 ea 03 <80> 3c 02 00 0f 85 b9 07 00 00 4c 8d a5 58 ff ff ff 4d 8b 6e 68 48
RSP: 0018:ffff8881b305f998 EFLAGS: 00010a03
RAX: dffffc0000000000 RBX: 800000019811706f RCX: 0000000000000001
RDX: 1000000033022e0d RSI: 0000000000000004 RDI: ffffc9000197d020
RBP: ffff8881b305fb08 R08: ffffed103660bf21 R09: ffffed103660bf20
R10: ffffed103660bf20 R11: 0000000000000003 R12: ffffc9000197d000
R13: ffff8881b305fcf8 R14: 8000000198117007 R15: 1ffff1103660bf38
FS: 00007fd823c2d700(0000) GS:ffff8881daf00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000a40021 CR3: 00000001d7f0d000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
bpf_prog_load+0x13c8/0x1c30 kernel/bpf/syscall.c:1554
__do_sys_bpf kernel/bpf/syscall.c:2538 [inline]
__se_sys_bpf kernel/bpf/syscall.c:2500 [inline]
__x64_sys_bpf+0x36f/0x520 kernel/bpf/syscall.c:2500
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457569
Code: fd b3 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 b3 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fd823c2cc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000457569
RDX: 0000000000000048 RSI: 0000000020000200 RDI: 0000000000000005
RBP: 000000000072bfa0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fd823c2d6d4
R13: 00000000004bda3c R14: 00000000004ccd10 R15: 00000000ffffffff
Modules linked in:
---[ end trace 101945b7574ca4df ]---
kobject: 'loop0' (00000000a634eda0): kobject_uevent_env
RIP: 0010:__read_once_size include/linux/compiler.h:182 [inline]
RIP: 0010:list_empty include/linux/list.h:226 [inline]
RIP: 0010:bpf_prog_ksym_node_add kernel/bpf/core.c:473 [inline]
RIP: 0010:bpf_prog_kallsyms_add+0x18f/0x9b0 kernel/bpf/core.c:505
Code: 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 d3 07 00 00 48 b8 00 00 00 00 00 fc ff df 4d 8b 74 24 20 49 8d 5e 68 48 89 da 48 c1 ea 03 <80> 3c 02 00 0f 85 b9 07 00 00 4c 8d a5 58 ff ff ff 4d 8b 6e 68 48
RSP: 0018:ffff8881b305f998 EFLAGS: 00010a03
RAX: dffffc0000000000 RBX: 800000019811706f RCX: 0000000000000001
RDX: 1000000033022e0d RSI: 0000000000000004 RDI: ffffc9000197d020
RBP: ffff8881b305fb08 R08: ffffed103660bf21 R09: ffffed103660bf20
R10: ffffed103660bf20 R11: 0000000000000003 R12: ffffc9000197d000
R13: ffff8881b305fcf8 R14: 8000000198117007 R15: 1ffff1103660bf38
FS: 00007fd823c2d700(0000) GS:ffff8881daf00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000a40021 CR3: 00000001d7f0d000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
kobject: 'loop0' (00000000a634eda0): fill_kobj_path: path = '/devices/virtual/block/loop0'


---
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 syzkaller@xxxxxxxxxxxxxxxxx

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.