syzbot


KASAN: invalid-free in packet_set_ring

Status: auto-obsoleted due to no activity on 2023/04/20 06:54
Reported-by: syzbot+163e3e00f1e56ce10d9b@syzkaller.appspotmail.com
First crash: 874d, last: 874d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: invalid-free in packet_set_ring C error 1 874d 874d 0/1 upstream: reported C repro on 2021/12/12 11:35
upstream KASAN: invalid-free in packet_set_ring net C inconclusive 4 873d 874d 20/26 fixed on 2022/03/08 16:11
Last patch testing requests (1)
Created Duration User Patch Repo Result
2023/04/20 06:28 25m retest repro android12-5.4 OK log

Sample crash report:
==================================================================
BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3073 [inline]
BUG: KASAN: double-free or invalid-free in kfree+0xe0/0x660 mm/slub.c:4064

CPU: 0 PID: 10351 Comm: syz-executor300 Not tainted 5.4.147-syzkaller-00006-g4fd09f7a7972 #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+0x18e/0x1de lib/dump_stack.c:118
 print_address_description+0x9b/0x650 mm/kasan/report.c:384
 kasan_report_invalid_free+0x54/0x120 mm/kasan/report.c:478
 __kasan_slab_free+0x10e/0x240 mm/kasan/common.c:475
 slab_free_hook mm/slub.c:1455 [inline]
 slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1493
 slab_free mm/slub.c:3073 [inline]
 kfree+0xe0/0x660 mm/slub.c:4064
 packet_set_ring+0x1830/0x25a0 net/packet/af_packet.c:4456
 packet_setsockopt+0xa9b/0x3920 net/packet/af_packet.c:3720
 __sys_setsockopt+0x471/0x700 net/socket.c:2074
 __do_sys_setsockopt net/socket.c:2090 [inline]
 __se_sys_setsockopt net/socket.c:2087 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2087
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fefcd8c1a19
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 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 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fefcd852318 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00007fefcd9493f8 RCX: 00007fefcd8c1a19
RDX: 0000000000000005 RSI: 0000000000000107 RDI: 0000000000000003
RBP: 00007fefcd9493f0 R08: 000000000000001c R09: 0000000000000000
R10: 00000000200000c0 R11: 0000000000000246 R12: 00007fefcd917074
R13: 00007fffb3b3052f R14: 00007fefcd852400 R15: 0000000000022000

Allocated by task 10346:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 __kasan_kmalloc+0x137/0x1e0 mm/kasan/common.c:529
 __kmalloc+0x174/0x2f0 mm/slub.c:3906
 kmalloc_array include/linux/slab.h:618 [inline]
 kcalloc include/linux/slab.h:629 [inline]
 alloc_pg_vec net/packet/af_packet.c:4278 [inline]
 packet_set_ring+0x5e7/0x25a0 net/packet/af_packet.c:4368
 packet_setsockopt+0xa9b/0x3920 net/packet/af_packet.c:3720
 __sys_setsockopt+0x471/0x700 net/socket.c:2074
 __do_sys_setsockopt net/socket.c:2090 [inline]
 __se_sys_setsockopt net/socket.c:2087 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2087
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 10346:
 save_stack mm/kasan/common.c:70 [inline]
 set_track mm/kasan/common.c:78 [inline]
 kasan_set_free_info mm/kasan/common.c:345 [inline]
 __kasan_slab_free+0x18a/0x240 mm/kasan/common.c:487
 slab_free_hook mm/slub.c:1455 [inline]
 slab_free_freelist_hook+0x7b/0x150 mm/slub.c:1493
 slab_free mm/slub.c:3073 [inline]
 kfree+0xe0/0x660 mm/slub.c:4064
 free_pg_vec net/packet/af_packet.c:4244 [inline]
 packet_set_ring+0x1958/0x25a0 net/packet/af_packet.c:4458
 packet_setsockopt+0xa9b/0x3920 net/packet/af_packet.c:3720
 __sys_setsockopt+0x471/0x700 net/socket.c:2074
 __do_sys_setsockopt net/socket.c:2090 [inline]
 __se_sys_setsockopt net/socket.c:2087 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2087
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8881e844c200
 which belongs to the cache kmalloc-64 of size 64
The buggy address is located 0 bytes inside of
 64-byte region [ffff8881e844c200, ffff8881e844c240)
The buggy address belongs to the page:
page:ffffea0007a11300 refcount:1 mapcount:0 mapping:ffff8881f5c03180 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 ffffea0007a10d80 0000000a0000000a ffff8881f5c03180
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x19a/0x380 mm/page_alloc.c:2171
 get_page_from_freelist+0x550/0x8b0 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x2d6/0x740 mm/page_alloc.c:4855
 alloc_slab_page+0x39/0x3e0 mm/slub.c:343
 allocate_slab mm/slub.c:1676 [inline]
 new_slab+0x97/0x460 mm/slub.c:1742
 new_slab_objects mm/slub.c:2499 [inline]
 ___slab_alloc+0x330/0x4c0 mm/slub.c:2660
 __slab_alloc mm/slub.c:2700 [inline]
 slab_alloc_node mm/slub.c:2785 [inline]
 slab_alloc mm/slub.c:2830 [inline]
 kmem_cache_alloc_trace+0x199/0x2b0 mm/slub.c:2847
 kmalloc include/linux/slab.h:556 [inline]
 kernfs_get_open_node fs/kernfs/file.c:571 [inline]
 kernfs_fop_open+0x859/0xad0 fs/kernfs/file.c:717
 do_dentry_open+0x7e6/0xef0 fs/open.c:796
 do_last fs/namei.c:3495 [inline]
 path_openat+0xfed/0x3a50 fs/namei.c:3612
 do_filp_open+0x19a/0x3a0 fs/namei.c:3642
 do_sys_open+0x2e2/0x6d0 fs/open.c:1113
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881e844c100: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881e844c180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
>ffff8881e844c200: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                   ^
 ffff8881e844c280: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
 ffff8881e844c300: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/12/12 11:33 android12-5.4 4fd09f7a7972 49ca1f59 .config console log report syz C ci2-android-5-4-kasan KASAN: invalid-free in packet_set_ring
* Struck through repros no longer work on HEAD.