KASAN: use-after-free Read in zswap_frontswap_store

Status: upstream: reported on 2026/10/16 00:19
Reported-by: syzbot+cc195321608f292184be@syzkaller.appspotmail.com
First crash: 2d15h, last: 2d15h
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KMSAN: uninit-value in zswap_frontswap_store mm 7 syz, C 4027 937d 1221d 0/29 auto-obsoleted due to no activity on 2024/06/01 21:32

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in zswap_frontswap_store+0x144e/0x1530 mm/zswap.c:1182
Read of size 4 at addr ffff88802adf0e44 by task syz.0.308/5471

CPU: 0 PID: 5471 Comm: syz.0.308 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 zswap_frontswap_store+0x144e/0x1530 mm/zswap.c:1182
 __frontswap_store+0x331/0x4a0 mm/frontswap.c:276
 frontswap_store include/linux/frontswap.h:90 [inline]
 swap_writepage+0x5f/0xa0 mm/page_io.c:197
 shmem_writepage+0x106c/0x13b0 mm/shmem.c:1448
 pageout mm/vmscan.c:1082 [inline]
 shrink_page_list+0x43a8/0x6de0 mm/vmscan.c:1669
 shrink_inactive_list mm/vmscan.c:2223 [inline]
 shrink_list mm/vmscan.c:2450 [inline]
 shrink_lruvec+0x1315/0x25a0 mm/vmscan.c:2769
 shrink_node_memcgs mm/vmscan.c:2956 [inline]
 shrink_node+0x1190/0x2790 mm/vmscan.c:3079
 shrink_zones mm/vmscan.c:3285 [inline]
 do_try_to_free_pages+0x60e/0x1600 mm/vmscan.c:3340
 try_to_free_mem_cgroup_pages+0x347/0x800 mm/vmscan.c:3654
 mem_cgroup_resize_max+0x2f7/0x3c0 mm/memcontrol.c:3414
 mem_cgroup_write+0x1ee/0x230 mm/memcontrol.c:-1
 cgroup_file_write+0x2c4/0x670 kernel/cgroup/cgroup.c:3967
 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2179 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f94f70af559
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f94f5307028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f94f7336fa0 RCX: 00007f94f70af559
RDX: 0000000000000001 RSI: 0000200000000080 RDI: 0000000000000003
RBP: 00007f94f71468b0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f94f7337038 R14: 00007f94f7336fa0 R15: 00007ffc2a854058
 </TASK>

Allocated by task 1:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xaf/0xe0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:612 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 __acomp_request_alloc include/crypto/internal/acompress.h:41 [inline]
 acomp_request_alloc+0x44/0x110 crypto/acompress.c:125
 zswap_cpu_comp_prepare+0xde/0x3c0 mm/zswap.c:460
 cpuhp_invoke_callback+0x481/0x7e0 kernel/cpu.c:201
 cpuhp_issue_call+0x3d3/0x760 kernel/cpu.c:-1
 __cpuhp_state_add_instance_cpuslocked+0x24b/0x6c0 kernel/cpu.c:2020
 __cpuhp_state_add_instance+0x21/0x30 kernel/cpu.c:2041
 cpuhp_state_add_instance include/linux/cpuhotplug.h:391 [inline]
 zswap_pool_create+0x24d/0x5e0 mm/zswap.c:625
 init_zswap+0x11c/0x2d0 mm/zswap.c:1463
 do_one_initcall+0x272/0x730 init/main.c:1276
 do_initcall_level+0x13d/0x1f0 init/main.c:1349
 do_initcalls+0x4b/0x90 init/main.c:1365
 kernel_init_freeable+0x3d5/0x560 init/main.c:1589
 kernel_init+0x19/0x1b0 init/main.c:1480
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 5472:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1710 [inline]
 slab_free_freelist_hook+0xec/0x170 mm/slub.c:1736
 slab_free mm/slub.c:3504 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4564
 zswap_cpu_comp_dead+0xe9/0x160 mm/zswap.c:491
 cpuhp_invoke_callback+0x321/0x7e0 kernel/cpu.c:213
 __cpuhp_invoke_callback_range kernel/cpu.c:677 [inline]
 cpuhp_invoke_callback_range kernel/cpu.c:701 [inline]
 cpuhp_down_callbacks kernel/cpu.c:1130 [inline]
 _cpu_down+0x455/0xbb0 kernel/cpu.c:1191
 cpu_down_maps_locked kernel/cpu.c:1217 [inline]
 cpu_down kernel/cpu.c:1225 [inline]
 cpu_device_down+0x69/0xa0 kernel/cpu.c:1242
 device_offline+0x259/0x3a0 drivers/base/core.c:3948
 online_store+0x1fe/0x310 drivers/base/core.c:2464
 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2179 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88802adf0e00
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 68 bytes inside of
 96-byte region [ffff88802adf0e00, ffff88802adf0e60)
