syzbot


KASAN: use-after-free Read in search_by_entry_key

Status: fixed on 2021/03/10 01:49
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+83b6f7cf9922cae5c4d7@syzkaller.appspotmail.com
Fix commit: d24396c5290b reiserfs: add check for an invalid ih_entry_count
First crash: 1257d, last: 1253d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in sysfs_warn_dup (log)
Repro: C syz .config
  
Discussions (15)
Title Replies (including bot) Last reply
[PATCH 5.4 00/47] 5.4.87-rc1 review 58 (58) 2021/02/26 14:21
[PATCH 4.14 00/29] 4.14.214-rc1 review 32 (32) 2021/01/08 17:38
[PATCH 4.4 00/19] 4.4.250-rc1 review 21 (21) 2021/01/08 01:13
[PATCH 4.9 00/32] 4.9.250-rc1 review 33 (33) 2021/01/07 14:16
[PATCH 5.10 00/63] 5.10.5-rc1 review 75 (75) 2021/01/07 08:13
[PATCH 4.19 00/35] 4.19.165-rc1 review 44 (44) 2021/01/06 13:46
[PATCH 4.19 00/29] 4.19.165-rc2 review 36 (36) 2021/01/06 13:46
[PATCH AUTOSEL 5.10 01/31] ARM: 9014/2: Replace string mem* functions for KASan 37 (37) 2021/01/04 14:29
[PATCH AUTOSEL 4.4 1/5] module: set MODULE_STATE_GOING state when a module fails to load 5 (5) 2020/12/30 13:04
[PATCH AUTOSEL 4.9 1/5] module: set MODULE_STATE_GOING state when a module fails to load 5 (5) 2020/12/30 13:04
[PATCH AUTOSEL 4.14 1/8] rtc: sun6i: Fix memleak in sun6i_rtc_clk_init 8 (8) 2020/12/30 13:04
[PATCH AUTOSEL 4.19 01/10] ARM: 9014/2: Replace string mem* functions for KASan 10 (10) 2020/12/30 13:04
[PATCH AUTOSEL 5.4 01/17] ARM: 9014/2: Replace string mem* functions for KASan 17 (17) 2020/12/30 13:03
[PATCH] reiserfs: add check for an invalid ih_entry_count 2 (2) 2020/11/26 15:57
KASAN: use-after-free Read in search_by_entry_key 0 (1) 2020/10/08 14:59
Similar bugs (8)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in search_by_entry_key (2) reiserfs C inconclusive inconclusive 139 52d 645d 0/26 upstream: reported C repro on 2022/06/12 10:38
linux-4.14 KASAN: use-after-free Read in search_by_entry_key (2) reiserfs C error 6 448d 1067d 0/1 upstream: reported C repro on 2021/04/16 06:17
linux-4.14 KASAN: use-after-free Read in search_by_entry_key C done 3 1168d 1274d 1/1 fixed on 2021/02/21 17:18
linux-4.19 KASAN: use-after-free Read in search_by_entry_key (3) reiserfs C error 8 447d 641d 0/1 upstream: reported C repro on 2022/06/17 02:59
linux-4.19 KASAN: use-after-free Read in search_by_entry_key C done 1 1169d 1259d 1/1 fixed on 2021/02/20 09:47
linux-5.15 KASAN: use-after-free Read in search_by_entry_key origin:upstream C error 11 121d 345d 0/3 upstream: reported C repro on 2023/04/08 09:36
linux-6.1 KASAN: use-after-free Read in search_by_entry_key origin:upstream C 13 1d01h 330d 0/3 upstream: reported C repro on 2023/04/23 10:15
linux-4.19 KASAN: use-after-free Read in search_by_entry_key (2) C done 2 950d 1100d 1/1 fixed on 2021/09/10 21:17
Last patch testing requests (4)
Created Duration User Patch Repo Result
2020/11/01 07:35 18m rkovhaev@gmail.com patch upstream OK
2020/10/31 21:54 19m rkovhaev@gmail.com patch upstream OK
2020/10/20 12:07 11m anmol.karan123@gmail.com patch upstream report log
2020/10/11 16:15 10m rkovhaev@gmail.com upstream report log

Sample crash report:
REISERFS (device loop0): journal params: device loop0, size 15748, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using tea hash to sort names
REISERFS (device loop0): using 3.5.x disk format
==================================================================
BUG: KASAN: use-after-free in bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
BUG: KASAN: use-after-free in search_by_entry_key+0x81f/0x960 fs/reiserfs/namei.c:164
Read of size 4 at addr ffff88807d41e7bd by task syz-executor210/6891

CPU: 1 PID: 6891 Comm: syz-executor210 Not tainted 5.9.0-rc8-syzkaller #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+0x198/0x1fd lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 bin_search_in_dir_item fs/reiserfs/namei.c:40 [inline]
 search_by_entry_key+0x81f/0x960 fs/reiserfs/namei.c:164
 reiserfs_find_entry.part.0+0x139/0xdf0 fs/reiserfs/namei.c:321
 reiserfs_find_entry fs/reiserfs/namei.c:367 [inline]
 reiserfs_lookup+0x24a/0x490 fs/reiserfs/namei.c:367
 __lookup_slow+0x24c/0x480 fs/namei.c:1544
 lookup_one_len+0x163/0x190 fs/namei.c:2562
 reiserfs_lookup_privroot+0x92/0x280 fs/reiserfs/xattr.c:972
 reiserfs_fill_super+0x211b/0x2df3 fs/reiserfs/super.c:2176
 mount_bdev+0x32e/0x3f0 fs/super.c:1417
 legacy_get_tree+0x105/0x220 fs/fs_context.c:592
 vfs_get_tree+0x89/0x2f0 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 path_mount+0x1387/0x20a0 fs/namespace.c:3192
 do_mount fs/namespace.c:3205 [inline]
 __do_sys_mount fs/namespace.c:3413 [inline]
 __se_sys_mount fs/namespace.c:3390 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3390
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x447d9a
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 7d a3 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 5a a3 fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffe3d8a0238 EFLAGS: 00000297 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffe3d8a0290 RCX: 0000000000447d9a
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffe3d8a0250
RBP: 00007ffe3d8a0250 R08: 00007ffe3d8a0290 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000297 R12: 0000000000000006
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

The buggy address belongs to the page:
page:00000000b141154e refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x7d41e
flags: 0xfffe0000000000()
raw: 00fffe0000000000 ffffea0001f507c8 ffff8880ae539608 0000000000000000
raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88807d41e680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807d41e700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88807d41e780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                        ^
 ffff88807d41e800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88807d41e880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (3):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/10/12 06:59 upstream 3dd0130f2430 4a77ae0b .config console log report syz C ci-upstream-kasan-gce-root
2020/10/11 10:09 upstream da690031a5d6 4a77ae0b .config console log report syz C ci-upstream-kasan-gce-selinux-root
2020/10/08 09:26 upstream c85fb28b6f99 1880b4a9 .config console log report syz C ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.