All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] WARNING in erofs_iget
@ 2022-09-06  9:17 syzbot
  2022-09-09  2:39   ` Gao Xiang
  0 siblings, 1 reply; 5+ messages in thread
From: syzbot @ 2022-09-06  9:17 UTC (permalink / raw)
  To: akpm, linux-kernel, linux-mm, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    42cf58c272ee Merge tag 'tty-6.0-rc4' of git://git.kernel.o..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=16fd661b080000
kernel config:  https://syzkaller.appspot.com/x/.config?x=892a57667b7af6cf
dashboard link: https://syzkaller.appspot.com/bug?extid=f966c13b1b4fc0403b19
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=16fea393080000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1501b0c5080000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/0cddb4889822/disk-42cf58c2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/86b24f0bd2f9/vmlinux-42cf58c2.xz

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

loop0: detected capacity change from 0 to 4
Dev loop0: unable to read RDB block 4
 loop0: unable to read partition table
loop0: partition table beyond EOD, truncated
------------[ cut here ]------------
WARNING: CPU: 0 PID: 3611 at mm/page_alloc.c:5491 __alloc_pages+0x39e/0x510 mm/page_alloc.c:5491
Modules linked in:
CPU: 0 PID: 3611 Comm: syz-executor339 Not tainted 6.0.0-rc3-syzkaller-00328-g42cf58c272ee #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
RIP: 0010:__alloc_pages+0x39e/0x510 mm/page_alloc.c:5491
Code: ff ff 00 0f 84 33 fe ff ff 80 ce 01 e9 2b fe ff ff 83 fe 0a 0f 86 3e fd ff ff 80 3d 28 9c 0b 0c 00 75 09 c6 05 1f 9c 0b 0c 01 <0f> 0b 45 31 f6 e9 8d fe ff ff 65 ff 05 a1 76 44 7e 48 c7 c0 a0 21
RSP: 0018:ffffc9000396f8c0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 1ffff9200072df19 RCX: 0000000000000000
RDX: 0000000000000000 RSI: 0000000000000034 RDI: 0000000000000000
RBP: 0000000000040cc0 R08: 0000000000000007 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000055 R12: 0000000000000034
R13: 0000000000000000 R14: 0000000000000000 R15: 1ffff9200072df57
FS:  0000555556730300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffde3e9b000 CR3: 00000000732b1000 CR4: 0000000000350ef0
Call Trace:
 <TASK>
 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270
 kmalloc_order+0x34/0xf0 mm/slab_common.c:930
 kmalloc_order_trace+0x13/0x120 mm/slab_common.c:946
 kmalloc include/linux/slab.h:605 [inline]
 erofs_fill_symlink fs/erofs/inode.c:222 [inline]
 erofs_fill_inode fs/erofs/inode.c:273 [inline]
 erofs_iget+0x187c/0x26f0 fs/erofs/inode.c:351
 erofs_fc_fill_super+0x114b/0x21b0 fs/erofs/super.c:755
 get_tree_bdev+0x440/0x760 fs/super.c:1323
 vfs_get_tree+0x89/0x2f0 fs/super.c:1530
 do_new_mount fs/namespace.c:3040 [inline]
 path_mount+0x1326/0x1e20 fs/namespace.c:3370
 do_mount fs/namespace.c:3383 [inline]
 __do_sys_mount fs/namespace.c:3591 [inline]
 __se_sys_mount fs/namespace.c:3568 [inline]
 __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
 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+0x63/0xcd
RIP: 0033:0x7fee22a3317a
Code: 83 c4 08 5b 5d c3 66 2e 0f 1f 84 00 00 00 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 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:00007ffde3e9a378 EFLAGS: 00000286 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffde3e9a3d0 RCX: 00007fee22a3317a
RDX: 0000000020000000 RSI: 0000000020000040 RDI: 00007ffde3e9a390
RBP: 00007ffde3e9a390 R08: 00007ffde3e9a3d0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000286 R12: 0000000020000230
R13: 0000000000000003 R14: 0000000000000004 R15: 0000000000000002
 </TASK>


---
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] 5+ messages in thread

* [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size
  2022-09-06  9:17 [syzbot] WARNING in erofs_iget syzbot
@ 2022-09-09  2:39   ` Gao Xiang
  0 siblings, 0 replies; 5+ messages in thread
From: Gao Xiang @ 2022-09-09  2:39 UTC (permalink / raw)
  To: linux-erofs; +Cc: LKML, syzkaller-bugs, Gao Xiang, syzbot+f966c13b1b4fc0403b19

As syzbot reported [1], the root cause is that i_size field is a
signed type, and negative i_size is also less than EROFS_BLKSIZ.
As a consequence, it's handled as fast symlink unexpectedly.

Let's fall back to the generic path to deal with such unusual i_size.

