[v6.1] KASAN: stack-out-of-bounds Write in ktime_get_coarse_real_ts64

0 views
Skip to first unread message

syzbot

unread,
May 6, 2024, 6:48:27 AMMay 6
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 909ba1f1b414 Linux 6.1.90
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=16984338980000
kernel config: https://syzkaller.appspot.com/x/.config?x=3be6d6f79b879a67
dashboard link: https://syzkaller.appspot.com/bug?extid=4b6948146920cb72d329
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/63178de7cba7/disk-909ba1f1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/25dec90d8126/vmlinux-909ba1f1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/25509ea1c6cd/bzImage-909ba1f1.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4b6948...@syzkaller.appspotmail.com

==================================================================
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 ffffc900059066bf by task syz-executor.0/6238

CPU: 0 PID: 6238 Comm: syz-executor.0 Not tainted 6.1.90-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/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:0x7f162067dca9
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:00007f161f1f60c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f16207abf80 RCX: 00007f162067dca9
RDX: 000000000002a442 RSI: 00000000200001c0 RDI: ffffffffffffff9c
RBP: 00007f16206c947e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007f16207abf80 R15: 00007ffc82d91488
</TASK>

The buggy address belongs to stack of task syz-executor.0/6238
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
[ffffc90005900000, ffffc90005909000) created by:
copy_process+0x637/0x4060 kernel/fork.c:2098

The buggy address belongs to the physical page:
page:ffffea0001f7ed00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7dfb4
memcg:ffff88807bfafd82
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff ffff88807bfafd82
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 6236, tgid 6236 (syz-executor.0), ts 145906708751, free_ts 141739958083
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_list+0x663/0x900 mm/page_alloc.c:3499
release_pages+0x2836/0x2b40 mm/swap.c:1055
tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
exit_mmap+0x3c3/0x9f0 mm/mmap.c:3239
__mmput+0x115/0x3c0 kernel/fork.c:1199
exit_mm+0x226/0x300 kernel/exit.c:563
do_exit+0x9f6/0x26a0 kernel/exit.c:856
do_group_exit+0x202/0x2b0 kernel/exit.c:1019
get_signal+0x16f7/0x17d0 kernel/signal.c:2862
arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871
exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210
__syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303
do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87

Memory state around the buggy address:
ffffc90005906580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90005906600: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffffc90005906680: 00 00 00 00 f1 f1 f1 f1 00 f2 f2 f2 00 f3 f3 f3
^
ffffc90005906700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffc90005906780: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 00 f3 f3
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages