Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Jaegeuk Kim
On 04/24, Dmitry Vyukov wrote:
> On Tue, Apr 24, 2018 at 8:42 AM, syzbot
>  wrote:
> > Hello,
> >
> > syzbot tried to test the proposed patch but build/boot failed:
> >
> > failed to create VM pool: failed to create GCE image: failed to get create
> > image operation operation-1524552040215-56a926ecc71d9-3edfeb8b-8abca81c:
> > googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded
> >
> >
> > Tested on git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev
> > commit
> > b549e322861b99f1862fb5f08dfb5e5753a38635 (Sat Apr 21 06:44:59 2018 +)
> > f2fs: check cap_resource only for data blocks
> >
> > compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> > Patch: https://syzkaller.appspot.com/x/patch.diff?id=5565179303559168
> > Kernel config:
> > https://syzkaller.appspot.com/x/.config?id=1808800213120130118
> 
> Hi Jaegeuk,
> 
> Re the last failure (rate limiting), now should be fixed with:
> https://github.com/google/syzkaller/commit/e2f4bf8f3818d49baf0f3789add75d5fd506ad8d
> which adds some backoff-and-retry logic.
> 
> Re the first one, do I understand it correctly that dev-test already
> contains the fix that you want to test?
> We did not foresee such case initially, but you are not the first one
> to try this. I've added support for testing without a patch now:
> https://github.com/google/syzkaller/commit/9366d03f001170479319878905031f63d4377c46
> and updated the docs:
> https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches
> 
> So now this should work:
> 
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
> dev-test

Cool! Thank you so much.



Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Jaegeuk Kim
On 04/24, Dmitry Vyukov wrote:
> On Tue, Apr 24, 2018 at 8:42 AM, syzbot
>  wrote:
> > Hello,
> >
> > syzbot tried to test the proposed patch but build/boot failed:
> >
> > failed to create VM pool: failed to create GCE image: failed to get create
> > image operation operation-1524552040215-56a926ecc71d9-3edfeb8b-8abca81c:
> > googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded
> >
> >
> > Tested on git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev
> > commit
> > b549e322861b99f1862fb5f08dfb5e5753a38635 (Sat Apr 21 06:44:59 2018 +)
> > f2fs: check cap_resource only for data blocks
> >
> > compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> > Patch: https://syzkaller.appspot.com/x/patch.diff?id=5565179303559168
> > Kernel config:
> > https://syzkaller.appspot.com/x/.config?id=1808800213120130118
> 
> Hi Jaegeuk,
> 
> Re the last failure (rate limiting), now should be fixed with:
> https://github.com/google/syzkaller/commit/e2f4bf8f3818d49baf0f3789add75d5fd506ad8d
> which adds some backoff-and-retry logic.
> 
> Re the first one, do I understand it correctly that dev-test already
> contains the fix that you want to test?
> We did not foresee such case initially, but you are not the first one
> to try this. I've added support for testing without a patch now:
> https://github.com/google/syzkaller/commit/9366d03f001170479319878905031f63d4377c46
> and updated the docs:
> https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches
> 
> So now this should work:
> 
> #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
> dev-test

Cool! Thank you so much.



Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread syzbot

Hello,

syzbot has tested the proposed patch but the reproducer still triggered  
crash:

kernel BUG at fs/f2fs/inode.c:LINE!

