KASAN: use-after-free Read in bpf_prog_kallsyms_add

4 views
Skip to first unread message

syzbot

unread,
Sep 2, 2019, 2:26:06 PM9/2/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 01fd1694 Linux 4.14.141
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=131a6d46600000
kernel config: https://syzkaller.appspot.com/x/.config?x=62c9b69e1b2adda9
dashboard link: https://syzkaller.appspot.com/bug?extid=7ef6f45e029aa6590abb
compiler: gcc (GCC) 9.0.0 20181231 (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+7ef6f4...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183
[inline]
BUG: KASAN: use-after-free in list_empty include/linux/list.h:203 [inline]
BUG: KASAN: use-after-free in bpf_prog_ksym_node_add kernel/bpf/core.c:369
[inline]
BUG: KASAN: use-after-free in bpf_prog_kallsyms_add+0x735/0x7b0
kernel/bpf/core.c:401
Read of size 8 at addr ffff8880a72b8148 by task syz-executor.3/20056
netlink: 11 bytes leftover after parsing attributes in process
`syz-executor.1'.

CPU: 1 PID: 20056 Comm: syz-executor.3 Not tainted 4.14.141 #37
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x138/0x197 lib/dump_stack.c:53
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
__read_once_size include/linux/compiler.h:183 [inline]
list_empty include/linux/list.h:203 [inline]
bpf_prog_ksym_node_add kernel/bpf/core.c:369 [inline]
bpf_prog_kallsyms_add+0x735/0x7b0 kernel/bpf/core.c:401
bpf_prog_load+0x78f/0xf30 kernel/bpf/syscall.c:1082
SYSC_bpf kernel/bpf/syscall.c:1503 [inline]
SyS_bpf+0x433/0x2da8 kernel/bpf/syscall.c:1469
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x459879
RSP: 002b:00007face409bc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000141
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459879
RDX: 0000000000000048 RSI: 00000000200054c0 RDI: 0000000000000005
RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007face409c6d4
R13: 00000000004bfcdc R14: 00000000004d19d8 R15: 00000000ffffffff

Allocated by task 20056:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc mm/kasan/kasan.c:551 [inline]
kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
kmalloc include/linux/slab.h:488 [inline]
kzalloc include/linux/slab.h:661 [inline]
bpf_prog_alloc+0x180/0x1e0 kernel/bpf/core.c:89
bpf_prog_load+0x292/0xf30 kernel/bpf/syscall.c:1030
SYSC_bpf kernel/bpf/syscall.c:1503 [inline]
SyS_bpf+0x433/0x2da8 kernel/bpf/syscall.c:1469
do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 18:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x45/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kfree+0xcc/0x270 mm/slab.c:3815
bpf_jit_free+0x89/0x310
bpf_prog_free_deferred+0x31/0x40 kernel/bpf/core.c:1480
process_one_work+0x863/0x1600 kernel/workqueue.c:2114
worker_thread+0x5d9/0x1050 kernel/workqueue.c:2248
kthread+0x319/0x430 kernel/kthread.c:232
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404

The buggy address belongs to the object at ffff8880a72b8100
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 72 bytes inside of
192-byte region [ffff8880a72b8100, ffff8880a72b81c0)
The buggy address belongs to the page:
page:ffffea00029cae00 count:1 mapcount:0 mapping:ffff8880a72b8000
index:0xffff8880a72b8200
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff8880a72b8000 ffff8880a72b8200 000000010000000c
raw: ffffea00017c1060 ffffea00028385a0 ffff8880aa800040 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
kobject: 'kvm' (ffff8880a71ac010): fill_kobj_path: path
= '/devices/virtual/misc/kvm'
ffff8880a72b8000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880a72b8080: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
> ffff8880a72b8100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880a72b8180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8880a72b8200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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 syzk...@googlegroups.com.

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

syzbot

unread,
Dec 31, 2019, 12:26:07 PM12/31/19
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages