syzbot


divide error in damon_set_attrs

Status: fixed on 2023/07/04 09:17
Subsystems: damon
[Documentation on labels]
Reported-by: syzbot+841a46899768ec7bec67@syzkaller.appspotmail.com
Fix commit: 5ff6e2fff88e mm/damon/core: fix divide error in damon_nr_accesses_to_accesses_bp()
First crash: 337d, last: 322d
Discussions (3)
Title Replies (including bot) Last reply
[PATCH v2] mm/damon/core: fix divide error in damon_nr_accesses_to_accesses_bp() 1 (1) 2023/05/27 03:21
[PATCH] mm/damon/core: fix divide error in damon_nr_accesses_to_accesses_bp() 3 (3) 2023/05/27 02:34
[syzbot] [damon?] divide error in damon_set_attrs 7 (8) 2023/05/27 02:08

Sample crash report:
divide error: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 16255 Comm: syz-executor.3 Not tainted 6.4.0-rc5-syzkaller-00016-ga4d7d7011219 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/25/2023
RIP: 0010:damon_nr_accesses_to_accesses_bp mm/damon/core.c:491 [inline]
RIP: 0010:damon_nr_accesses_for_new_attrs mm/damon/core.c:497 [inline]
RIP: 0010:damon_update_monitoring_result mm/damon/core.c:506 [inline]
RIP: 0010:damon_update_monitoring_results mm/damon/core.c:534 [inline]
RIP: 0010:damon_set_attrs+0x224/0x460 mm/damon/core.c:555
Code: 03 42 0f b6 04 20 84 c0 74 08 3c 03 0f 8e b3 01 00 00 48 8b 43 08 31 d2 41 69 4f 18 10 27 00 00 48 f7 33 31 d2 48 89 c7 89 c8 <f7> f7 31 d2 49 8d 7f 30 89 c1 49 8b 46 08 49 f7 36 0f af c8 b8 59
RSP: 0018:ffffc900077b7c08 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff888016259c00 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81e2ff90 RDI: 0000000000000000
RBP: ffff88802c5a6310 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000800 R11: 0000000000000001 R12: dffffc0000000000
R13: ffff88802c5a6300 R14: ffffc900077b7c80 R15: ffff88802a7b5108
FS:  00007f8253919700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020293030 CR3: 0000000043d39000 CR4: 00000000003526e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 dbgfs_attrs_write+0x225/0x280 mm/damon/dbgfs.c:101
 full_proxy_write+0x11c/0x190 fs/debugfs/file.c:236
 vfs_write+0x2ae/0xd50 fs/read_write.c:582
 ksys_write+0x12b/0x250 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f8252c8c169
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f8253919168 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f8252dabf80 RCX: 00007f8252c8c169
RDX: 0000000000000069 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00007f8252ce7ca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f8252ecfb1f R14: 00007f8253919300 R15: 0000000000022000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:damon_nr_accesses_to_accesses_bp mm/damon/core.c:491 [inline]
RIP: 0010:damon_nr_accesses_for_new_attrs mm/damon/core.c:497 [inline]
RIP: 0010:damon_update_monitoring_result mm/damon/core.c:506 [inline]
RIP: 0010:damon_update_monitoring_results mm/damon/core.c:534 [inline]
RIP: 0010:damon_set_attrs+0x224/0x460 mm/damon/core.c:555
Code: 03 42 0f b6 04 20 84 c0 74 08 3c 03 0f 8e b3 01 00 00 48 8b 43 08 31 d2 41 69 4f 18 10 27 00 00 48 f7 33 31 d2 48 89 c7 89 c8 <f7> f7 31 d2 49 8d 7f 30 89 c1 49 8b 46 08 49 f7 36 0f af c8 b8 59
RSP: 0018:ffffc900077b7c08 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff888016259c00 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81e2ff90 RDI: 0000000000000000
RBP: ffff88802c5a6310 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000800 R11: 0000000000000001 R12: dffffc0000000000
R13: ffff88802c5a6300 R14: ffffc900077b7c80 R15: ffff88802a7b5108
FS:  00007f8253919700(0000) GS:ffff8880b9900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020070030 CR3: 0000000043d39000 CR4: 00000000003526e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	03 42 0f             	add    0xf(%rdx),%eax
   3:	b6 04                	mov    $0x4,%dh
   5:	20 84 c0 74 08 3c 03 	and    %al,0x33c0874(%rax,%rax,8)
   c:	0f 8e b3 01 00 00    	jle    0x1c5
  12:	48 8b 43 08          	mov    0x8(%rbx),%rax
  16:	31 d2                	xor    %edx,%edx
  18:	41 69 4f 18 10 27 00 	imul   $0x2710,0x18(%r15),%ecx
  1f:	00
  20:	48 f7 33             	divq   (%rbx)
  23:	31 d2                	xor    %edx,%edx
  25:	48 89 c7             	mov    %rax,%rdi
  28:	89 c8                	mov    %ecx,%eax
* 2a:	f7 f7                	div    %edi <-- trapping instruction
  2c:	31 d2                	xor    %edx,%edx
  2e:	49 8d 7f 30          	lea    0x30(%r15),%rdi
  32:	89 c1                	mov    %eax,%ecx
  34:	49 8b 46 08          	mov    0x8(%r14),%rax
  38:	49 f7 36             	divq   (%r14)
  3b:	0f af c8             	imul   %eax,%ecx
  3e:	b8                   	.byte 0xb8
  3f:	59                   	pop    %rcx

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/07 02:40 upstream a4d7d7011219 a4ae4f42 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce divide error in damon_set_attrs
2023/05/22 11:41 upstream 44c026a73be8 4bce1a3e .config console log report info ci-upstream-kasan-gce-386 divide error in damon_set_attrs
* Struck through repros no longer work on HEAD.