F2FS-fs (loop5): invalid crc value
F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop5): check_nid_range: out-of-range nid=1, run fsck to fix.
[ cut here ]
kernel BUG at fs/f2fs/inode.c:588!
invalid opcode:  [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 4848 Comm: syz-executor5 Not tainted 4.17.0-rc1+ #1
F2FS-fs (loop0): invalid crc value
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

RIP: 0010:f2fs_evict_inode+0x1344/0x1710 fs/f2fs/inode.c:587
RSP: 0018:8801bf96ef10 EFLAGS: 00010293
RAX: 8801abfa8040 RBX: 8801a8957080 RCX: 82eb2fc6
RDX:  RSI: 82eb2fd4 RDI: 0001
RBP: 8801bf96f0f8 R08: 8801abfa8040 R09: ed003a0331b5
F2FS-fs (loop6): Magic Mismatch, valid(0xf2f52010) - read(0x0)
R10: ed003a0331b5 R11: 8801d0198dab R12: 
R13: ffea R14:  R15: 0001
FS:  7febdf624700() GS:8801daf0() knlGS:
F2FS-fs (loop6): Can't find valid F2FS filesystem in 1th superblock
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 02431228 CR3: 0001d7686000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
F2FS-fs (loop0): check_nid_range: out-of-range nid=1, run fsck to fix.
Call Trace:
[ cut here ]
kernel BUG at fs/f2fs/inode.c:588!
 evict+0x4a6/0x960 fs/inode.c:557
 iput_final fs/inode.c:1519 [inline]
 iput+0x62d/0xa80 fs/inode.c:1545
 f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
 mount_bdev+0x30c/0x3e0 fs/super.c:1165
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
 mount_fs+0xae/0x328 fs/super.c:1268
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2517 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2847
 ksys_mount+0x12d/0x140 fs/namespace.c:3063
 __do_sys_mount fs/namespace.c:3077 [inline]
 __se_sys_mount fs/namespace.c:3074 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3074
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457dba
RSP: 002b:7febdf623ba8 EFLAGS: 0246 ORIG_RAX: 00a5
RAX: ffda RBX: 2000 RCX: 00457dba
RDX: 2000 RSI: 2100 RDI: 7febdf623bf0
RBP: 006a R08: 20016a00 R09: 2000
R10:  R11: 0246 R12: 0003
R13: 006a R14: 006fcb80 R15: 
Code: 5e 03 00 00 8b 73 40 4c 89 e7 31 d2 e8 c6 e1 05 00 31 ff 41 89 c4 89  
c6 e8 2a 01 8e fe 45 84 e4 0f 85 b1 f3 ff ff e8 4c 00 8e fe <0f> 0b e8 85  
5a ca fe e9 c7 ee ff ff e8 7b 5a ca fe e9 10 ef ff
RIP: f2fs_evict_inode+0x1344/0x1710 fs/f2fs/inode.c:587 RSP:  
8801bf96ef10

invalid opcode:  [#2] SMP KASAN
---[ end trace a8c4607d38f9047d ]---
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:


Tested on  
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev-test  
commit

65b966f58e8264477da6c8b70703ce362cb1f8f0 (Tue Apr 24 05:02:31 2018 +)
f2fs: give message and set need_fsck given broken node id

compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=1808800213120130118
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=5916974974500864




Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread syzbot

Hello,

syzbot has tested the proposed patch but the reproducer still triggered  
crash:

kernel BUG at fs/f2fs/inode.c:LINE!

F2FS-fs (loop5): invalid crc value
F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop5): check_nid_range: out-of-range nid=1, run fsck to fix.
[ cut here ]
kernel BUG at fs/f2fs/inode.c:588!
invalid opcode:  [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 4848 Comm: syz-executor5 Not tainted 4.17.0-rc1+ #1
F2FS-fs (loop0): invalid crc value
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

RIP: 0010:f2fs_evict_inode+0x1344/0x1710 fs/f2fs/inode.c:587
RSP: 0018:8801bf96ef10 EFLAGS: 00010293
RAX: 8801abfa8040 RBX: 8801a8957080 RCX: 82eb2fc6
RDX:  RSI: 82eb2fd4 RDI: 0001
RBP: 8801bf96f0f8 R08: 8801abfa8040 R09: ed003a0331b5
F2FS-fs (loop6): Magic Mismatch, valid(0xf2f52010) - read(0x0)
R10: ed003a0331b5 R11: 8801d0198dab R12: 
R13: ffea R14:  R15: 0001
FS:  7febdf624700() GS:8801daf0() knlGS:
F2FS-fs (loop6): Can't find valid F2FS filesystem in 1th superblock
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 02431228 CR3: 0001d7686000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
F2FS-fs (loop0): check_nid_range: out-of-range nid=1, run fsck to fix.
Call Trace:
[ cut here ]
kernel BUG at fs/f2fs/inode.c:588!
 evict+0x4a6/0x960 fs/inode.c:557
 iput_final fs/inode.c:1519 [inline]
 iput+0x62d/0xa80 fs/inode.c:1545
 f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
 mount_bdev+0x30c/0x3e0 fs/super.c:1165
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
 mount_fs+0xae/0x328 fs/super.c:1268
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2517 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2847
 ksys_mount+0x12d/0x140 fs/namespace.c:3063
 __do_sys_mount fs/namespace.c:3077 [inline]
 __se_sys_mount fs/namespace.c:3074 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3074
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457dba
RSP: 002b:7febdf623ba8 EFLAGS: 0246 ORIG_RAX: 00a5
RAX: ffda RBX: 2000 RCX: 00457dba
RDX: 2000 RSI: 2100 RDI: 7febdf623bf0
RBP: 006a R08: 20016a00 R09: 2000
R10:  R11: 0246 R12: 0003
R13: 006a R14: 006fcb80 R15: 
Code: 5e 03 00 00 8b 73 40 4c 89 e7 31 d2 e8 c6 e1 05 00 31 ff 41 89 c4 89  
c6 e8 2a 01 8e fe 45 84 e4 0f 85 b1 f3 ff ff e8 4c 00 8e fe <0f> 0b e8 85  
5a ca fe e9 c7 ee ff ff e8 7b 5a ca fe e9 10 ef ff
RIP: f2fs_evict_inode+0x1344/0x1710 fs/f2fs/inode.c:587 RSP:  
8801bf96ef10

invalid opcode:  [#2] SMP KASAN
---[ end trace a8c4607d38f9047d ]---
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:


Tested on  
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev-test  
commit

65b966f58e8264477da6c8b70703ce362cb1f8f0 (Tue Apr 24 05:02:31 2018 +)
f2fs: give message and set need_fsck given broken node id

compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=1808800213120130118
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=5916974974500864




Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Dmitry Vyukov
On Tue, Apr 24, 2018 at 8:42 AM, syzbot
 wrote:
> Hello,
>
> syzbot tried to test the proposed patch but build/boot failed:
>
> failed to create VM pool: failed to create GCE image: failed to get create
> image operation operation-1524552040215-56a926ecc71d9-3edfeb8b-8abca81c:
> googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded
>
>
> Tested on git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev
> commit
> b549e322861b99f1862fb5f08dfb5e5753a38635 (Sat Apr 21 06:44:59 2018 +)
> f2fs: check cap_resource only for data blocks
>
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> Patch: https://syzkaller.appspot.com/x/patch.diff?id=5565179303559168
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=1808800213120130118

Hi Jaegeuk,

Re the last failure (rate limiting), now should be fixed with:
https://github.com/google/syzkaller/commit/e2f4bf8f3818d49baf0f3789add75d5fd506ad8d
which adds some backoff-and-retry logic.

Re the first one, do I understand it correctly that dev-test already
contains the fix that you want to test?
We did not foresee such case initially, but you are not the first one
to try this. I've added support for testing without a patch now:
https://github.com/google/syzkaller/commit/9366d03f001170479319878905031f63d4377c46
and updated the docs:
https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches

So now this should work:

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
dev-test


Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Dmitry Vyukov
On Tue, Apr 24, 2018 at 8:42 AM, syzbot
 wrote:
> Hello,
>
> syzbot tried to test the proposed patch but build/boot failed:
>
> failed to create VM pool: failed to create GCE image: failed to get create
> image operation operation-1524552040215-56a926ecc71d9-3edfeb8b-8abca81c:
> googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded
>
>
> Tested on git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev
> commit
> b549e322861b99f1862fb5f08dfb5e5753a38635 (Sat Apr 21 06:44:59 2018 +)
> f2fs: check cap_resource only for data blocks
>
> compiler: gcc (GCC) 8.0.1 20180413 (experimental)
> Patch: https://syzkaller.appspot.com/x/patch.diff?id=5565179303559168
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=1808800213120130118

Hi Jaegeuk,

Re the last failure (rate limiting), now should be fixed with:
https://github.com/google/syzkaller/commit/e2f4bf8f3818d49baf0f3789add75d5fd506ad8d
which adds some backoff-and-retry logic.

Re the first one, do I understand it correctly that dev-test already
contains the fix that you want to test?
We did not foresee such case initially, but you are not the first one
to try this. I've added support for testing without a patch now:
https://github.com/google/syzkaller/commit/9366d03f001170479319878905031f63d4377c46
and updated the docs:
https://github.com/google/syzkaller/blob/master/docs/syzbot.md#testing-patches

So now this should work:

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git
dev-test


Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread syzbot

Hello,

syzbot tried to test the proposed patch but build/boot failed:

failed to create VM pool: failed to create GCE image: failed to get create  
image operation operation-1524552040215-56a926ecc71d9-3edfeb8b-8abca81c:  
googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded



Tested on  
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev commit

b549e322861b99f1862fb5f08dfb5e5753a38635 (Sat Apr 21 06:44:59 2018 +)
f2fs: check cap_resource only for data blocks

compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Patch: https://syzkaller.appspot.com/x/patch.diff?id=5565179303559168
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=1808800213120130118





Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread syzbot

Hello,

syzbot tried to test the proposed patch but build/boot failed:

failed to create VM pool: failed to create GCE image: failed to get create  
image operation operation-1524552040215-56a926ecc71d9-3edfeb8b-8abca81c:  
googleapi: Error 403: Rate Limit Exceeded, rateLimitExceeded



Tested on  
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev commit

b549e322861b99f1862fb5f08dfb5e5753a38635 (Sat Apr 21 06:44:59 2018 +)
f2fs: check cap_resource only for data blocks

compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Patch: https://syzkaller.appspot.com/x/patch.diff?id=5565179303559168
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=1808800213120130118





Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Jaegeuk Kim
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev
>From 65b966f58e8264477da6c8b70703ce362cb1f8f0 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim 
Date: Mon, 23 Apr 2018 23:02:31 -0600
Subject: [PATCH] f2fs: give message and set need_fsck given broken node id

syzbot hit the following crash on upstream commit
83beed7b2b26f232d782127792dd0cd4362fdc41 (Fri Apr 20 17:56:32 2018 +)
Merge branch 'fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
syzbot dashboard link: 
https://syzkaller.appspot.com/bug?extid=d154ec99402c6f628887

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5414336294027264
syzkaller reproducer: 
https://syzkaller.appspot.com/x/repro.syz?id=5471683234234368
Raw console output: https://syzkaller.appspot.com/x/log.txt?id=5436660795834368
Kernel config: https://syzkaller.appspot.com/x/.config?id=1808800213120130118
compiler: gcc (GCC) 8.0.1 20180413 (experimental)

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for details.
If you forward the report, please keep this part and the footer.

F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): invalid crc value
[ cut here ]
kernel BUG at fs/f2fs/node.c:1185!
invalid opcode:  [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 4549 Comm: syzkaller704305 Not tainted 4.17.0-rc1+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
RIP: 0010:__get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185
RSP: 0018:8801d960e820 EFLAGS: 00010293
RAX: 8801d88205c0 RBX: 0003 RCX: 82f6cc06
RDX:  RSI: 82f6d5e8 RDI: 0004
RBP: 8801d960ec30 R08: 8801d88205c0 R09: ed003b5e46c2
R10: 0003 R11: 0003 R12: 8801a86e00c0
R13: 0001 R14: 8801a86e0530 R15: 8801d9745240
FS:  0072c880() GS:8801daf0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7f3d403209b8 CR3: 0001d8f3f000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 get_node_page fs/f2fs/node.c:1237 [inline]
 truncate_xattr_node+0x152/0x2e0 fs/f2fs/node.c:1014
 remove_inode_page+0x200/0xaf0 fs/f2fs/node.c:1039
 f2fs_evict_inode+0xe86/0x1710 fs/f2fs/inode.c:547
 evict+0x4a6/0x960 fs/inode.c:557
 iput_final fs/inode.c:1519 [inline]
 iput+0x62d/0xa80 fs/inode.c:1545
 f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
 mount_bdev+0x30c/0x3e0 fs/super.c:1164
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
 mount_fs+0xae/0x328 fs/super.c:1267
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443dea
RSP: 002b:7ffcc7882368 EFLAGS: 0297 ORIG_RAX: 00a5
RAX: ffda RBX: 2c00 RCX: 00443dea
RDX: 2000 RSI: 2100 RDI: 7ffcc7882370
RBP: 0003 R08: 20016a00 R09: 000a
R10:  R11: 0297 R12: 0004
R13: 00402ce0 R14:  R15: 
RIP: __get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185 RSP: 8801d960e820
---[ end trace 4edbeb71f002bb76 ]---

Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h  | 13 +
 fs/f2fs/inode.c |  6 +-
 fs/f2fs/node.c  | 23 +--
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 8f3ad9662d13..d26aae5bf00d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1583,18 +1583,6 @@ static inline bool __exist_node_summaries(struct 
f2fs_sb_info *sbi)
is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG));
 }
 
