syzbot


KASAN: slab-out-of-bounds Read in vsscanf

Status: fixed on 2020/07/17 17:58
Subsystems: lsm
[Documentation on labels]
Reported-by: syzbot+bfdd4a2f07be52351350@syzkaller.appspotmail.com
Fix commit: 84e99e58e8d1 Smack: slab-out-of-bounds in vsscanf
First crash: 1521d, last: 1417d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in sysfs_warn_dup (log)
Repro: C syz .config
  
Discussions (13)
Title Replies (including bot) Last reply
[PATCH 4.9 000/128] 4.9.228-rc1 review 135 (135) 2021/02/26 19:09
[PATCH 5.4 000/134] 5.4.47-rc1 review 141 (141) 2021/01/28 17:06
[PATCH 4.19 000/267] 4.19.129-rc1 review 280 (280) 2020/06/30 01:36
[PATCH 4.14 000/190] 4.14.185-rc1 review 197 (197) 2020/06/26 07:05
[PATCH AUTOSEL 4.14 001/108] power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select 113 (113) 2020/06/23 18:59
[PATCH AUTOSEL 4.19 001/172] power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select 175 (175) 2020/06/23 15:35
[PATCH AUTOSEL 4.4 01/60] clk: sunxi: Fix incorrect usage of round_down() 65 (65) 2020/06/22 00:07
[PATCH 4.4 000/101] 4.4.228-rc1 review 109 (109) 2020/06/20 15:06
[PATCH AUTOSEL 4.9 01/80] power: supply: bq24257_charger: Replace depends on REGMAP_I2C with select 81 (81) 2020/06/18 01:34
[PATCH 5.6 000/161] 5.6.19-rc1 review 164 (164) 2020/06/16 17:11
[PATCH 5.7 000/163] 5.7.3-rc1 review 164 (164) 2020/06/16 15:35
Re: KASAN: slab-out-of-bounds Read in vsscanf 1 (1) 2020/03/27 16:16
KASAN: slab-out-of-bounds Read in vsscanf 0 (1) 2020/03/27 01:20
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-out-of-bounds Read in vsscanf (2) lsm C error 5 1389d 1402d 15/26 fixed on 2020/09/16 22:51

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in vsscanf+0x2666/0x2ef0 lib/vsprintf.c:3275
Read of size 1 at addr ffff888093622f42 by task syz-executor055/7117

CPU: 1 PID: 7117 Comm: syz-executor055 Not tainted 5.6.0-rc7-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+0x1e9/0x30e lib/dump_stack.c:118
 print_address_description+0x74/0x5c0 mm/kasan/report.c:374
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:506
 kasan_report+0x25/0x50 mm/kasan/common.c:641
 vsscanf+0x2666/0x2ef0 lib/vsprintf.c:3275
 sscanf+0x6c/0x90 lib/vsprintf.c:3481
 smk_set_cipso+0x1ac/0x6a0 security/smack/smackfs.c:881
 __vfs_write+0xa7/0x710 fs/read_write.c:494
 vfs_write+0x271/0x570 fs/read_write.c:558
 ksys_write+0x115/0x220 fs/read_write.c:611
 do_syscall_64+0xf3/0x1b0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4401b9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 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 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffd20456888 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401b9
RDX: 0000000000000001 RSI: 00000000200005c0 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000401a40
R13: 0000000000401ad0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7117:
 save_stack mm/kasan/common.c:72 [inline]
 set_track mm/kasan/common.c:80 [inline]
 __kasan_kmalloc+0x118/0x1c0 mm/kasan/common.c:515
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc_track_caller+0x249/0x320 mm/slab.c:3671
 memdup_user_nul+0x26/0xf0 mm/util.c:259
 smk_set_cipso+0xff/0x6a0 security/smack/smackfs.c:859
 __vfs_write+0xa7/0x710 fs/read_write.c:494
 vfs_write+0x271/0x570 fs/read_write.c:558
 ksys_write+0x115/0x220 fs/read_write.c:611
 do_syscall_64+0xf3/0x1b0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 1:
 save_stack mm/kasan/common.c:72 [inline]
 set_track mm/kasan/common.c:80 [inline]
 kasan_set_free_info mm/kasan/common.c:337 [inline]
 __kasan_slab_free+0x12e/0x1e0 mm/kasan/common.c:476
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x10a/0x220 mm/slab.c:3757
 tomoyo_path_perm+0x59b/0x740 security/tomoyo/file.c:842
 security_inode_getattr+0xc0/0x140 security/security.c:1254
 vfs_getattr+0x27/0x6e0 fs/stat.c:117
 vfs_statx fs/stat.c:201 [inline]
 vfs_lstat include/linux/fs.h:3277 [inline]
 __do_sys_newlstat fs/stat.c:364 [inline]
 __se_sys_newlstat+0x85/0x140 fs/stat.c:358
 do_syscall_64+0xf3/0x1b0 arch/x86/entry/common.c:294
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888093622f40
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 2 bytes inside of
 32-byte region [ffff888093622f40, ffff888093622f60)
The buggy address belongs to the page:
page:ffffea00024d8880 refcount:1 mapcount:0 mapping:ffff8880aa4001c0 index:0xffff888093622fc1
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea000271b988 ffffea00028ae488 ffff8880aa4001c0
raw: ffff888093622fc1 ffff888093622000 0000000100000039 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888093622e00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff888093622e80: fb fb fb fb fc fc fc fc 00 00 01 fc fc fc fc fc
>ffff888093622f00: fb fb fb fb fc fc fc fc 02 fc fc fc fc fc fc fc
                                           ^
 ffff888093622f80: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888093623000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (61):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/03/26 09:36 upstream 1b649e0bcae7 e8e6c7d2 .config console log report syz C ci-upstream-kasan-gce-smack-root
