syzbot


KASAN: use-after-free Read in unmap_page_range (2)

Status: fixed on 2022/03/08 16:11
Subsystems: mm
[Documentation on labels]
Reported-by: syzbot+11210d36738191856de4@syzkaller.appspotmail.com
Fix commit: 337546e83fc7 mm/oom_kill.c: prevent a race between process_mrelease and exit_mmap
First crash: 903d, last: 882d
Cause bisection: introduced by (bisect log) [no-op commit]:
commit 1ccf7294b76d28d5151f024351c747ccf101d66e
Author: Matthew Brost <matthew.brost@intel.com>
Date: Thu Jul 8 16:20:49 2021 +0000

  drm/i915/guc: Relax CTB response timeout

Crash: possible deadlock in fs_reclaim_acquire (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
[syzbot] KASAN: use-after-free Read in unmap_page_range (2) 0 (1) 2021/10/31 17:40
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: Bad page map (5) mm io-uring C 35 460d 718d 22/26 fixed on 2023/02/24 13:50
upstream KASAN: use-after-free Read in unmap_page_range 1 2437d 2362d 0/26 closed as invalid on 2017/10/30 19:42
linux-4.19 general protection fault in unmap_page_range 2 851d 894d 0/1 auto-closed as invalid on 2022/04/18 12:45

Sample crash report:
general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
CPU: 1 PID: 8652 Comm: syz-executor811 Not tainted 5.15.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:__lock_acquire+0xd7d/0x54a0 kernel/locking/lockdep.c:4885
Code: e9 0d 41 be 01 00 00 00 0f 86 c8 00 00 00 89 05 f9 0b e9 0d e9 bd 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <80> 3c 02 00 0f 85 f3 2f 00 00 48 81 3b 00 35 f0 8e 0f 84 52 f3 ff
RSP: 0018:ffffc9000562f970 EFLAGS: 00010006
RAX: dffffc0000000000 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff888077151c80 R14: 0000000000000000 R15: 0000000000000000
FS:  0000555555f75300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffdc1e38c38 CR3: 00000000780df000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 lock_acquire kernel/locking/lockdep.c:5625 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5590
 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
 _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:363 [inline]
 zap_pte_range mm/memory.c:1320 [inline]
 zap_pmd_range mm/memory.c:1481 [inline]
 zap_pud_range mm/memory.c:1510 [inline]
 zap_p4d_range mm/memory.c:1531 [inline]
 unmap_page_range+0x87b/0x2a10 mm/memory.c:1552
 __oom_reap_task_mm+0x22d/0x400 mm/oom_kill.c:555
 __do_sys_process_mrelease+0x32a/0x400 mm/oom_kill.c:1199
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7faa3e405d29
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffdc1e38c38 EFLAGS: 00000246 ORIG_RAX: 00000000000001c0
RAX: ffffffffffffffda RBX: 0000000000011d9b RCX: 00007faa3e405d29
RDX: 00007faa3e405d29 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00007ffdc1e38dd8 R09: 00007ffdc1e38dd8
R10: 00007ffdc1e38dd8 R11: 0000000000000246 R12: 00007ffdc1e38c4c
R13: 431bde82d7b634db R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace 281cbdc141c02a9c ]---
RIP: 0010:__lock_acquire+0xd7d/0x54a0 kernel/locking/lockdep.c:4885
Code: e9 0d 41 be 01 00 00 00 0f 86 c8 00 00 00 89 05 f9 0b e9 0d e9 bd 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 da 48 c1 ea 03 <80> 3c 02 00 0f 85 f3 2f 00 00 48 81 3b 00 35 f0 8e 0f 84 52 f3 ff
RSP: 0018:ffffc9000562f970 EFLAGS: 00010006
RAX: dffffc0000000000 RBX: 0000000000000018 RCX: 0000000000000000
RDX: 0000000000000003 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: ffff888077151c80 R14: 0000000000000000 R15: 0000000000000000
FS:  0000555555f75300(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffdc1e38c38 CR3: 00000000780df000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	0d 41 be 01 00       	or     $0x1be41,%eax
   5:	00 00                	add    %al,(%rax)
   7:	0f 86 c8 00 00 00    	jbe    0xd5
   d:	89 05 f9 0b e9 0d    	mov    %eax,0xde90bf9(%rip)        # 0xde90c0c
  13:	e9 bd 00 00 00       	jmpq   0xd5
  18:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  1f:	fc ff df
  22:	48 89 da             	mov    %rbx,%rdx
  25:	48 c1 ea 03          	shr    $0x3,%rdx
* 29:	80 3c 02 00          	cmpb   $0x0,(%rdx,%rax,1) <-- trapping instruction
  2d:	0f 85 f3 2f 00 00    	jne    0x3026
  33:	48 81 3b 00 35 f0 8e 	cmpq   $0xffffffff8ef03500,(%rbx)
  3a:	0f                   	.byte 0xf
  3b:	84 52 f3             	test   %dl,-0xd(%rdx)
  3e:	ff                   	.byte 0xff

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/10/28 21:57 upstream 1fc596a56b33 be531bb4 .config console log report syz C ci-upstream-kasan-gce general protection fault in unmap_page_range
2021/10/28 21:01 upstream 1fc596a56b33 be531bb4 .config console log report info ci-upstream-kasan-gce KASAN: use-after-free Read in unmap_page_range
2021/11/18 12:42 upstream 42eb8fdac2fc cafff8b6 .config console log report info ci-upstream-kasan-gce-smack-root general protection fault in unmap_page_range
2021/10/29 22:25 linux-next bdcc9f6a5682 098b5d53 .config console log report info ci-upstream-linux-next-kasan-gce-root general protection fault in unmap_page_range
* Struck through repros no longer work on HEAD.