-/*
- * Check whether the given nid is within node id range.
- */
-static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
-{
-   if (unlikely(nid < F2FS_ROOT_INO(sbi)))
-   return -EINVAL;
-   if (unlikely(nid >= NM_I(sbi)->max_nid))
-   return -EINVAL;
-   return 0;
-}
-
 /*
  * Check whether the inode has blocks or not
  */
@@ -2768,6 +2756,7 @@ f2fs_hash_t 

Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Jaegeuk Kim
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev
>From 65b966f58e8264477da6c8b70703ce362cb1f8f0 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim 
Date: Mon, 23 Apr 2018 23:02:31 -0600
Subject: [PATCH] f2fs: give message and set need_fsck given broken node id

syzbot hit the following crash on upstream commit
83beed7b2b26f232d782127792dd0cd4362fdc41 (Fri Apr 20 17:56:32 2018 +)
Merge branch 'fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
syzbot dashboard link: 
https://syzkaller.appspot.com/bug?extid=d154ec99402c6f628887

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5414336294027264
syzkaller reproducer: 
https://syzkaller.appspot.com/x/repro.syz?id=5471683234234368
Raw console output: https://syzkaller.appspot.com/x/log.txt?id=5436660795834368
Kernel config: https://syzkaller.appspot.com/x/.config?id=1808800213120130118
compiler: gcc (GCC) 8.0.1 20180413 (experimental)

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for details.
If you forward the report, please keep this part and the footer.

