syzbot


KASAN: stack-out-of-bounds Write in ktime_get_coarse_real_ts64

Status: upstream: reported on 2024/05/06 10:48
Reported-by: syzbot+4b6948146920cb72d329@syzkaller.appspotmail.com
First crash: 22d, last: 9d15h
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: stack-out-of-bounds Write in ktime_get_coarse_real_ts64 ntfs3 C error done 1 406d 462d 0/26 auto-obsoleted due to no activity on 2023/08/16 11:49

Sample crash report:
loop1: detected capacity change from 0 to 4096
ntfs3: loop1: Different NTFS' sector size (1024) and media sector size (512)
==================================================================
BUG: KASAN: stack-out-of-bounds in native_save_fl arch/x86/include/asm/irqflags.h:22 [inline]
BUG: KASAN: stack-out-of-bounds in arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
BUG: KASAN: stack-out-of-bounds in arch_irqs_disabled arch/x86/include/asm/irqflags.h:130 [inline]
BUG: KASAN: stack-out-of-bounds in seqcount_lockdep_reader_access+0x173/0x220 include/linux/seqlock.h:104
Write of size 8 at addr ffffc90004fc66bf by task syz-executor.1/4880

CPU: 1 PID: 4880 Comm: syz-executor.1 Not tainted 6.1.91-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:395
 kasan_report+0x136/0x160 mm/kasan/report.c:495
 native_save_fl arch/x86/include/asm/irqflags.h:22 [inline]
 arch_local_save_flags arch/x86/include/asm/irqflags.h:70 [inline]
 arch_irqs_disabled arch/x86/include/asm/irqflags.h:130 [inline]
 seqcount_lockdep_reader_access+0x173/0x220 include/linux/seqlock.h:104
 ktime_get_coarse_real_ts64+0x36/0x120 kernel/time/timekeeping.c:2261
 current_time+0x87/0x2f0 fs/inode.c:2495
 atime_needs_update+0x3fa/0x7b0 fs/inode.c:1953
 touch_atime+0xe4/0x680 fs/inode.c:1970
 file_accessed include/linux/fs.h:2595 [inline]
 filemap_read+0x2ef3/0x31d0 mm/filemap.c:2807
 __kernel_read+0x41e/0x8a0 fs/read_write.c:428
 integrity_kernel_read+0xac/0xf0 security/integrity/iint.c:228
 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+0xa57/0x1c00 security/integrity/ima/ima_crypto.c:573
 ima_collect_measurement+0x59a/0xc30 security/integrity/ima/ima_api.c:293
 process_measurement+0x135c/0x21b0 security/integrity/ima/ima_main.c:351
 ima_file_check+0xed/0x170 security/integrity/ima/ima_main.c:534
 do_open fs/namei.c:3630 [inline]
 path_openat+0x2687/0x2e60 fs/namei.c:3785
 do_filp_open+0x230/0x480 fs/namei.c:3812
 do_sys_openat2+0x13b/0x500 fs/open.c:1318
 do_sys_open fs/open.c:1334 [inline]
 __do_sys_openat fs/open.c:1350 [inline]
 __se_sys_openat fs/open.c:1345 [inline]
 __x64_sys_openat+0x243/0x290 fs/open.c:1345
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f2c4167cee9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f2c4244d0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f2c417abf80 RCX: 00007f2c4167cee9
RDX: 000000000002a442 RSI: 00000000200001c0 RDI: ffffffffffffff9c
RBP: 00007f2c416c949e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f2c417abf80 R15: 00007ffdf863fd58
 </TASK>

The buggy address belongs to stack of task syz-executor.1/4880
 and is located at offset 31 in frame:
 seqcount_lockdep_reader_access+0x0/0x220

This frame has 2 objects:
 [32, 40) 'flags.i.i.i1'
 [64, 72) 'flags.i.i.i'

The buggy address belongs to the virtual mapping at
 [ffffc90004fc0000, ffffc90004fc9000) created by:
 copy_process+0x637/0x4060 kernel/fork.c:2098

The buggy address belongs to the physical page:
page:ffffea00015e2f80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x578be
memcg:ffff88801f3c6c02
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff88801f3c6c02
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x102dc2(GFP_HIGHUSER|__GFP_NOWARN|__GFP_ZERO), pid 4879, tgid 4879 (syz-executor.1), ts 113102429620, free_ts 112901145697
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2513
 prep_new_page mm/page_alloc.c:2520 [inline]
 get_page_from_freelist+0x31a1/0x3320 mm/page_alloc.c:4279
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5547
 vm_area_alloc_pages mm/vmalloc.c:2983 [inline]
 __vmalloc_area_node mm/vmalloc.c:3051 [inline]
 __vmalloc_node_range+0x96c/0x1460 mm/vmalloc.c:3223
 alloc_thread_stack_node kernel/fork.c:311 [inline]
 dup_task_struct+0x3e5/0x6d0 kernel/fork.c:988
 copy_process+0x637/0x4060 kernel/fork.c:2098
 kernel_clone+0x222/0x920 kernel/fork.c:2682
 __do_sys_clone3 kernel/fork.c:2981 [inline]
 __se_sys_clone3+0x373/0x410 kernel/fork.c:2965
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 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:1440 [inline]
 free_pcp_prepare mm/page_alloc.c:1490 [inline]
 free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3358
 free_unref_page+0x33/0x3e0 mm/page_alloc.c:3453
 __vunmap+0x834/0x9a0 mm/vmalloc.c:2717
 free_work+0x57/0x80 mm/vmalloc.c:97
 process_one_work+0x8a9/0x11d0 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308

Memory state around the buggy address:
 ffffc90004fc6580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90004fc6600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90004fc6680: 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 00 f3 f3 f3
                                        ^
 ffffc90004fc6700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffc90004fc6780: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 f3 f3
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/05/19 17:01 linux-6.1.y 4078fa637fcd c0f1611a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: stack-out-of-bounds Write in ktime_get_coarse_real_ts64
2024/05/06 10:48 linux-6.1.y 909ba1f1b414 d884b519 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: stack-out-of-bounds Write in ktime_get_coarse_real_ts64
* Struck through repros no longer work on HEAD.