[1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com
Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com
Fixes: 431339ba9042 ("staging: erofs: add inode operations")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 95a403720e8c..16cf9a283557 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr,
 
 	/* if it cannot be handled with fast symlink scheme */
 	if (vi->datalayout != EROFS_INODE_FLAT_INLINE ||
-	    inode->i_size >= EROFS_BLKSIZ) {
+	    inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) {
 		inode->i_op = &erofs_symlink_iops;
 		return 0;
 	}
-- 
2.24.4


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

* [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size
@ 2022-09-09  2:39   ` Gao Xiang
  0 siblings, 0 replies; 5+ messages in thread
From: Gao Xiang @ 2022-09-09  2:39 UTC (permalink / raw)
  To: linux-erofs; +Cc: Gao Xiang, syzbot+f966c13b1b4fc0403b19, syzkaller-bugs, LKML

As syzbot reported [1], the root cause is that i_size field is a
signed type, and negative i_size is also less than EROFS_BLKSIZ.
As a consequence, it's handled as fast symlink unexpectedly.

Let's fall back to the generic path to deal with such unusual i_size.

[1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com
Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com
Fixes: 431339ba9042 ("staging: erofs: add inode operations")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
 fs/erofs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 95a403720e8c..16cf9a283557 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr,
 
 	/* if it cannot be handled with fast symlink scheme */
 	if (vi->datalayout != EROFS_INODE_FLAT_INLINE ||
-	    inode->i_size >= EROFS_BLKSIZ) {
+	    inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) {
 		inode->i_op = &erofs_symlink_iops;
 		return 0;
 	}
-- 
2.24.4


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

* Re: [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size
  2022-09-09  2:39   ` Gao Xiang
@ 2022-09-19  1:37     ` Yue Hu
  -1 siblings, 0 replies; 5+ messages in thread
From: Yue Hu @ 2022-09-19  1:37 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs, syzbot+f966c13b1b4fc0403b19, syzkaller-bugs, LKML

On Fri,  9 Sep 2022 10:39:48 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:

> As syzbot reported [1], the root cause is that i_size field is a
> signed type, and negative i_size is also less than EROFS_BLKSIZ.
> As a consequence, it's handled as fast symlink unexpectedly.
> 
> Let's fall back to the generic path to deal with such unusual i_size.
> 
> [1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com
> Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com
> Fixes: 431339ba9042 ("staging: erofs: add inode operations")
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
>  fs/erofs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index 95a403720e8c..16cf9a283557 100644
> --- a/fs/erofs/inode.c
> +++ b/fs/erofs/inode.c
> @@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr,
>  
>  	/* if it cannot be handled with fast symlink scheme */
>  	if (vi->datalayout != EROFS_INODE_FLAT_INLINE ||
> -	    inode->i_size >= EROFS_BLKSIZ) {
> +	    inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) {

Reviewed-by: Yue Hu <huyue2@coolpad.com>

>  		inode->i_op = &erofs_symlink_iops;
>  		return 0;
>  	}


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

* Re: [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size
@ 2022-09-19  1:37     ` Yue Hu
  0 siblings, 0 replies; 5+ messages in thread
From: Yue Hu @ 2022-09-19  1:37 UTC (permalink / raw)
  To: Gao Xiang; +Cc: syzkaller-bugs, syzbot+f966c13b1b4fc0403b19, linux-erofs, LKML

On Fri,  9 Sep 2022 10:39:48 +0800
Gao Xiang <hsiangkao@linux.alibaba.com> wrote:

> As syzbot reported [1], the root cause is that i_size field is a
> signed type, and negative i_size is also less than EROFS_BLKSIZ.
> As a consequence, it's handled as fast symlink unexpectedly.
> 
> Let's fall back to the generic path to deal with such unusual i_size.
> 
> [1] https://lore.kernel.org/r/000000000000ac8efa05e7feaa1f@google.com
> Reported-by: syzbot+f966c13b1b4fc0403b19@syzkaller.appspotmail.com
> Fixes: 431339ba9042 ("staging: erofs: add inode operations")
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
> ---
>  fs/erofs/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
> index 95a403720e8c..16cf9a283557 100644
> --- a/fs/erofs/inode.c
> +++ b/fs/erofs/inode.c
> @@ -214,7 +214,7 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr,
>  
>  	/* if it cannot be handled with fast symlink scheme */
>  	if (vi->datalayout != EROFS_INODE_FLAT_INLINE ||
> -	    inode->i_size >= EROFS_BLKSIZ) {
> +	    inode->i_size >= EROFS_BLKSIZ || inode->i_size < 0) {

Reviewed-by: Yue Hu <huyue2@coolpad.com>

>  		inode->i_op = &erofs_symlink_iops;
>  		return 0;
>  	}


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

end of thread, other threads:[~2022-09-19  1:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-06  9:17 [syzbot] WARNING in erofs_iget syzbot
2022-09-09  2:39 ` [PATCH] erofs: fix order >= MAX_ORDER warning due to crafted nagative i_size Gao Xiang
2022-09-09  2:39   ` Gao Xiang
2022-09-19  1:37   ` Yue Hu
2022-09-19  1:37     ` Yue Hu

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.