syzbot


KASAN: slab-out-of-bounds Write in legacy_parse_param

Status: upstream: reported C repro on 2022/01/01 00:53
Reported-by: syzbot+02b637bea12b3944b0b9@syzkaller.appspotmail.com
First crash: 274d, last: 274d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: slab-out-of-bounds Write in legacy_parse_param C error 1 274d 274d 1/2 fixed on 2022/01/27 16:02
upstream general protection fault in legacy_parse_param C done 20 194d 456d 23/24 upstream: reported C repro on 2021/07/03 05:41

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in legacy_parse_param+0x4c1/0x720 fs/fs_context.c:603
Write of size 92 at addr ffff8881ddd77000 by task syz-executor999/306

CPU: 1 PID: 306 Comm: syz-executor999 Not tainted 5.4.147-syzkaller-00015-g5b673be0c6b0 #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+0x182/0x260 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x2a5/0x2e0 mm/kasan/generic.c:191
 memcpy+0x38/0x50 mm/kasan/common.c:124
 legacy_parse_param+0x4c1/0x720 fs/fs_context.c:603
 vfs_parse_fs_param+0x20f/0x430 fs/fs_context.c:145
 vfs_fsconfig_locked fs/fsopen.c:265 [inline]
 __do_sys_fsconfig fs/fsopen.c:445 [inline]
 __se_sys_fsconfig+0xc6b/0xf40 fs/fsopen.c:314
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fc100c69939
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 a1 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 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fc100c17208 EFLAGS: 00000246 ORIG_RAX: 00000000000001af
RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 00007fc100c69939
RDX: 0000000020000280 RSI: 0000000000000001 RDI: 0000000000000003
RBP: 00007fc100cf24a0 R08: 0000000000000000 R09: 00007fc100cf24a8
R10: 00000000200000c0 R11: 0000000000000246 R12: 00007fc100cf24ac
R13: 00007ffe217a312f R14: 00007fc100c17300 R15: 0000000000022000

Allocated by task 307:
 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
 kmem_cache_alloc_trace+0x139/0x2b0 mm/slub.c:2849
 kmalloc include/linux/slab.h:556 [inline]
 legacy_parse_param+0x421/0x720 fs/fs_context.c:596
 vfs_parse_fs_param+0x20f/0x430 fs/fs_context.c:145
 vfs_fsconfig_locked fs/fsopen.c:265 [inline]
 __do_sys_fsconfig fs/fsopen.c:445 [inline]
 __se_sys_fsconfig+0xc6b/0xf40 fs/fsopen.c:314
 do_syscall_64+0xcb/0x1e0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8881ddd76000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 0 bytes to the right of
 4096-byte region [ffff8881ddd76000, ffff8881ddd77000)
The buggy address belongs to the page:
page:ffffea0007775c00 refcount:1 mapcount:0 mapping:ffff8881f5c0c280 index:0x0 compound_mapcount: 0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c280
raw: 0000000000000000 0000000080040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC)
 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]
 __kmalloc_track_caller+0x1d1/0x2e0 mm/slub.c:4442
 __kmalloc_reserve net/core/skbuff.c:142 [inline]
 __alloc_skb+0xaf/0x4d0 net/core/skbuff.c:210
 alloc_skb include/linux/skbuff.h:1060 [inline]
 nlmsg_new include/net/netlink.h:888 [inline]
 rtmsg_ifinfo_build_skb+0x81/0x180 net/core/rtnetlink.c:3501
 rtmsg_ifinfo_event net/core/rtnetlink.c:3537 [inline]
 rtmsg_ifinfo+0x73/0x120 net/core/rtnetlink.c:3546
 netdev_state_change+0x11a/0x1a0 net/core/dev.c:1275
 linkwatch_do_dev+0xca/0x120 net/core/link_watch.c:159
 __linkwatch_run_queue+0x49e/0x7a0 net/core/link_watch.c:205
 linkwatch_event+0x48/0x50 net/core/link_watch.c:244
 process_one_work+0x679/0x1030 kernel/workqueue.c:2278
 worker_thread+0xa6f/0x1400 kernel/workqueue.c:2424
page_owner free stack trace missing

Memory state around the buggy address:
 ffff8881ddd76f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881ddd76f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881ddd77000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff8881ddd77080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8881ddd77100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-android-5-4-kasan 2022/01/01 01:07 android12-5.4 5b673be0c6b0 36bd2e48 .config log report syz C KASAN: slab-out-of-bounds Write in legacy_parse_param
ci2-android-5-4-kasan 2022/01/01 00:53 android12-5.4 5b673be0c6b0 36bd2e48 .config log report info KASAN: slab-out-of-bounds Write in legacy_parse_param
* Struck through repros no longer work on HEAD.