linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs: fix shift-out-of-bounds of blkszbits
       [not found] <20210120013016.14071-1-hsiangkao.ref@aol.com>
@ 2021-01-20  1:30 ` Gao Xiang
  2021-02-10 13:05   ` Gao Xiang
  2021-02-11  1:15   ` Chao Yu
  0 siblings, 2 replies; 3+ messages in thread
From: Gao Xiang @ 2021-01-20  1:30 UTC (permalink / raw)
  To: linux-erofs
  Cc: Chao Yu, LKML, syzkaller-bugs, Gao Xiang, syzbot+c68f467cd7c45860e8d4

From: Gao Xiang <hsiangkao@redhat.com>

syzbot generated a crafted bitszbits which can be shifted
out-of-bounds[1]. So directly print unsupported blkszbits
instead of blksize.

[1] https://lore.kernel.org/r/000000000000c72ddd05b9444d2f@google.com
Reported-by: syzbot+c68f467cd7c45860e8d4@syzkaller.appspotmail.com
Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
 fs/erofs/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index be10b16ea66e..d5a6b9b888a5 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -158,8 +158,8 @@ static int erofs_read_superblock(struct super_block *sb)
 	blkszbits = dsb->blkszbits;
 	/* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */
 	if (blkszbits != LOG_BLOCK_SIZE) {
-		erofs_err(sb, "blksize %u isn't supported on this platform",
-			  1 << blkszbits);
+		erofs_err(sb, "blkszbits %u isn't supported on this platform",
+			  blkszbits);
 		goto out;
 	}
 
-- 
2.24.0


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

* Re: [PATCH] erofs: fix shift-out-of-bounds of blkszbits
  2021-01-20  1:30 ` [PATCH] erofs: fix shift-out-of-bounds of blkszbits Gao Xiang
@ 2021-02-10 13:05   ` Gao Xiang
  2021-02-11  1:15   ` Chao Yu
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2021-02-10 13:05 UTC (permalink / raw)
  To: Chao Yu, Chao Yu
  Cc: linux-erofs, LKML, syzkaller-bugs, syzbot+c68f467cd7c45860e8d4

Hi Chao,

On Wed, Jan 20, 2021 at 09:30:16AM +0800, Gao Xiang wrote:
> From: Gao Xiang <hsiangkao@redhat.com>
> 
> syzbot generated a crafted bitszbits which can be shifted
> out-of-bounds[1]. So directly print unsupported blkszbits
> instead of blksize.
> 
> [1] https://lore.kernel.org/r/000000000000c72ddd05b9444d2f@google.com
> Reported-by: syzbot+c68f467cd7c45860e8d4@syzkaller.appspotmail.com
> Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Could you kindly review this trivial syzaller patch as well? Since
"erofs: initialized fields can only be observed after bit is set"
is somewhat serious on some weak-memory-order designed platforms
(no idea why our hisilison ARM64 platform didn't observe it before.)
I intended to prepare this for 5.13 cycle directly with ongoing
multi pcluster / LZMA in-kernel decompresion. But that regression
seems a bit important to upstream for the next 5.12 cycle....

Thanks,
Gao Xiang

> ---
>  fs/erofs/super.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index be10b16ea66e..d5a6b9b888a5 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -158,8 +158,8 @@ static int erofs_read_superblock(struct super_block *sb)
>  	blkszbits = dsb->blkszbits;
>  	/* 9(512 bytes) + LOG_SECTORS_PER_BLOCK == LOG_BLOCK_SIZE */
>  	if (blkszbits != LOG_BLOCK_SIZE) {
> -		erofs_err(sb, "blksize %u isn't supported on this platform",
> -			  1 << blkszbits);
> +		erofs_err(sb, "blkszbits %u isn't supported on this platform",
> +			  blkszbits);
>  		goto out;
>  	}
>  
> -- 
> 2.24.0
> 


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

* Re: [PATCH] erofs: fix shift-out-of-bounds of blkszbits
  2021-01-20  1:30 ` [PATCH] erofs: fix shift-out-of-bounds of blkszbits Gao Xiang
  2021-02-10 13:05   ` Gao Xiang
@ 2021-02-11  1:15   ` Chao Yu
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2021-02-11  1:15 UTC (permalink / raw)
  To: Gao Xiang, linux-erofs; +Cc: syzkaller-bugs, LKML, syzbot+c68f467cd7c45860e8d4

On 2021/1/20 9:30, Gao Xiang via Linux-erofs wrote:
> From: Gao Xiang <hsiangkao@redhat.com>
> 
> syzbot generated a crafted bitszbits which can be shifted
> out-of-bounds[1]. So directly print unsupported blkszbits
> instead of blksize.
> 
> [1] https://lore.kernel.org/r/000000000000c72ddd05b9444d2f@google.com
> Reported-by: syzbot+c68f467cd7c45860e8d4@syzkaller.appspotmail.com
> Signed-off-by: Gao Xiang <hsiangkao@redhat.com>

Sorry, I missed this patch.

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

end of thread, other threads:[~2021-02-11  1:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210120013016.14071-1-hsiangkao.ref@aol.com>
2021-01-20  1:30 ` [PATCH] erofs: fix shift-out-of-bounds of blkszbits Gao Xiang
2021-02-10 13:05   ` Gao Xiang
2021-02-11  1:15   ` Chao Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).