F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): invalid crc value
[ cut here ]
kernel BUG at fs/f2fs/node.c:1185!
invalid opcode:  [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 4549 Comm: syzkaller704305 Not tainted 4.17.0-rc1+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
RIP: 0010:__get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185
RSP: 0018:8801d960e820 EFLAGS: 00010293
RAX: 8801d88205c0 RBX: 0003 RCX: 82f6cc06
RDX:  RSI: 82f6d5e8 RDI: 0004
RBP: 8801d960ec30 R08: 8801d88205c0 R09: ed003b5e46c2
R10: 0003 R11: 0003 R12: 8801a86e00c0
R13: 0001 R14: 8801a86e0530 R15: 8801d9745240
FS:  0072c880() GS:8801daf0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7f3d403209b8 CR3: 0001d8f3f000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 get_node_page fs/f2fs/node.c:1237 [inline]
 truncate_xattr_node+0x152/0x2e0 fs/f2fs/node.c:1014
 remove_inode_page+0x200/0xaf0 fs/f2fs/node.c:1039
 f2fs_evict_inode+0xe86/0x1710 fs/f2fs/inode.c:547
 evict+0x4a6/0x960 fs/inode.c:557
 iput_final fs/inode.c:1519 [inline]
 iput+0x62d/0xa80 fs/inode.c:1545
 f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
 mount_bdev+0x30c/0x3e0 fs/super.c:1164
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
 mount_fs+0xae/0x328 fs/super.c:1267
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443dea
RSP: 002b:7ffcc7882368 EFLAGS: 0297 ORIG_RAX: 00a5
RAX: ffda RBX: 2c00 RCX: 00443dea
RDX: 2000 RSI: 2100 RDI: 7ffcc7882370
RBP: 0003 R08: 20016a00 R09: 000a
R10:  R11: 0297 R12: 0004
R13: 00402ce0 R14:  R15: 
RIP: __get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185 RSP: 8801d960e820
---[ end trace 4edbeb71f002bb76 ]---

Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h  | 13 +
 fs/f2fs/inode.c |  6 +-
 fs/f2fs/node.c  | 23 +--
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 8f3ad9662d13..d26aae5bf00d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1583,18 +1583,6 @@ static inline bool __exist_node_summaries(struct 
f2fs_sb_info *sbi)
is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG));
 }
 
