KASAN: use-after-free Read in z_erofs_transform_plain

Status: upstream: reported C repro on 2025/06/24 12:21
Bug presence: origin:lts-only
[Documentation on labels]
Reported-by: syzbot+a94f033f5bdbb0bd6999@syzkaller.appspotmail.com
First crash: 397d, last: 19d
Fix commit to backport (bisect log) :
tree: upstream
commit 1ca01520148af399899ed66af5c78330bb9ecaf2
Author: Gao Xiang <hsiangkao@linux.alibaba.com>
Date: Wed Dec 6 09:10:56 2023 +0000

  erofs: refine z_erofs_transform_plain() for sub-page block support

  
Bug presence (2)
Date Name Commit Repro Result
2026/03/04 linux-6.6.y (ToT) 7a137e9bfa0e C [report] KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/03/04 upstream (ToT) 0031c06807cf C Didn't crash
Similar bugs (3)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in z_erofs_transform_plain (2) erofs 19 C error 5 156d 152d 29/29 fixed on 2026/05/06 16:40
linux-6.1 KASAN: use-after-free Read in z_erofs_transform_plain origin:lts-only 19 C inconclusive 1569 34m 900d 0/3 upstream: reported C repro on 2024/02/07 05:17
upstream KASAN: use-after-free Read in z_erofs_transform_plain erofs 19 C done 4 1252d 1329d 22/29 fixed on 2023/02/24 13:50
Fix bisection attempts (1)
Created Duration User Patch Repo Result
2025/07/11 02:01 9h29m fix candidate upstream OK (1) job log

Sample crash report:
syz.0.17[5939]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
loop0: detected capacity change from 0 to 16
erofs: (device loop0): mounted with root inode @ nid 36.
syz.0.17: attempt to access beyond end of device
loop0: rw=524288, sector=8, nr_sectors = 16 limit=16
syz.0.17: attempt to access beyond end of device
loop0: rw=524288, sector=16, nr_sectors = 40 limit=16
==================================================================
BUG: KASAN: use-after-free in memcpy_to_page include/linux/highmem.h:427 [inline]
BUG: KASAN: use-after-free in z_erofs_transform_plain+0x3ab/0x4a0 fs/erofs/decompressor.c:347
Read of size 4096 at addr ffff888027552000 by task syz.0.17/5939

CPU: 1 PID: 5939 Comm: syz.0.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:468
 kasan_report+0x117/0x150 mm/kasan/report.c:581
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x241/0x290 mm/kasan/generic.c:187
 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105
 memcpy_to_page include/linux/highmem.h:427 [inline]
 z_erofs_transform_plain+0x3ab/0x4a0 fs/erofs/decompressor.c:347
 z_erofs_decompress_pcluster fs/erofs/zdata.c:1296 [inline]
 z_erofs_decompress_queue+0x1705/0x2670 fs/erofs/zdata.c:1377
 z_erofs_runqueue+0x1993/0x1b20 fs/erofs/zdata.c:1778
 z_erofs_read_folio+0x321/0x5c0 fs/erofs/zdata.c:1863
 filemap_read_folio+0x16b/0x790 mm/filemap.c:2420
 filemap_update_page mm/filemap.c:2504 [inline]
 filemap_get_pages+0x13ac/0x1f10 mm/filemap.c:2618
 filemap_read+0x409/0xf20 mm/filemap.c:2690
 __kernel_read+0x2e5/0x730 fs/read_write.c:428
 integrity_kernel_read+0x8a/0xd0 security/integrity/iint.c:221
 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:485 [inline]
 ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
 ima_calc_file_hash+0xb1f/0x1960 security/integrity/ima/ima_crypto.c:573
 ima_collect_measurement+0x4d4/0xa30 security/integrity/ima/ima_api.c:290
 process_measurement+0x123a/0x1d50 security/integrity/ima/ima_main.c:370
 ima_file_check+0xcc/0x110 security/integrity/ima/ima_main.c:568
 do_open fs/namei.c:3642 [inline]
 path_openat+0x2910/0x3270 fs/namei.c:3797
 do_filp_open+0x1f2/0x430 fs/namei.c:3824
 do_sys_openat2+0x134/0x1d0 fs/open.c:1421
 do_sys_open fs/open.c:1436 [inline]
 __do_sys_open fs/open.c:1444 [inline]
 __se_sys_open fs/open.c:1440 [inline]
 __x64_sys_open+0x11f/0x140 fs/open.c:1440
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f5e1199ce59
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:00007f5e1282d028 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 00007f5e11c15fa0 RCX: 00007f5e1199ce59
RDX: 0000000000000009 RSI: 0000000000000080 RDI: 00002000000001c0
RBP: 00007f5e11a32e6f R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5e11c16038 R14: 00007f5e11c15fa0 R15: 00007fff9e431e18
 </TASK>

