All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] divide error in dbNextAG
@ 2022-03-19 18:07 syzbot
  2022-03-19 18:23 ` Pavel Skripkin
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2022-03-19 18:07 UTC (permalink / raw)
  To: jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    09688c0166e7 Linux 5.17-rc8
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=163e5015700000
kernel config:  https://syzkaller.appspot.com/x/.config?x=70f75a89c7a0e6bc
dashboard link: https://syzkaller.appspot.com/bug?extid=46f5c25af73eb8330eb6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=132c1d61700000

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

divide error: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 3622 Comm: syz-executor.0 Not tainted 5.17.0-rc8-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:dbNextAG+0xfc/0x5f0 fs/jfs/jfs_dmap.c:602
Code: 48 89 c1 48 89 44 24 08 83 e0 07 48 c1 e9 03 0f b6 0c 11 48 89 c2 83 c2 03 38 ca 7c 08 84 c9 0f 85 ca 03 00 00 44 89 f8 31 d2 <41> f7 75 14 49 89 c7 49 8d 45 20 48 89 c2 48 89 44 24 20 48 b8 00
RSP: 0018:ffffc900028d7a40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff88801d782800 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88801f5c3008
RBP: ffff88801d782800 R08: 0000000000000000 R09: ffffc900028d797f
R10: fffff5200051af2f R11: 0000000000000000 R12: ffff88806dede530
R13: ffff88801f5c3000 R14: ffff88806dedf598 R15: 0000000000000000
FS:  00007f05def99700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f05def99718 CR3: 000000001ef61000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 diAlloc+0xa96/0x1730 fs/jfs/jfs_imap.c:1342
 ialloc+0x89/0xaa0 fs/jfs/jfs_inode.c:56
 jfs_mkdir+0x1f0/0xab0 fs/jfs/namei.c:225
 vfs_mkdir+0x1c3/0x3b0 fs/namei.c:3933
 do_mkdirat+0x285/0x300 fs/namei.c:3959
 __do_sys_mkdirat fs/namei.c:3974 [inline]
 __se_sys_mkdirat fs/namei.c:3972 [inline]
 __x64_sys_mkdirat+0x115/0x170 fs/namei.c:3972
 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:0x7f05df845049
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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:00007f05def99168 EFLAGS: 00000246 ORIG_RAX: 0000000000000102
RAX: ffffffffffffffda RBX: 00007f05df958030 RCX: 00007f05df845049
RDX: 0000000000000020 RSI: 0000000020000300 RDI: 0000000000000005
RBP: 00007f05df89f08d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc16fbfa9f R14: 00007f05def99300 R15: 0000000000022000
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:dbNextAG+0xfc/0x5f0 fs/jfs/jfs_dmap.c:602
Code: 48 89 c1 48 89 44 24 08 83 e0 07 48 c1 e9 03 0f b6 0c 11 48 89 c2 83 c2 03 38 ca 7c 08 84 c9 0f 85 ca 03 00 00 44 89 f8 31 d2 <41> f7 75 14 49 89 c7 49 8d 45 20 48 89 c2 48 89 44 24 20 48 b8 00
RSP: 0018:ffffc900028d7a40 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff88801d782800 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff88801f5c3008
RBP: ffff88801d782800 R08: 0000000000000000 R09: ffffc900028d797f
R10: fffff5200051af2f R11: 0000000000000000 R12: ffff88806dede530
R13: ffff88801f5c3000 R14: ffff88806dedf598 R15: 0000000000000000
FS:  00007f05def99700(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffcf01138f8 CR3: 000000001ef61000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	48 89 c1             	mov    %rax,%rcx
   3:	48 89 44 24 08       	mov    %rax,0x8(%rsp)
   8:	83 e0 07             	and    $0x7,%eax
   b:	48 c1 e9 03          	shr    $0x3,%rcx
   f:	0f b6 0c 11          	movzbl (%rcx,%rdx,1),%ecx
  13:	48 89 c2             	mov    %rax,%rdx
  16:	83 c2 03             	add    $0x3,%edx
  19:	38 ca                	cmp    %cl,%dl
  1b:	7c 08                	jl     0x25
  1d:	84 c9                	test   %cl,%cl
  1f:	0f 85 ca 03 00 00    	jne    0x3ef
  25:	44 89 f8             	mov    %r15d,%eax
  28:	31 d2                	xor    %edx,%edx
* 2a:	41 f7 75 14          	divl   0x14(%r13) <-- trapping instruction
  2e:	49 89 c7             	mov    %rax,%r15
  31:	49 8d 45 20          	lea    0x20(%r13),%rax
  35:	48 89 c2             	mov    %rax,%rdx
  38:	48 89 44 24 20       	mov    %rax,0x20(%rsp)
  3d:	48                   	rex.W
  3e:	b8                   	.byte 0xb8


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] divide error in dbNextAG
  2022-03-19 18:07 [syzbot] divide error in dbNextAG syzbot
@ 2022-03-19 18:23 ` Pavel Skripkin
  2022-03-19 18:32   ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Skripkin @ 2022-03-19 18:23 UTC (permalink / raw)
  To: syzbot, jfs-discussion, linux-kernel, shaggy, syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 1156 bytes --]