-/*
- * Check whether the given nid is within node id range.
- */
-static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
-{
-   if (unlikely(nid < F2FS_ROOT_INO(sbi)))
-   return -EINVAL;
-   if (unlikely(nid >= NM_I(sbi)->max_nid))
-   return -EINVAL;
-   return 0;
-}
-
 /*
  * Check whether the inode has blocks or not
  */
@@ -2768,6 +2756,7 @@ f2fs_hash_t f2fs_dentry_hash(const struct qstr 

Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread syzbot

Hello,

syzbot tried to test the proposed patch but build/boot failed:

patch is already applied


Tested on  
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev-test  
commit

65b966f58e8264477da6c8b70703ce362cb1f8f0 (Tue Apr 24 05:02:31 2018 +)
f2fs: give message and set need_fsck given broken node id

compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Patch: https://syzkaller.appspot.com/x/patch.diff?id=5525459446005760





Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread syzbot

Hello,

syzbot tried to test the proposed patch but build/boot failed:

patch is already applied


Tested on  
git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/dev-test  
commit

65b966f58e8264477da6c8b70703ce362cb1f8f0 (Tue Apr 24 05:02:31 2018 +)
f2fs: give message and set need_fsck given broken node id

compiler: gcc (GCC) 8.0.1 20180413 (experimental)
Patch: https://syzkaller.appspot.com/x/patch.diff?id=5525459446005760





Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Jaegeuk Kim
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git 
dev-test

>From 65b966f58e8264477da6c8b70703ce362cb1f8f0 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim 
Date: Mon, 23 Apr 2018 23:02:31 -0600
Subject: [PATCH] f2fs: give message and set need_fsck given broken node id

syzbot hit the following crash on upstream commit
83beed7b2b26f232d782127792dd0cd4362fdc41 (Fri Apr 20 17:56:32 2018 +)
Merge branch 'fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
syzbot dashboard link: 
https://syzkaller.appspot.com/bug?extid=d154ec99402c6f628887

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5414336294027264
syzkaller reproducer: 
https://syzkaller.appspot.com/x/repro.syz?id=5471683234234368
Raw console output: https://syzkaller.appspot.com/x/log.txt?id=5436660795834368
Kernel config: https://syzkaller.appspot.com/x/.config?id=1808800213120130118
compiler: gcc (GCC) 8.0.1 20180413 (experimental)

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for details.
If you forward the report, please keep this part and the footer.

F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): invalid crc value
[ cut here ]
kernel BUG at fs/f2fs/node.c:1185!
invalid opcode:  [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 4549 Comm: syzkaller704305 Not tainted 4.17.0-rc1+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
RIP: 0010:__get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185
RSP: 0018:8801d960e820 EFLAGS: 00010293
RAX: 8801d88205c0 RBX: 0003 RCX: 82f6cc06
RDX:  RSI: 82f6d5e8 RDI: 0004
RBP: 8801d960ec30 R08: 8801d88205c0 R09: ed003b5e46c2
R10: 0003 R11: 0003 R12: 8801a86e00c0
R13: 0001 R14: 8801a86e0530 R15: 8801d9745240
FS:  0072c880() GS:8801daf0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7f3d403209b8 CR3: 0001d8f3f000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 get_node_page fs/f2fs/node.c:1237 [inline]
 truncate_xattr_node+0x152/0x2e0 fs/f2fs/node.c:1014
 remove_inode_page+0x200/0xaf0 fs/f2fs/node.c:1039
 f2fs_evict_inode+0xe86/0x1710 fs/f2fs/inode.c:547
 evict+0x4a6/0x960 fs/inode.c:557
 iput_final fs/inode.c:1519 [inline]
 iput+0x62d/0xa80 fs/inode.c:1545
 f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
 mount_bdev+0x30c/0x3e0 fs/super.c:1164
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
 mount_fs+0xae/0x328 fs/super.c:1267
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443dea
RSP: 002b:7ffcc7882368 EFLAGS: 0297 ORIG_RAX: 00a5
RAX: ffda RBX: 2c00 RCX: 00443dea
RDX: 2000 RSI: 2100 RDI: 7ffcc7882370
RBP: 0003 R08: 20016a00 R09: 000a
R10:  R11: 0297 R12: 0004
R13: 00402ce0 R14:  R15: 
RIP: __get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185 RSP: 8801d960e820
---[ end trace 4edbeb71f002bb76 ]---

Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h  | 13 +
 fs/f2fs/inode.c |  6 +-
 fs/f2fs/node.c  | 23 +--
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 8f3ad9662d13..d26aae5bf00d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1583,18 +1583,6 @@ static inline bool __exist_node_summaries(struct 
f2fs_sb_info *sbi)
is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG));
 }
 
