KASAN: use-after-free Read in __list_add_valid (2)

Status: closed as invalid on 2018/01/19 22:57
Subsystems: net
[Documentation on labels]
First crash: 2426d, last: 2426d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __list_add_valid (5) rdma C 16 2300d 2306d 11/27 fixed on 2019/02/21 08:43
upstream KASAN: use-after-free Read in __list_add_valid (3) kvm net virt 16 2359d 2366d 4/27 fixed on 2018/02/04 11:35
upstream KASAN: use-after-free Read in __list_add_valid (4) rdma C 61 2309d 2324d 0/27 closed as dup on 2018/03/22 15:30
upstream KASAN: use-after-free Read in __list_add_valid syz 26 2462d 2510d 3/27 fixed on 2017/10/24 22:03

Sample crash report:
BUG: KASAN: use-after-free in __list_add_valid+0xb1/0xd0 lib/list_debug.c:23
Read of size 8 at addr ffff8801cd8154b0 by task syz-executor7/21005

CPU: 0 PID: 21005 Comm: syz-executor7 Not tainted 4.14.0-mm1+ #25
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+0x194/0x257 lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report+0x25b/0x340 mm/kasan/report.c:409
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
 __list_add_valid+0xb1/0xd0 lib/list_debug.c:23
 __list_add_rcu include/linux/rculist.h:52 [inline]
 list_add_rcu include/linux/rculist.h:79 [inline]
 dev_add_pack+0x113/0x2b0 net/core/dev.c:413
 register_prot_hook.part.51+0x95/0xb0 net/packet/af_packet.c:343
 register_prot_hook net/packet/af_packet.c:3063 [inline]
 packet_do_bind+0x326/0xc10 net/packet/af_packet.c:3129
 packet_bind+0x141/0x1a0 net/packet/af_packet.c:3182
 SYSC_bind+0x1b4/0x3f0 net/socket.c:1475
 SyS_bind+0x24/0x30 net/socket.c:1461
RIP: 0033:0x452879
RSP: 002b:00007f9aed733be8 EFLAGS: 00000212 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0000000000758020 RCX: 0000000000452879
RDX: 0000000000000014 RSI: 0000000020c85000 RDI: 0000000000000016
RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000212 R12: 00000000006ed280
R13: 00000000ffffffff R14: 00007f9aed7346d4 R15: 0000000000000000

Allocated by task 20958:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
 __do_kmalloc mm/slab.c:3712 [inline]
 __kmalloc+0x162/0x760 mm/slab.c:3721
 kmalloc include/linux/slab.h:519 [inline]
 sk_prot_alloc+0x101/0x2a0 net/core/sock.c:1469
 sk_alloc+0x89/0x700 net/core/sock.c:1523
 packet_create+0x169/0xb00 net/packet/af_packet.c:3213
 __sock_create+0x4d4/0x850 net/socket.c:1261
 sock_create net/socket.c:1301 [inline]
 SYSC_socket net/socket.c:1331 [inline]
 SyS_socket+0xeb/0x200 net/socket.c:1311

Freed by task 20980:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3492 [inline]
 kfree+0xca/0x250 mm/slab.c:3807
 sk_prot_free net/core/sock.c:1506 [inline]
 __sk_destruct+0x74a/0x910 net/core/sock.c:1585
 sk_destruct+0x47/0x80 net/core/sock.c:1593
 __sk_free+0x57/0x230 net/core/sock.c:1601
 sk_free+0x2a/0x40 net/core/sock.c:1612
 sock_put include/net/sock.h:1657 [inline]
 packet_release+0x883/0xde0 net/packet/af_packet.c:3047
 sock_release+0x8d/0x1e0 net/socket.c:596
 sock_close+0x16/0x20 net/socket.c:1125
 __fput+0x333/0x7f0 fs/file_table.c:210
 ____fput+0x15/0x20 fs/file_table.c:244
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ae0 kernel/exit.c:869
 do_group_exit+0x149/0x400 kernel/exit.c:972
 get_signal+0x73f/0x16c0 kernel/signal.c:2335
 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x214/0x310 arch/x86/entry/common.c:158
 prepare_exit_to_usermode arch/x86/entry/common.c:195 [inline]
 syscall_return_slowpath+0x490/0x550 arch/x86/entry/common.c:264

The buggy address belongs to the object at ffff8801cd814cc0
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 2032 bytes inside of
 2048-byte region [ffff8801cd814cc0, ffff8801cd8154c0)
The buggy address belongs to the page:
page:ffffea0007360500 count:1 mapcount:0 mapping:ffff8801cd814440 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801cd814440 0000000000000000 0000000100000003
raw: ffffea0007375e20 ffffea00072bdda0 ffff8801db000c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801cd815380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801cd815400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801cd815480: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8801cd815500: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff8801cd815580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2017/11/26 04:34 mmots 1ea8d039f9ed deb5f6ae .config console log report ci-upstream-mmots-kasan-gce
* Struck through repros no longer work on HEAD.