syzbot


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

Status: auto-obsoleted due to no activity on 2024/09/11 14:10
First crash: 166d, last: 166d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in unlink_file_vma (2) mm reiserfs C inconclusive done 1 326d 519d 0/28 auto-obsoleted due to no activity on 2024/04/15 03:04
android-54 KASAN: null-ptr-deref Write in unlink_file_vma 1 522d 522d 0/2 auto-obsoleted due to no activity on 2023/09/21 09:15

Sample crash report:
==================================================================
BUG: KASAN: stack-out-of-bounds in atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
BUG: KASAN: stack-out-of-bounds in atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
BUG: KASAN: stack-out-of-bounds in __down_write kernel/locking/rwsem.c:1424 [inline]
BUG: KASAN: stack-out-of-bounds in down_write+0x91/0x150 kernel/locking/rwsem.c:1583
Write of size 8 at addr ffff8881e1f17c00 by task syz-executor.3/6039

CPU: 0 PID: 6039 Comm: syz-executor.3 Tainted: G        W         5.4.274-syzkaller-00002-g6f97bd951d82 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d8/0x241 lib/dump_stack.c:118
 print_address_description+0x8c/0x600 mm/kasan/report.c:384
 __kasan_report+0xf3/0x120 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 check_memory_region_inline mm/kasan/generic.c:141 [inline]
 check_memory_region+0x272/0x280 mm/kasan/generic.c:191
 atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1503 [inline]
 atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline]
 __down_write kernel/locking/rwsem.c:1424 [inline]
 down_write+0x91/0x150 kernel/locking/rwsem.c:1583
 i_mmap_lock_write include/linux/fs.h:551 [inline]
 unlink_file_vma+0x7c/0x1b0 mm/mmap.c:163
 free_pgtables+0x135/0x280 mm/memory.c:428
 exit_mmap+0x2cb/0x520 mm/mmap.c:3192
 __mmput+0x8e/0x2c0 kernel/fork.c:1101
 exit_mm kernel/exit.c:536 [inline]
 do_exit+0xc08/0x2bc0 kernel/exit.c:846
 do_group_exit+0x138/0x300 kernel/exit.c:982
 get_signal+0xdb1/0x1440 kernel/signal.c:2735
 do_signal+0xb0/0x11f0 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0xc0/0x1a0 arch/x86/entry/common.c:159
 prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1
RIP: 0033:0x7f209cd01ea9
Code: Bad RIP value.
RSP: 002b:00007f209c05b178 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f209ce39058 RCX: 00007f209cd01ea9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f209ce39058
RBP: 00007f209ce39050 R08: 00007f209c05b6c0 R09: 00007f209c05b6c0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f209ce3905c
R13: 000000000000006e R14: 00007ffe285c13f0 R15: 00007ffe285c14d8

The buggy address belongs to the page:
page:ffffea000787c5c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x8000000000000000()
raw: 8000000000000000 0000000000000000 ffffea000787c5c8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x500dc0(GFP_USER|__GFP_ZERO|__GFP_ACCOUNT)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
 get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4893
 __alloc_pages include/linux/gfp.h:503 [inline]
 __alloc_pages_node include/linux/gfp.h:516 [inline]
 alloc_pages_node include/linux/gfp.h:530 [inline]
 alloc_thread_stack_node kernel/fork.c:259 [inline]
 dup_task_struct+0x85/0x600 kernel/fork.c:886
 copy_process+0x56d/0x3230 kernel/fork.c:1889
 _do_fork+0x197/0x900 kernel/fork.c:2399
 __do_sys_clone3 kernel/fork.c:2688 [inline]
 __se_sys_clone3 kernel/fork.c:2675 [inline]
 __x64_sys_clone3+0x2da/0x300 kernel/fork.c:2675
 do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 __free_pages_ok+0x847/0x950 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4955 [inline]
 __free_pages+0x91/0x140 mm/page_alloc.c:4961
 skb_release_all net/core/skbuff.c:675 [inline]
 __kfree_skb net/core/skbuff.c:689 [inline]
 kfree_skb+0xb8/0x3c0 net/core/skbuff.c:708
 __skb_queue_purge include/linux/skbuff.h:2826 [inline]
 __tipc_shutdown+0x113b/0x14c0 net/tipc/socket.c:540
 tipc_release+0x76/0xf10 net/tipc/socket.c:593
 __sock_release net/socket.c:591 [inline]
 sock_close+0xc7/0x220 net/socket.c:1277
 __fput+0x262/0x680 fs/file_table.c:281
 task_work_run+0x140/0x170 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x190/0x1a0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Memory state around the buggy address:
 ffff8881e1f17b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881e1f17b80: 00 00 00 00 f1 f1 f1 f1 04 f2 00 00 00 00 00 f2
>ffff8881e1f17c00: f2 f2 f2 f2 04 f2 04 f2 04 f3 f3 f3 00 00 00 00
                   ^
 ffff8881e1f17c80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8881e1f17d00: 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 f2 f2