2020/07/07 21:03 upstream 7cc2a8ea1048 51095195 .config console log report ci-upstream-kasan-gce-smack-root
2020/07/05 00:51 upstream 7cc2a8ea1048 51095195 .config console log report ci-upstream-kasan-gce-smack-root
2020/07/03 19:14 upstream cd77006e01b3 bed10395 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/29 09:34 upstream 4e99b32169e8 a2cdad9d .config console log report ci-upstream-kasan-gce-smack-root
2020/06/27 11:49 upstream 1590a2e1c681 ffec44b5 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/17 01:53 upstream 7ae77150d94d 559fbe2d .config console log report ci-upstream-kasan-gce-smack-root
2020/06/13 16:14 upstream 7ae77150d94d f4724dd3 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/11 10:31 upstream 7ae77150d94d 3ab7a05a .config console log report ci-upstream-kasan-gce-smack-root
2020/06/08 04:54 upstream 7ae77150d94d 7751efd0 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/03 18:08 upstream d6f9469a03d8 a5ce5de0 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/02 07:10 upstream 9bf9511e3d9f a0331e89 .config console log report ci-upstream-kasan-gce-smack-root
2020/06/01 04:08 upstream bdc48fa11e46 a0331e89 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/27 11:32 upstream 444fc5cde643 9072c126 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/25 13:59 upstream 9cb1fd0efd19 11284182 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/23 06:31 upstream 051143e1602d 9682898d .config console log report ci-upstream-kasan-gce-smack-root
2020/05/19 05:17 upstream 45088963ca9c 684d3606 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/17 10:29 upstream 3d1c1e5931ce 37bccd4e .config console log report ci-upstream-kasan-gce-smack-root
2020/05/14 07:43 upstream 24085f70a6e1 a885920d .config console log report ci-upstream-kasan-gce-smack-root
2020/05/13 09:11 upstream 24085f70a6e1 a44eb8f7 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/13 00:47 upstream 24085f70a6e1 a44eb8f7 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/11 20:34 upstream 2ef96a5bb12b f8f57555 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/11 11:01 upstream 2ef96a5bb12b f8f57555 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/10 11:27 upstream 1d3962ae3b3d 8742a2b9 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/08 09:54 upstream 6e7f2eacf098 6c70a1c2 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/07 19:20 upstream a811c1fa0a02 98cbd87b .config console log report ci-upstream-kasan-gce-smack-root
2020/05/07 15:23 upstream a811c1fa0a02 98cbd87b .config console log report ci-upstream-kasan-gce-smack-root
2020/05/06 04:55 upstream dc56c5acd850 35b8eb30 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/05 21:18 upstream 47cf1b422e60 4b76dd25 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/05 12:02 upstream 47cf1b422e60 9941337c .config console log report ci-upstream-kasan-gce-smack-root
2020/05/05 04:45 upstream 9851a0dee7c2 9941337c .config console log report ci-upstream-kasan-gce-smack-root
2020/05/04 14:01 upstream 0e698dfa2822 58ae5e18 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/04 07:16 upstream 262f7a6b8317 58ae5e18 .config console log report ci-upstream-kasan-gce-smack-root
2020/05/01 10:38 upstream c45e8bccecaf a4d01b80 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/30 05:50 upstream 1d2cc5ac6f66 2dd552a5 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/28 17:21 upstream 51184ae37e05 e3ecea2e .config console log report ci-upstream-kasan-gce-smack-root
2020/04/27 17:23 upstream 6a8b55ed4056 0ce7569e .config console log report ci-upstream-kasan-gce-smack-root
2020/04/23 14:41 upstream c578ddb39e56 2e44d63e .config console log report ci-upstream-kasan-gce-smack-root
2020/04/19 10:49 upstream 50cc09c18985 365fba24 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/18 06:05 upstream 95988fbc7c31 435c6d53 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/17 00:07 upstream 9786cab67457 c743fcb3 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/15 15:24 upstream 8632e9b5645b 3f3c5574 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/15 09:35 upstream 8632e9b5645b 3f3c5574 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/15 01:01 upstream 8632e9b5645b 3f3c5574 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/14 18:03 upstream 8f3d9f354286 3f3c5574 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/14 05:40 upstream 8f3d9f354286 7c54686a .config console log report ci-upstream-kasan-gce-smack-root
2020/04/11 04:00 upstream ab6f762f0f53 a8c6a3f8 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/07 17:30 upstream 7e63420847ae 99a96044 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/07 16:08 upstream 7e63420847ae 99a96044 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/03 06:39 upstream 7be97138e727 a34e2c33 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/02 19:12 upstream 919dce24701f a34e2c33 .config console log report ci-upstream-kasan-gce-smack-root
2020/04/02 13:55 upstream 919dce24701f a34e2c33 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/31 01:26 upstream 7111951b8d49 c8d1cc20 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/30 22:05 upstream 7111951b8d49 c8d1cc20 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/30 05:28 upstream e595dd94515e 05736b29 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/30 01:51 upstream e595dd94515e 05736b29 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/29 04:58 upstream 906c40438bb6 05736b29 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/28 18:52 upstream 69c5eea3128e f1ebdfba .config console log report ci-upstream-kasan-gce-smack-root
2020/03/27 21:29 upstream 527630fbf4f1 831e9a81 .config console log report ci-upstream-kasan-gce-smack-root
2020/03/27 14:05 upstream f3e69428b5e2 7d95711b .config console log report ci-upstream-kasan-gce-smack-root
2020/03/26 09:21 upstream 1b649e0bcae7 e8e6c7d2 .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.