syzbot


memory leak in z_erofs_do_read_page

Status: fixed on 2023/02/24 13:50
Subsystems: erofs
[Documentation on labels]
Reported-by: syzbot+6f8cd9a0155b366d227f@syzkaller.appspotmail.com
Fix commit: c42c0ffe8117 erofs: Fix pcluster memleak when its block address is zero
First crash: 722d, last: 722d
Discussions (5)
Title Replies (including bot) Last reply
[PATCH -next v3] erofs: Fix pcluster memleak when its block address is zero 5 (5) 2022/12/06 15:07
[PATCH v2] erofs: Fix pcluster memleak when m_pa is zero 2 (2) 2022/12/05 03:46
[PATCH] erofs: Fix pcluster become inline when m_pa is zero 4 (4) 2022/12/05 01:55
[PATCH] erofs: fix inline pcluster memory leak 1 (1) 2022/12/02 03:33
[syzbot] memory leak in z_erofs_do_read_page 0 (1) 2022/12/01 11:54

Sample crash report:
BUG: memory leak
unreferenced object 0xffff88811009c7f8 (size 136):
  comm "syz-executor227", pid 3659, jiffies 4294973830 (age 12.500s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff821db19b>] kmem_cache_zalloc include/linux/slab.h:679 [inline]
    [<ffffffff821db19b>] z_erofs_alloc_pcluster fs/erofs/zdata.c:152 [inline]
    [<ffffffff821db19b>] z_erofs_register_pcluster fs/erofs/zdata.c:497 [inline]
    [<ffffffff821db19b>] z_erofs_collector_begin fs/erofs/zdata.c:576 [inline]
    [<ffffffff821db19b>] z_erofs_do_read_page+0x99b/0x1740 fs/erofs/zdata.c:728
    [<ffffffff821dee9e>] z_erofs_readahead+0x24e/0x580 fs/erofs/zdata.c:1670
    [<ffffffff814bc0d6>] read_pages+0x86/0x3d0 mm/readahead.c:161
    [<ffffffff814bc60d>] page_cache_ra_unbounded+0x1ed/0x220 mm/readahead.c:270
    [<ffffffff814bcfe9>] do_page_cache_ra mm/readahead.c:300 [inline]
    [<ffffffff814bcfe9>] page_cache_ra_order+0x399/0x410 mm/readahead.c:560
    [<ffffffff814bd48d>] ondemand_readahead+0x42d/0x640 mm/readahead.c:682
    [<ffffffff814bd7d8>] page_cache_sync_ra+0x138/0x140 mm/readahead.c:709
    [<ffffffff814ac448>] page_cache_sync_readahead include/linux/pagemap.h:1213 [inline]
    [<ffffffff814ac448>] filemap_get_pages+0x158/0xa00 mm/filemap.c:2581
    [<ffffffff814ace2e>] filemap_read+0x13e/0x520 mm/filemap.c:2675
    [<ffffffff814ad3e9>] generic_file_read_iter+0x1d9/0x280 mm/filemap.c:2821
    [<ffffffff815f782f>] __kernel_read+0x13f/0x340 fs/read_write.c:428
    [<ffffffff822729ac>] integrity_kernel_read+0x2c/0x40 security/integrity/iint.c:199
    [<ffffffff82276d4c>] ima_calc_file_hash_tfm+0x11c/0x1d0 security/integrity/ima/ima_crypto.c:485
    [<ffffffff82277131>] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
    [<ffffffff82277131>] ima_calc_file_hash+0xf1/0xa70 security/integrity/ima/ima_crypto.c:573
    [<ffffffff82278b57>] ima_collect_measurement+0x307/0x380 security/integrity/ima/ima_api.c:292
    [<ffffffff82274dbd>] process_measurement+0x7cd/0xdb0 security/integrity/ima/ima_main.c:337

BUG: memory leak
unreferenced object 0xffff88811009ca18 (size 136):
  comm "syz-executor227", pid 3663, jiffies 4294974353 (age 7.270s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffffffff821db19b>] kmem_cache_zalloc include/linux/slab.h:679 [inline]
    [<ffffffff821db19b>] z_erofs_alloc_pcluster fs/erofs/zdata.c:152 [inline]
    [<ffffffff821db19b>] z_erofs_register_pcluster fs/erofs/zdata.c:497 [inline]
    [<ffffffff821db19b>] z_erofs_collector_begin fs/erofs/zdata.c:576 [inline]
    [<ffffffff821db19b>] z_erofs_do_read_page+0x99b/0x1740 fs/erofs/zdata.c:728
    [<ffffffff821dee9e>] z_erofs_readahead+0x24e/0x580 fs/erofs/zdata.c:1670
    [<ffffffff814bc0d6>] read_pages+0x86/0x3d0 mm/readahead.c:161
    [<ffffffff814bc60d>] page_cache_ra_unbounded+0x1ed/0x220 mm/readahead.c:270
    [<ffffffff814bcfe9>] do_page_cache_ra mm/readahead.c:300 [inline]
    [<ffffffff814bcfe9>] page_cache_ra_order+0x399/0x410 mm/readahead.c:560
    [<ffffffff814bd48d>] ondemand_readahead+0x42d/0x640 mm/readahead.c:682
    [<ffffffff814bd7d8>] page_cache_sync_ra+0x138/0x140 mm/readahead.c:709
    [<ffffffff814ac448>] page_cache_sync_readahead include/linux/pagemap.h:1213 [inline]
    [<ffffffff814ac448>] filemap_get_pages+0x158/0xa00 mm/filemap.c:2581
    [<ffffffff814ace2e>] filemap_read+0x13e/0x520 mm/filemap.c:2675
    [<ffffffff814ad3e9>] generic_file_read_iter+0x1d9/0x280 mm/filemap.c:2821
    [<ffffffff815f782f>] __kernel_read+0x13f/0x340 fs/read_write.c:428
    [<ffffffff822729ac>] integrity_kernel_read+0x2c/0x40 security/integrity/iint.c:199
    [<ffffffff82276d4c>] ima_calc_file_hash_tfm+0x11c/0x1d0 security/integrity/ima/ima_crypto.c:485
    [<ffffffff82277131>] ima_calc_file_shash security/integrity/ima/ima_crypto.c:516 [inline]
    [<ffffffff82277131>] ima_calc_file_hash+0xf1/0xa70 security/integrity/ima/ima_crypto.c:573
    [<ffffffff82278b57>] ima_collect_measurement+0x307/0x380 security/integrity/ima/ima_api.c:292
    [<ffffffff82274dbd>] process_measurement+0x7cd/0xdb0 security/integrity/ima/ima_main.c:337


Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/12/01 10:20 upstream ef4d3ea40565 4c2a66e8 .config console log report syz C [mounted in repro] ci-upstream-gce-leak memory leak in z_erofs_do_read_page
* Struck through repros no longer work on HEAD.