-/*
- * Check whether the given nid is within node id range.
- */
-static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
-{
-   if (unlikely(nid < F2FS_ROOT_INO(sbi)))
-   return -EINVAL;
-   if (unlikely(nid >= NM_I(sbi)->max_nid))
-   return -EINVAL;
-   return 0;
-}
-
 /*
  * Check whether the inode has blocks or not
  */
@@ -2768,6 +2756,7 @@ 

Re: kernel BUG at fs/f2fs/node.c:LINE!

2018-04-24 Thread Jaegeuk Kim
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git 
dev-test

>From 65b966f58e8264477da6c8b70703ce362cb1f8f0 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim 
Date: Mon, 23 Apr 2018 23:02:31 -0600
Subject: [PATCH] f2fs: give message and set need_fsck given broken node id

syzbot hit the following crash on upstream commit
83beed7b2b26f232d782127792dd0cd4362fdc41 (Fri Apr 20 17:56:32 2018 +)
Merge branch 'fixes' of 
git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
syzbot dashboard link: 
https://syzkaller.appspot.com/bug?extid=d154ec99402c6f628887

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5414336294027264
syzkaller reproducer: 
https://syzkaller.appspot.com/x/repro.syz?id=5471683234234368
Raw console output: https://syzkaller.appspot.com/x/log.txt?id=5436660795834368
Kernel config: https://syzkaller.appspot.com/x/.config?id=1808800213120130118
compiler: gcc (GCC) 8.0.1 20180413 (experimental)

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for details.
If you forward the report, please keep this part and the footer.

