syzbot


KASAN: slab-out-of-bounds Write in ext4_write_inline_data_end

Status: fixed on 2021/11/10 00:50
Subsystems: ext4
[Documentation on labels]
Reported-by: syzbot+13146364637c7363a7de@syzkaller.appspotmail.com
Fix commit: a54c4613dac1 ext4: fix race writing to an inline_data file while its xattrs are changing
First crash: 975d, last: 975d
Cause bisection: introduced by (bisect log) :
commit a154d5d83d21af6b9ee32adc5dbcea5ac1fb534c
Author: Arnd Bergmann <arnd@arndb.de>
Date: Mon Mar 4 20:38:03 2019 +0000

  net: ignore sysctl_devconf_inherit_init_net without SYSCTL

Crash: KASAN: use-after-free Read in batadv_iv_ogm_queue_add (log)
Repro: C syz .config
  
Discussions (10)
Title Replies (including bot) Last reply
[PATCH 4.4 000/133] 4.4.284-rc1 review 138 (138) 2021/09/22 07:22
[PATCH 4.19 000/293] 4.19.207-rc1 review 300 (300) 2021/09/22 05:34
[PATCH 4.14 000/217] 4.14.247-rc1 review 220 (220) 2021/09/22 01:59
[PATCH 4.9 000/175] 4.9.283-rc1 review 180 (180) 2021/09/21 15:34
[PATCH 5.4 00/37] 5.4.145-rc1 review 44 (44) 2021/09/12 00:50
[PATCH 5.14 00/14] 5.14.2-rc1 review 21 (21) 2021/09/08 01:20
[PATCH 5.13 00/24] 5.13.15-rc1 review 31 (31) 2021/09/08 01:20
[PATCH 5.10 00/29] 5.10.63-rc1 review 38 (38) 2021/09/08 01:19
[PATCH] ext4: fix race writing to an inline_data file while its xattrs are changing 2 (3) 2021/08/21 04:53
[syzbot] KASAN: slab-out-of-bounds Write in ext4_write_inline_data_end 1 (2) 2021/08/21 03:43
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Write in ext4_write_inline_data_end C 6 1079d 1122d 0/2 auto-obsoleted due to no activity on 2023/04/19 14:50
upstream KASAN: slab-out-of-bounds Write in ext4_write_inline_data_end (2) ext4 1 391d 383d 0/26 auto-obsoleted due to no activity on 2023/07/24 06:06
Last patch testing requests (1)
Created Duration User Patch Repo Result
2021/08/21 04:07 19m tytso@mit.edu git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git 9e445093e523f3277081314c864f708fd4bd34aa OK

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in ext4_write_inline_data fs/ext4/inline.c:245 [inline]
BUG: KASAN: slab-out-of-bounds in ext4_write_inline_data_end+0x4d4/0x960 fs/ext4/inline.c:754
Write of size 70 at addr ffff8880195444ef by task syz-executor279/8426

CPU: 0 PID: 8426 Comm: syz-executor279 Not tainted 5.14.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1ae/0x29f lib/dump_stack.c:105
 print_address_description+0x66/0x3b0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x163/0x210 mm/kasan/report.c:436
 check_region_inline mm/kasan/generic.c:135 [inline]
 kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:189
 memcpy+0x3c/0x60 mm/kasan/shadow.c:66
 ext4_write_inline_data fs/ext4/inline.c:245 [inline]
 ext4_write_inline_data_end+0x4d4/0x960 fs/ext4/inline.c:754
 ext4_write_end+0x1ff/0xbd0 fs/ext4/inode.c:1290
 generic_perform_write+0x361/0x580 mm/filemap.c:3667
 ext4_buffered_write_iter+0x41c/0x590 fs/ext4/file.c:269
 ext4_file_write_iter+0x8f7/0x1b90 fs/ext4/file.c:519
 call_write_iter include/linux/fs.h:2114 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0xa39/0xc90 fs/read_write.c:605
 ksys_write+0x171/0x2a0 fs/read_write.c:658
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x44ac89
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff12e8852f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004ce4d0 RCX: 000000000044ac89
RDX: 0000000000000082 RSI: 0000000020000180 RDI: 0000000000000006
RBP: 000000000049de98 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0030656c69662f2e
R13: 024645fc87234f45 R14: 26e1d8b70aefbc5b R15: 00000000004ce4d8

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_slab_alloc+0x96/0xd0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook mm/slab.h:519 [inline]
 slab_alloc_node mm/slub.c:2959 [inline]
 slab_alloc mm/slub.c:2967 [inline]
 kmem_cache_alloc+0x1d1/0x340 mm/slub.c:2972
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 acpi_os_acquire_object include/acpi/platform/aclinuxex.h:67 [inline]
 acpi_ut_allocate_object_desc_dbg+0xd8/0x165 drivers/acpi/acpica/utobject.c:359
 acpi_ut_create_internal_object_dbg+0x21/0x195 drivers/acpi/acpica/utobject.c:69
 acpi_ds_build_internal_object+0x15f/0x732 drivers/acpi/acpica/dsobject.c:94
 acpi_ds_create_node+0xe9/0x1a8 drivers/acpi/acpica/dsobject.c:281
 acpi_ds_load2_end_op+0x7d0/0xebc drivers/acpi/acpica/dswload2.c:618
 acpi_ds_exec_end_op+0x6ce/0x11d4 drivers/acpi/acpica/dswexec.c:637
 acpi_ps_parse_loop+0xd9f/0x1cf0 drivers/acpi/acpica/psloop.c:525
 acpi_ps_parse_aml+0x1d5/0x955 drivers/acpi/acpica/psparse.c:475
 acpi_ps_execute_table+0x317/0x3ef drivers/acpi/acpica/psxface.c:295
 acpi_ns_execute_table+0x436/0x5bf drivers/acpi/acpica/nsparse.c:116
 acpi_ns_load_table+0x5e/0x120 drivers/acpi/acpica/nsload.c:71
 acpi_tb_load_namespace+0x456/0x6b9 drivers/acpi/acpica/tbxfload.c:186
 acpi_load_tables+0x45/0xf5 drivers/acpi/acpica/tbxfload.c:59
 acpi_bus_init+0x9a/0x993 drivers/acpi/bus.c:1213
 acpi_init+0x8c/0x22c drivers/acpi/bus.c:1324
 do_one_initcall+0x197/0x3f0 init/main.c:1287
 do_initcall_level+0x14a/0x1f5 init/main.c:1360
 do_initcalls+0x4b/0x8c init/main.c:1376
 kernel_init_freeable+0x3f1/0x57e init/main.c:1598
 kernel_init+0x19/0x2a0 init/main.c:1490
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff8880195444e0
 which belongs to the cache Acpi-Operand of size 72