The buggy address belongs to the physical page:
page:ffffea00009d5480 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x27552
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffff7f(buddy)
raw: 00fff00000000000 ffffea00009b1788 ffffea00009c2dc8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffff7f 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 5687, tgid 5687 (dhcpcd-run-hook), ts 60116105088, free_ts 113468027327
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1c1/0x200 mm/page_alloc.c:1582
 prep_new_page mm/page_alloc.c:1589 [inline]
 get_page_from_freelist+0x2181/0x22a0 mm/page_alloc.c:3221
 __alloc_pages+0x1f0/0x460 mm/page_alloc.c:4501
 alloc_slab_page+0x5d/0x180 mm/slub.c:1881
 allocate_slab mm/slub.c:2028 [inline]
 new_slab+0x87/0x2d0 mm/slub.c:2081
 ___slab_alloc+0xc5c/0x12f0 mm/slub.c:3253
 __slab_alloc mm/slub.c:3339 [inline]
 __slab_alloc_node mm/slub.c:3392 [inline]
 slab_alloc_node mm/slub.c:3485 [inline]
 slab_alloc mm/slub.c:3503 [inline]
 __kmem_cache_alloc_lru mm/slub.c:3510 [inline]
 kmem_cache_alloc+0x109/0x2c0 mm/slub.c:3519
 vm_area_dup+0x27/0x270 kernel/fork.c:502
 dup_mmap kernel/fork.c:712 [inline]
 dup_mm kernel/fork.c:1694 [inline]
 copy_mm+0x11a6/0x1e30 kernel/fork.c:1743
 copy_process+0x171d/0x3df0 kernel/fork.c:2508
 kernel_clone+0x24b/0x8a0 kernel/fork.c:2917
 __do_sys_clone kernel/fork.c:3060 [inline]
 __se_sys_clone kernel/fork.c:3044 [inline]
 __x64_sys_clone+0x1b7/0x230 kernel/fork.c:3044
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1182 [inline]
 free_unref_page_prepare+0x7d7/0x8f0 mm/page_alloc.c:2366
 free_unref_page+0x32/0x2e0 mm/page_alloc.c:2459
 discard_slab mm/slub.c:2127 [inline]
 __unfreeze_partials+0x1cf/0x210 mm/slub.c:2667
 put_cpu_partial+0x17c/0x250 mm/slub.c:2743
 __slab_free+0x319/0x400 mm/slub.c:3700
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x75/0xd0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x143/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:306
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6a/0x4d0 mm/slab.h:767
 slab_alloc_node mm/slub.c:3495 [inline]
 __kmem_cache_alloc_node+0x194/0x250 mm/slub.c:3534
 __do_kmalloc_node mm/slab_common.c:1006 [inline]
 __kmalloc_node+0xa6/0x240 mm/slab_common.c:1014
 kmalloc_node include/linux/slab.h:620 [inline]
 kvmalloc_node+0x70/0x180 mm/util.c:617
 kvmalloc include/linux/slab.h:738 [inline]
 kvzalloc include/linux/slab.h:746 [inline]
 allocate_hook_entries_size net/netfilter/core.c:61 [inline]
 __nf_hook_entries_try_shrink+0x336/0x700 net/netfilter/core.c:260
 __nf_unregister_net_hook+0x4da/0x6d0 net/netfilter/core.c:520
 nf_unregister_net_hook net/netfilter/core.c:-1 [inline]
 nf_unregister_net_hooks+0xcb/0x130 net/netfilter/core.c:613
 brnf_exit_net+0x61/0x120 net/bridge/br_netfilter_hooks.c:1308