F2FS-fs (loop0): Magic Mismatch, valid(0xf2f52010) - read(0x0)
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): invalid crc value
[ cut here ]
kernel BUG at fs/f2fs/node.c:1185!
invalid opcode:  [#1] SMP KASAN
Dumping ftrace buffer:
   (ftrace buffer empty)
Modules linked in:
CPU: 1 PID: 4549 Comm: syzkaller704305 Not tainted 4.17.0-rc1+ #10
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
RIP: 0010:__get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185
RSP: 0018:8801d960e820 EFLAGS: 00010293
RAX: 8801d88205c0 RBX: 0003 RCX: 82f6cc06
RDX:  RSI: 82f6d5e8 RDI: 0004
RBP: 8801d960ec30 R08: 8801d88205c0 R09: ed003b5e46c2
R10: 0003 R11: 0003 R12: 8801a86e00c0
R13: 0001 R14: 8801a86e0530 R15: 8801d9745240
FS:  0072c880() GS:8801daf0() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7f3d403209b8 CR3: 0001d8f3f000 CR4: 001406e0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 get_node_page fs/f2fs/node.c:1237 [inline]
 truncate_xattr_node+0x152/0x2e0 fs/f2fs/node.c:1014
 remove_inode_page+0x200/0xaf0 fs/f2fs/node.c:1039
 f2fs_evict_inode+0xe86/0x1710 fs/f2fs/inode.c:547
 evict+0x4a6/0x960 fs/inode.c:557
 iput_final fs/inode.c:1519 [inline]
 iput+0x62d/0xa80 fs/inode.c:1545
 f2fs_fill_super+0x5f4e/0x7bf0 fs/f2fs/super.c:2849
 mount_bdev+0x30c/0x3e0 fs/super.c:1164
 f2fs_mount+0x34/0x40 fs/f2fs/super.c:3020
 mount_fs+0xae/0x328 fs/super.c:1267
 vfs_kern_mount.part.34+0xd4/0x4d0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:1027 [inline]
 do_new_mount fs/namespace.c:2518 [inline]
 do_mount+0x564/0x3070 fs/namespace.c:2848
 ksys_mount+0x12d/0x140 fs/namespace.c:3064
 __do_sys_mount fs/namespace.c:3078 [inline]
 __se_sys_mount fs/namespace.c:3075 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3075
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x443dea
RSP: 002b:7ffcc7882368 EFLAGS: 0297 ORIG_RAX: 00a5
RAX: ffda RBX: 2c00 RCX: 00443dea
RDX: 2000 RSI: 2100 RDI: 7ffcc7882370
RBP: 0003 R08: 20016a00 R09: 000a
R10:  R11: 0297 R12: 0004
R13: 00402ce0 R14:  R15: 
RIP: __get_node_page+0xb68/0x16e0 fs/f2fs/node.c:1185 RSP: 8801d960e820
---[ end trace 4edbeb71f002bb76 ]---

Reported-by: syzbot+d154ec99402c6f628...@syzkaller.appspotmail.com
Signed-off-by: Jaegeuk Kim 
---
 fs/f2fs/f2fs.h  | 13 +
 fs/f2fs/inode.c |  6 +-
 fs/f2fs/node.c  | 23 +--
 3 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 8f3ad9662d13..d26aae5bf00d 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1583,18 +1583,6 @@ static inline bool __exist_node_summaries(struct 
f2fs_sb_info *sbi)
is_set_ckpt_flags(sbi, CP_FASTBOOT_FLAG));
 }
 
-/*
- * Check whether the given nid is within node id range.
- */
-static inline int check_nid_range(struct f2fs_sb_info *sbi, nid_t nid)
-{
-   if (unlikely(nid < F2FS_ROOT_INO(sbi)))
-   return -EINVAL;
-   if (unlikely(nid >= NM_I(sbi)->max_nid))
-   return -EINVAL;
-   return 0;
-}
-
 /*
  * Check whether the inode has blocks or not
  */
@@ -2768,6 +2756,7 @@ f2fs_hash_t f2fs_dentry_hash(const struct qstr