On 3/19/22 21:07, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    09688c0166e7 Linux 5.17-rc8
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=163e5015700000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=70f75a89c7a0e6bc
> dashboard link: https://syzkaller.appspot.com/bug?extid=46f5c25af73eb8330eb6
> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=132c1d61700000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+46f5c25af73eb8330eb6@syzkaller.appspotmail.com
> 
> divide error: 0000 [#1] PREEMPT SMP KASAN
> CPU: 1 PID: 3622 Comm: syz-executor.0 Not tainted 5.17.0-rc8-syzkaller #0
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
> RIP: 0010:dbNextAG+0xfc/0x5f0 fs/jfs/jfs_dmap.c:602

Looks like malicious fs image with bmp->db_numag == 0.

#syz test:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master




With regards,
Pavel Skripkin

[-- Attachment #2: ph --]
[-- Type: text/plain, Size: 752 bytes --]

diff --git a/fs/jfs/jfs_dmap.c b/fs/jfs/jfs_dmap.c
index 91f4ec93dab1..633a9aff0868 100644
--- a/fs/jfs/jfs_dmap.c
+++ b/fs/jfs/jfs_dmap.c
@@ -148,6 +148,7 @@ static const s8 budtab[256] = {
  *	0	- success
  *	-ENOMEM	- insufficient memory
  *	-EIO	- i/o error
+ *	-EINVAL - wrong bmap data
  */
 int dbMount(struct inode *ipbmap)
 {
@@ -179,6 +180,9 @@ int dbMount(struct inode *ipbmap)
 	bmp->db_nfree = le64_to_cpu(dbmp_le->dn_nfree);
 	bmp->db_l2nbperpage = le32_to_cpu(dbmp_le->dn_l2nbperpage);
 	bmp->db_numag = le32_to_cpu(dbmp_le->dn_numag);
+	if (!bmp->db_numag)
+		return -EINVAL;
+
 	bmp->db_maxlevel = le32_to_cpu(dbmp_le->dn_maxlevel);
 	bmp->db_maxag = le32_to_cpu(dbmp_le->dn_maxag);
 	bmp->db_agpref = le32_to_cpu(dbmp_le->dn_agpref);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [syzbot] divide error in dbNextAG
  2022-03-19 18:23 ` Pavel Skripkin
@ 2022-03-19 18:32   ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2022-03-19 18:32 UTC (permalink / raw)
  To: jfs-discussion, linux-kernel, paskripkin, shaggy, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+46f5c25af73eb8330eb6@syzkaller.appspotmail.com

Tested on:

commit:         34e047aa Merge tag 'arm64-fixes' of git://git.kernel.o..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=70f75a89c7a0e6bc
dashboard link: https://syzkaller.appspot.com/bug?extid=46f5c25af73eb8330eb6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch:          https://syzkaller.appspot.com/x/patch.diff?x=14c2cd33700000

Note: testing is done by a robot and is best-effort only.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-19 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19 18:07 [syzbot] divide error in dbNextAG syzbot
2022-03-19 18:23 ` Pavel Skripkin
2022-03-19 18:32   ` syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.