Memory state around the buggy address:
 ffff888027551f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888027551f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888027552000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                   ^
 ffff888027552080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff888027552100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (121):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/06/30 00:41 linux-6.6.y d1cfde2d5d15 6a0c72dc .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2026/03/04 04:01 linux-6.6.y 7a137e9bfa0e 4180d919 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/10/30 12:18 linux-6.6.y e5bbb12db2c7 fd2207e7 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/06/26 03:12 linux-6.6.y 6282921b6825 26d77996 .config console log report syz / log C [disk image] [vmlinux] [kernel image] [mounted in repro (corrupt fs)] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/07/05 08:40 linux-6.6.y da47cbc25466 fcece630 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2026/06/09 11:54 linux-6.6.y 924b4a879cbb c36c07f6 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2026/04/20 21:07 linux-6.6.y 9760bf04666d e65da4ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2026/03/04 01:06 linux-6.6.y 7a137e9bfa0e 4180d919 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/11/30 00:54 linux-6.6.y 1e89a1be4fe9 d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/09/20 19:37 linux-6.6.y af1544b5d072 67c37560 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/09/19 18:20 linux-6.6.y af1544b5d072 67c37560 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/09/19 02:14 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/09/18 09:56 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2025/06/24 12:21 linux-6.6.y 6282921b6825 e2f27c35 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: use-after-free Read in z_erofs_transform_plain
2026/07/07 12:47 linux-6.6.y da47cbc25466 76cdc0c0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/07/07 12:46 linux-6.6.y da47cbc25466 76cdc0c0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/07/07 05:30 linux-6.6.y da47cbc25466 8e71ce95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/07/07 00:18 linux-6.6.y da47cbc25466 8e71ce95 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/07/06 21:57 linux-6.6.y da47cbc25466 88b240e4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/07/06 01:50 linux-6.6.y da47cbc25466 fcece630 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/07/04 03:35 linux-6.6.y d1cfde2d5d15 fcece630 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/07/03 21:36 linux-6.6.y d1cfde2d5d15 fcece630 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/07/03 20:13 linux-6.6.y d1cfde2d5d15 58bf2096 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/07/03 15:45 linux-6.6.y d1cfde2d5d15 58bf2096 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/06/29 21:10 linux-6.6.y d1cfde2d5d15 6a0c72dc .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/06/07 05:17 linux-6.6.y 924b4a879cbb cc095639 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/05/27 21:25 linux-6.6.y 0a40c6fbd105 8777bdc3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/25 22:03 linux-6.6.y 9760bf04666d 9c2d0995 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/25 15:21 linux-6.6.y 9760bf04666d 9c2d0995 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/25 02:44 linux-6.6.y 9760bf04666d 9c2d0995 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/24 13:51 linux-6.6.y 9760bf04666d 1c2b9291 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/04/20 16:22 linux-6.6.y 9760bf04666d e65da4ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/20 05:58 linux-6.6.y 9760bf04666d 303e2802 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/04/19 15:19 linux-6.6.y 9760bf04666d 303e2802 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/04/19 15:13 linux-6.6.y 9760bf04666d 303e2802 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/17 06:57 linux-6.6.y 8cee53b8eaeb de0a551d .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/04/09 14:57 linux-6.6.y 80de0a958133 38c8e246 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/04/03 06:37 linux-6.6.y c09fbcd31ae6 4440e7c2 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2026/03/26 15:13 linux-6.6.y c09fbcd31ae6 766b6434 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2026/03/24 04:08 linux-6.6.y 4fc00fe35d46 baf8bf12 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/12/27 03:28 linux-6.6.y 5fa4793a2d2d d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/11/30 13:44 linux-6.6.y 1e89a1be4fe9 d6526ea3 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/10/30 11:36 linux-6.6.y e5bbb12db2c7 fd2207e7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/09/30 18:03 linux-6.6.y 147338df3487 65a0eece .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2025/09/17 10:51 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2025/09/16 22:38 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-out-of-bounds Read in z_erofs_transform_plain
2025/09/15 08:52 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/09/15 02:17 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
2025/09/13 10:43 linux-6.6.y 60a9e718726f e2beed91 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Read in z_erofs_transform_plain
* Struck through repros no longer work on HEAD.