The buggy address is located 15 bytes inside of
 72-byte region [ffff8880195444e0, ffff888019544528)
The buggy address belongs to the page:
page:ffffea0000655100 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888019544068 pfn:0x19544
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0000654f88 ffffea0000654e08 ffff8880110c2b40
raw: ffff888019544068 000000000027001d 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 3012488798, free_ts 0
 prep_new_page mm/page_alloc.c:2436 [inline]
 get_page_from_freelist+0x779/0xa30 mm/page_alloc.c:4169
 __alloc_pages+0x26c/0x5f0 mm/page_alloc.c:5391
 alloc_page_interleave+0x22/0x1c0 mm/mempolicy.c:2119
 alloc_slab_page mm/slub.c:1691 [inline]
 allocate_slab+0xf1/0x540 mm/slub.c:1831
 new_slab mm/slub.c:1894 [inline]
 new_slab_objects mm/slub.c:2640 [inline]
 ___slab_alloc+0x1cf/0x350 mm/slub.c:2803
 __slab_alloc mm/slub.c:2843 [inline]
 slab_alloc_node mm/slub.c:2925 [inline]
 slab_alloc mm/slub.c:2967 [inline]
 kmem_cache_alloc+0x299/0x340 mm/slub.c:2972
 kmem_cache_zalloc include/linux/slab.h:711 [inline]
 acpi_os_acquire_object include/acpi/platform/aclinuxex.h:67 [inline]
 acpi_ut_allocate_object_desc_dbg+0xd8/0x165 drivers/acpi/acpica/utobject.c:359
 acpi_ut_create_internal_object_dbg+0x21/0x195 drivers/acpi/acpica/utobject.c:69
 acpi_ds_build_internal_object+0x15f/0x732 drivers/acpi/acpica/dsobject.c:94
 acpi_ds_create_node+0xe9/0x1a8 drivers/acpi/acpica/dsobject.c:281
 acpi_ds_load2_end_op+0x7d0/0xebc drivers/acpi/acpica/dswload2.c:618
 acpi_ds_exec_end_op+0x6ce/0x11d4 drivers/acpi/acpica/dswexec.c:637
 acpi_ps_parse_loop+0xd9f/0x1cf0 drivers/acpi/acpica/psloop.c:525
 acpi_ps_parse_aml+0x1d5/0x955 drivers/acpi/acpica/psparse.c:475
 acpi_ps_execute_table+0x317/0x3ef drivers/acpi/acpica/psxface.c:295
 acpi_ns_execute_table+0x436/0x5bf drivers/acpi/acpica/nsparse.c:116
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888019544400: fc fc 00 00 00 00 00 00 00 00 00 fc fc fc fc 00
 ffff888019544480: 00 00 00 00 00 00 00 00 fc fc fc fc 00 00 00 00
>ffff888019544500: 00 00 00 00 00 fc fc fc fc fb fb fb fb fb fb fb
                                  ^
 ffff888019544580: fb fb fc fc fc fc 00 00 00 00 00 00 00 00 00 fc
 ffff888019544600: fc fc fc 00 00 00 00 00 00 00 00 00 fc fc fc fc
==================================================================
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	ff c3                	inc    %ebx
   2:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
   9:	00 00 00 
   c:	0f 1f 40 00          	nopl   0x0(%rax)
  10:	48 89 f8             	mov    %rdi,%rax
  13:	48 89 f7             	mov    %rsi,%rdi
  16:	48 89 d6             	mov    %rdx,%rsi
  19:	48 89 ca             	mov    %rcx,%rdx
  1c:	4d 89 c2             	mov    %r8,%r10
  1f:	4d 89 c8             	mov    %r9,%r8
  22:	4c 8b 4c 24 08       	mov    0x8(%rsp),%r9
  27:	0f 05                	syscall 
  29:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax <-- trapping instruction
  2f:	73 01                	jae    0x32
  31:	c3                   	retq   
  32:	48 c7 c1 b8 ff ff ff 	mov    $0xffffffffffffffb8,%rcx
  39:	f7 d8                	neg    %eax
  3b:	64 89 01             	mov    %eax,%fs:(%rcx)
  3e:	48                   	rex.W

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/18 17:27 upstream 614cb2751d31 a2fe1cb5 .config console log report syz C ci-upstream-kasan-gce-smack-root KASAN: slab-out-of-bounds Write in ext4_write_inline_data_end
* Struck through repros no longer work on HEAD.