==================================================================
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 6039 Comm: syz-executor.3 Tainted: G    B   W         5.4.274-syzkaller-00002-g6f97bd951d82 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
RIP: 0010:owner_on_cpu kernel/locking/rwsem.c:657 [inline]
RIP: 0010:rwsem_can_spin_on_owner+0xd8/0x170 kernel/locking/rwsem.c:681
Code: ff eb 02 31 db 89 d8 5b 41 5c 41 5e 41 5f c3 49 89 c6 b3 01 49 83 e6 f8 74 c8 83 e0 01 75 c3 4d 8d 7e 38 4c 89 f8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 75 5c 41 83 3f 00 74 a7 49 83 c6 3c 4c 89 f0
RSP: 0018:ffff8881f0bcf558 EFLAGS: 00010206
RAX: 0000000008008aa0 RBX: ffff8881e9679f01 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8881e1f17c08
RBP: ffff8881f0bcf770 R08: dffffc0000000000 R09: 0000000000000007
R10: ffffffffffffffff R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000000000002 R14: 00000000400454c8 R15: 0000000040045500
FS:  00007f209c05b6c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020294000 CR3: 00000001ee1c7000 CR4: 00000000003406a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
Call Trace:
 rwsem_down_write_slowpath+0x149/0x1430 kernel/locking/rwsem.c:1163
 __down_write kernel/locking/rwsem.c:1426 [inline]
 down_write+0x146/0x150 kernel/locking/rwsem.c:1583
 i_mmap_lock_write include/linux/fs.h:551 [inline]
 unlink_file_vma+0x7c/0x1b0 mm/mmap.c:163
 free_pgtables+0x135/0x280 mm/memory.c:428
 exit_mmap+0x2cb/0x520 mm/mmap.c:3192
 __mmput+0x8e/0x2c0 kernel/fork.c:1101
 exit_mm kernel/exit.c:536 [inline]
 do_exit+0xc08/0x2bc0 kernel/exit.c:846
 do_group_exit+0x138/0x300 kernel/exit.c:982
 get_signal+0xdb1/0x1440 kernel/signal.c:2735
 do_signal+0xb0/0x11f0 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0xc0/0x1a0 arch/x86/entry/common.c:159
 prepare_exit_to_usermode+0x199/0x200 arch/x86/entry/common.c:194
 entry_SYSCALL_64_after_hwframe+0x5c/0xc1
RIP: 0033:0x7f209cd01ea9
Code: Bad RIP value.
RSP: 002b:00007f209c05b178 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00007f209ce39058 RCX: 00007f209cd01ea9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 00007f209ce39058
RBP: 00007f209ce39050 R08: 00007f209c05b6c0 R09: 00007f209c05b6c0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f209ce3905c
R13: 000000000000006e R14: 00007ffe285c13f0 R15: 00007ffe285c14d8
Modules linked in:
---[ end trace 9e2259d49ef4ef60 ]---
RIP: 0010:owner_on_cpu kernel/locking/rwsem.c:657 [inline]
RIP: 0010:rwsem_can_spin_on_owner+0xd8/0x170 kernel/locking/rwsem.c:681
Code: ff eb 02 31 db 89 d8 5b 41 5c 41 5e 41 5f c3 49 89 c6 b3 01 49 83 e6 f8 74 c8 83 e0 01 75 c3 4d 8d 7e 38 4c 89 f8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 75 5c 41 83 3f 00 74 a7 49 83 c6 3c 4c 89 f0
RSP: 0018:ffff8881f0bcf558 EFLAGS: 00010206
RAX: 0000000008008aa0 RBX: ffff8881e9679f01 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8881e1f17c08
RBP: ffff8881f0bcf770 R08: dffffc0000000000 R09: 0000000000000007
R10: ffffffffffffffff R11: dffffc0000000001 R12: dffffc0000000000
R13: 0000000000000002 R14: 00000000400454c8 R15: 0000000040045500
FS:  00007f209c05b6c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f209cd01e7f CR3: 00000001ee1c7000 CR4: 00000000003406a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	eb 02                	jmp    0x4
   2:	31 db                	xor    %ebx,%ebx
   4:	89 d8                	mov    %ebx,%eax
   6:	5b                   	pop    %rbx
   7:	41 5c                	pop    %r12
   9:	41 5e                	pop    %r14
   b:	41 5f                	pop    %r15
   d:	c3                   	ret
   e:	49 89 c6             	mov    %rax,%r14
  11:	b3 01                	mov    $0x1,%bl
  13:	49 83 e6 f8          	and    $0xfffffffffffffff8,%r14
  17:	74 c8                	je     0xffffffe1
  19:	83 e0 01             	and    $0x1,%eax
  1c:	75 c3                	jne    0xffffffe1
  1e:	4d 8d 7e 38          	lea    0x38(%r14),%r15
  22:	4c 89 f8             	mov    %r15,%rax
  25:	48 c1 e8 03          	shr    $0x3,%rax
* 29:	42 0f b6 04 20       	movzbl (%rax,%r12,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	75 5c                	jne    0x8e
  32:	41 83 3f 00          	cmpl   $0x0,(%r15)
  36:	74 a7                	je     0xffffffdf
  38:	49 83 c6 3c          	add    $0x3c,%r14
  3c:	4c 89 f0             	mov    %r14,%rax

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/06/13 14:09 android12-5.4 6f97bd951d82 a9616ff5 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-4-perf-kasan KASAN: stack-out-of-bounds Write in unlink_file_vma
* Struck through repros no longer work on HEAD.