Hello,
syzbot has tested the proposed patch but the reproducer still triggered
crash:
kernel BUG at include/linux/filter.h:LINE!
1965969 pages RAM
BPF area was writeable after setting rw ret:0
BPF ... purposely crashing now.
------------[ cut here ]------------
0 pages HighMem/MovableOnly
kernel BUG at include/linux/filter.h:742!
invalid opcode: 0000 [#1] SMP KASAN
340011 pages reserved
CPU: 0 PID: 6928 Comm: syz-executor7 Not tainted 4.18.0-rc1+ #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:bpf_jit_binary_lock_ro include/linux/filter.h:741 [inline]
RIP: 0010:bpf_int_jit_compile.cold.6+0x1fe/0x37c
arch/x86/net/bpf_jit_comp.c:1168
FAULT_INJECTION: forcing a failure.
name fail_page_alloc, interval 1, probability 0, space 0, times 0
Code:
CPU: 1 PID: 6950 Comm: syz-executor6 Not tainted 4.18.0-rc1+ #1
e0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
07
Call Trace:
83 c0
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
01
38
fail_dump lib/fault-inject.c:51 [inline]
should_fail.cold.4+0xa/0x1a lib/fault-inject.c:149
d0
7c
08
84
d2
0f
85
58
01
00
00
48
should_fail_alloc_page mm/page_alloc.c:3057 [inline]
prepare_alloc_pages mm/page_alloc.c:4325 [inline]
__alloc_pages_nodemask+0x36e/0xdb0 mm/page_alloc.c:4363
8b
85
c0 fe
ff ff
48
c7
c7 60
9b
e8
87
66
alloc_pages_current+0x10c/0x210 mm/mempolicy.c:2093
alloc_pages include/linux/gfp.h:492 [inline]
__vmalloc_area_node mm/vmalloc.c:1686 [inline]
__vmalloc_node_range+0x498/0x760 mm/vmalloc.c:1746
c7
40 02
kasan_module_alloc+0x65/0xa0 mm/kasan/kasan.c:632
00
00
module_alloc+0x8d/0xb0 arch/x86/kernel/module.c:92
e8
bpf_jit_binary_alloc+0x3b/0x140 kernel/bpf/core.c:593
c2
bpf_int_jit_compile+0x49e/0x1030 arch/x86/net/bpf_jit_comp.c:1152
f0 1c
00
<0f>
0b
4c
89
bpf_prog_select_runtime+0x8d9/0xbf0 kernel/bpf/core.c:1505
95
a0
fe
ff
ff
bpf_prog_load+0x119e/0x1cc0 kernel/bpf/syscall.c:1356
41
83
c7
01
e8
0c
fc
35
00
__do_sys_bpf kernel/bpf/syscall.c:2360 [inline]
__se_sys_bpf kernel/bpf/syscall.c:2322 [inline]
__x64_sys_bpf+0x36c/0x510 kernel/bpf/syscall.c:2322
48
8b 85
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
f0
RSP: 0018:ffff8801aff578e8 EFLAGS: 00010282
RAX: 000000000000001f RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81631ae1 RDI: 0000000000000001
RBP: ffff8801aff57a50 R08: ffff8801d8ca60c0 R09: ffffed003b5c3ec2
entry_SYSCALL_64_after_hwframe+0x49/0xbe
R10: ffffed003b5c3ec2 R11: ffff8801dae1f617 R12: ffffc900019a4004
RIP: 0033:0x455a99
R13: ffff8801aff57a28 R14: ffffffffa0008002 R15: ffff8801aff57968
Code:
FS: 00007f5012f8e700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
1d
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
ba fb
CR2: 00007f50675a0000 CR3: 00000001d3d70000 CR4: 00000000001406f0
ff
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
c3
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
66
Call Trace:
2e
0f
1f
84
00
00 00
bpf_prog_select_runtime+0x8d9/0xbf0 kernel/bpf/core.c:1505
00
00
66
90
48
bpf_prog_load+0x119e/0x1cc0 kernel/bpf/syscall.c:1356
89
f8
48
89
f7
48
__do_sys_bpf kernel/bpf/syscall.c:2360 [inline]
__se_sys_bpf kernel/bpf/syscall.c:2322 [inline]
__x64_sys_bpf+0x36c/0x510 kernel/bpf/syscall.c:2322
89
d6
48
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
89
ca
4d
89
c2
4d
entry_SYSCALL_64_after_hwframe+0x49/0xbe
89
RIP: 0033:0x455a99
c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb b9 fb ff c3 66 2e 0f
1f 84 00 00 00 00
RSP: 002b:00007f253b63ac68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f253b63b6d4 RCX: 0000000000455a99
RDX: 0000000000000048 RSI: 0000000020000240 RDI: 0000000000000005
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: 00000000004bb7d5 R14: 00000000004c8508 R15: 0000000000000023
syz-executor6: vmalloc: allocation failure, allocated 0 of 4096 bytes,
mode:0x6080c0(GFP_KERNEL|__GFP_ZERO), nodemask=(null)
syz-executor6 cpuset=syz6 mems_allowed=0
CPU: 1 PID: 6950 Comm: syz-executor6 Not tainted 4.18.0-rc1+ #1
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+0x1c9/0x2b4 lib/dump_stack.c:113
warn_alloc.cold.117+0xb7/0x1bd mm/page_alloc.c:3426
__vmalloc_area_node mm/vmalloc.c:1705 [inline]
__vmalloc_node_range+0x527/0x760 mm/vmalloc.c:1746
kasan_module_alloc+0x65/0xa0 mm/kasan/kasan.c:632
module_alloc+0x8d/0xb0 arch/x86/kernel/module.c:92
bpf_jit_binary_alloc+0x3b/0x140 kernel/bpf/core.c:593
bpf_int_jit_compile+0x49e/0x1030 arch/x86/net/bpf_jit_comp.c:1152
bpf_prog_select_runtime+0x8d9/0xbf0 kernel/bpf/core.c:1505
bpf_prog_load+0x119e/0x1cc0 kernel/bpf/syscall.c:1356
__do_sys_bpf kernel/bpf/syscall.c:2360 [inline]
__se_sys_bpf kernel/bpf/syscall.c:2322 [inline]
__x64_sys_bpf+0x36c/0x510 kernel/bpf/syscall.c:2322
do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x455a99
Code: 1d ba fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
48
Code:
89 d6
1d
48
ba
89
fb
ca
ff
4d
c3
89
66
c2
2e
4d
0f
89
1f
c8
84
4c
00
8b
00 00
4c
00
24
00
08
66
0f
90
05
48
<48>
89
3d
f8 48
01
89
f0
f7
ff
48
ff
89
0f
d6
83
48
eb
89
b9
ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 eb b9
fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f5012f8dc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 00007f5012f8e6d4 RCX: 0000000000455a99
RDX: 0000000000000048 RSI: 0000000020000240 RDI: 0000000000000005
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: 00000000004bb7d5 R14: 00000000004c8508 R15: 0000000000000023
Modules linked in:
Dumping ftrace buffer:
(ftrace buffer empty)
---[ end trace 8cd718223df1dec3 ]---
fb ff c3 66 2e 0f 1f 84 00 00
RIP: 0010:bpf_jit_binary_lock_ro include/linux/filter.h:741 [inline]
RIP: 0010:bpf_int_jit_compile.cold.6+0x1fe/0x37c
arch/x86/net/bpf_jit_comp.c:1168
00 00
RSP: 002b:00007f253b63ac68 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
Code:
RAX: ffffffffffffffda RBX: 00007f253b63b6d4 RCX: 0000000000455a99
RDX: 0000000000000048 RSI: 0000000020000240 RDI: 0000000000000005
RBP: 000000000072bea0 R08: 0000000000000000 R09: 0000000000000000
e0
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: 00000000004bb7d5 R14: 00000000004c8508 R15: 0000000000000023
warn_alloc_show_mem: 1 callbacks suppressed
Mem-Info:
07 83
active_anon:7935 inactive_anon:334 isolated_anon:0
active_file:6208 inactive_file:16674 isolated_file:0
unevictable:0 dirty:6414 writeback:0 unstable:0
slab_reclaimable:8716 slab_unreclaimable:105019
mapped:8193 shmem:345 pagetables:465 bounce:0
free:1454075 free_pcp:441 free_cma:0
c0 01
Node 0 active_anon:31740kB inactive_anon:1336kB active_file:24832kB
inactive_file:66696kB unevictable:0kB isolated(anon):0kB isolated(file):0kB
mapped:32772kB dirty:25656kB writeback:0kB shmem:1380kB shmem_thp: 0kB
shmem_pmdmapped: 0kB anon_thp: 16384kB writeback_tmp:0kB unstable:0kB
all_unreclaimable? no
38 d0
Node 0
7c 08
DMA free:15908kB min:164kB low:204kB high:244kB active_anon:0kB
inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB
writepending:0kB present:15992kB managed:15908kB mlocked:0kB
kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:0kB local_pcp:0kB
free_cma:0kB
84 d2
lowmem_reserve[]:
0f 85
0
58 01
2827
00 00
6331
48 8b
6331
85 c0
fe ff
Node 0
ff 48 c7
DMA32 free:2898232kB min:30100kB low:37624kB high:45148kB active_anon:0kB
inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB
writepending:0kB present:3129292kB managed:2898916kB mlocked:0kB
kernel_stack:0kB pagetables:0kB bounce:0kB free_pcp:684kB local_pcp:620kB
free_cma:0kB
c7 60
lowmem_reserve[]:
9b e8
0
87 66
0 3504 3504
Node 0
c7 40
Normal free:2902160kB min:37316kB low:46644kB high:55972kB
active_anon:31740kB inactive_anon:1336kB active_file:24832kB
inactive_file:66696kB unevictable:0kB writepending:25656kB
present:4718592kB managed:3589008kB mlocked:0kB kernel_stack:5280kB
pagetables:1860kB bounce:0kB free_pcp:1080kB local_pcp:464kB free_cma:0kB
02 00
lowmem_reserve[]:
00 e8
0
c2 f0
0
1c
0
00 <0f>
0
0b 4c
Node 0
89 95
DMA:
a0 fe
1*4kB
ff ff
(U)
41 83
0*8kB
c7 01
0*16kB
e8 0c
1*32kB
fc 35
(U)
00 48
2*64kB
8b 85
(U)
f0
1*128kB
RSP: 0018:ffff8801aff578e8 EFLAGS: 00010282
(U)
RAX: 000000000000001f RBX: 0000000000000000 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81631ae1 RDI: 0000000000000001
1*256kB
RBP: ffff8801aff57a50 R08: ffff8801d8ca60c0 R09: ffffed003b5c3ec2
R10: ffffed003b5c3ec2 R11: ffff8801dae1f617 R12: ffffc900019a4004
(U)
R13: ffff8801aff57a28 R14: ffffffffa0008002 R15: ffff8801aff57968
FS: 00007f5012f8e700(0000) GS:ffff8801dae00000(0000) knlGS:0000000000000000
0*512kB
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f50675a0000 CR3: 00000001d3d70000 CR4: 00000000001406f0
1*1024kB
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
(U)
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Tested on:
commit: 5d1a22263c89 debug2
git tree:
git://
git.kernel.org/pub/scm/linux/kernel/git/dborkman/bpf.git/bpf-test
console output:
https://syzkaller.appspot.com/x/log.txt?x=11e20cb0400000