The buggy address belongs to the page:
page:ffffea0000ab7c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2adf0
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 dead000000000100 dead000000000122 ffff888017841780
raw: 0000000000000000 0000000000200020 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), pid 1, ts 22382921716, free_ts 22321389691
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x24f6/0x2670 mm/page_alloc.c:4192
 __alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
 alloc_page_interleave+0x24/0x1e0 mm/mempolicy.c:2031
 alloc_slab_page mm/slub.c:1780 [inline]
 allocate_slab mm/slub.c:1917 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1980
 ___slab_alloc+0x807/0xdd0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 slab_alloc mm/slub.c:3233 [inline]
 kmem_cache_alloc_trace+0xf9/0x290 mm/slub.c:3250
 kmalloc include/linux/slab.h:607 [inline]
 kzalloc include/linux/slab.h:738 [inline]
 snd_midi_event_new+0x70/0x1e0 sound/core/seq/seq_midi_event.c:107
 snd_seq_oss_midi_check_new_port+0x269/0x620 sound/core/seq/oss/seq_oss_midi.c:182
 receive_announce+0x281/0x370 sound/core/seq/oss/seq_oss_init.c:138
 snd_seq_deliver_single_event+0x806/0xb30 sound/core/seq/seq_clientmgr.c:663
 deliver_to_subscribers sound/core/seq/seq_clientmgr.c:720 [inline]
 snd_seq_deliver_event+0x49d/0x8d0 sound/core/seq/seq_clientmgr.c:855
 snd_seq_kernel_client_dispatch+0x1fc/0x2f0 sound/core/seq/seq_clientmgr.c:2408
 snd_seq_system_broadcast+0xf1/0x150 sound/core/seq/seq_system.c:86
 snd_seq_ioctl_create_port+0x4f9/0x640 sound/core/seq/seq_clientmgr.c:1401
 snd_virmidi_dev_attach_seq sound/core/seq/seq_virmidi.c:397 [inline]
 snd_virmidi_dev_register+0x3ea/0x700 sound/core/seq/seq_virmidi.c:434
 snd_rawmidi_dev_register+0x367/0xe50 sound/core/rawmidi.c:1892
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x8f/0x2a0 mm/page_alloc.c:3396
 __vunmap+0x8e0/0xa80 mm/vmalloc.c:2628
 free_work+0x56/0x80 mm/vmalloc.c:95
 process_one_work+0x867/0xff0 kernel/workqueue.c:2310
 worker_thread+0xad7/0x12a0 kernel/workqueue.c:2457
 kthread+0x42e/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff88802adf0d00: 00 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc
 ffff88802adf0d80: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc
>ffff88802adf0e00: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                                           ^
 ffff88802adf0e80: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
 ffff88802adf0f00: 00 00 00 00 00 00 00 00 00 02 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
2026/10/16 00:18 linux-5.15.y 792fbe1537d8 3f2522c6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in zswap_frontswap_store
* Struck through repros no longer work on HEAD.