diff mbox series

generic/735: improve test by incorporating extra hints

Message ID 20240319111613.11029-1-disgoel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series generic/735: improve test by incorporating extra hints | expand

Commit Message

Disha Goel March 19, 2024, 11:16 a.m. UTC
On power systems with 64k block size (where default page size is 64k) we
encountered a kernel oops due to an integer overflow issue when writing
near the last logical block of a file. The allocator could allocate a
range where the end exceeds the maximum supported logical block
(UINT32_MAX), leading to a subsequent BUG_ON. This issue has been
addressed in the upstream kernel with commit 2dcf5fde6dff
("ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS").

	==================================================
	kernel BUG at fs/ext4/mballoc.c:4448!
	Oops: Exception in kernel mode, sig: 5 [#1]
	CPU: 8 PID: 2880554 Comm: xfs_io
	NIP ext4_mb_use_inode_pa+0x110/0x160 [ext4]
	LR ext4_mb_use_inode_pa+0xac/0x160 [ext4]
	Call Trace:
		ext4_mb_new_inode_pa+0x134/0x3a0 [ext4]
		ext4_mb_try_best_found+0x158/0x280 [ext4]
		ext4_mb_regular_allocator+0x16c/0x940 [ext4]
		ext4_mb_new_blocks+0x610/0x960 [ext4]
		ext4_ext_map_blocks+0x858/0xa90 [ext4]
		ext4_map_blocks+0x218/0x800 [ext4]
		ext4_iomap_alloc+0x10c/0x260 [ext4]
		ext4_iomap_begin+0xfc/0x1f0 [ext4]
		iomap_iter+0xf0/0x190
		__iomap_dio_rw+0x208/0x690
		iomap_dio_rw+0x20/0x80
		ext4_dio_write_iter+0x210/0x4d0 [ext4]
		vfs_write+0x364/0x4e0
		sys_pwrite64+0xd4/0x120
		system_call_exception+0x164/0x310
		system_call_vectored_common+0xe8/0x278
	==================================================

This test has been extended to provide a hint about the relevant fix
in case of failure.

Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
 tests/generic/735 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Disha Goel March 29, 2024, 5:52 a.m. UTC | #1
On 19/03/24 4:46 pm, Disha Goel wrote:

> On power systems with 64k block size (where default page size is 64k) we
> encountered a kernel oops due to an integer overflow issue when writing
> near the last logical block of a file. The allocator could allocate a
> range where the end exceeds the maximum supported logical block
> (UINT32_MAX), leading to a subsequent BUG_ON. This issue has been
> addressed in the upstream kernel with commit 2dcf5fde6dff
> ("ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS").
>
> 	==================================================
> 	kernel BUG at fs/ext4/mballoc.c:4448!
> 	Oops: Exception in kernel mode, sig: 5 [#1]
> 	CPU: 8 PID: 2880554 Comm: xfs_io
> 	NIP ext4_mb_use_inode_pa+0x110/0x160 [ext4]
> 	LR ext4_mb_use_inode_pa+0xac/0x160 [ext4]
> 	Call Trace:
> 		ext4_mb_new_inode_pa+0x134/0x3a0 [ext4]
> 		ext4_mb_try_best_found+0x158/0x280 [ext4]
> 		ext4_mb_regular_allocator+0x16c/0x940 [ext4]
> 		ext4_mb_new_blocks+0x610/0x960 [ext4]
> 		ext4_ext_map_blocks+0x858/0xa90 [ext4]
> 		ext4_map_blocks+0x218/0x800 [ext4]
> 		ext4_iomap_alloc+0x10c/0x260 [ext4]
> 		ext4_iomap_begin+0xfc/0x1f0 [ext4]
> 		iomap_iter+0xf0/0x190
> 		__iomap_dio_rw+0x208/0x690
> 		iomap_dio_rw+0x20/0x80
> 		ext4_dio_write_iter+0x210/0x4d0 [ext4]
> 		vfs_write+0x364/0x4e0
> 		sys_pwrite64+0xd4/0x120
> 		system_call_exception+0x164/0x310
> 		system_call_vectored_common+0xe8/0x278
> 	==================================================
>
> This test has been extended to provide a hint about the relevant fix
> in case of failure.
>
> Signed-off-by: Disha Goel<disgoel@linux.ibm.com>
> ---

Hi All,

Looking for review comments on this patch.

Thanks
Disha

>   tests/generic/735 | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/tests/generic/735 b/tests/generic/735
> index 75b23d5e..0ba111a6 100755
> --- a/tests/generic/735
> +++ b/tests/generic/735
> @@ -6,16 +6,19 @@
>   #
>   # Append writes to a file with logical block numbers close to 0xffffffff
>   # and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> -# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> -# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> -#
> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for
> +# commit bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> +# commit 2dcf5fde6dff ("ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS")
> +
>   . ./common/preamble
>   . ./common/populate
>   _begin_fstest auto quick insert prealloc
>   
>   # real QA test starts here
> -[[ "$FSTYP" =~ ext[0-9]+ ]] && _fixed_by_kernel_commit bc056e7163ac \
> -	"ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +if [[ "$FSTYP" =~ ext[0-9]+ ]]; then
> +	_fixed_by_kernel_commit bc056e7163ac "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +	_fixed_by_kernel_commit 2dcf5fde6dff "ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS"
> +fi
>   
>   _require_odirect
>   _require_xfs_io_command "falloc"
Zorro Lang March 30, 2024, 6:54 a.m. UTC | #2
On Tue, Mar 19, 2024 at 04:46:13PM +0530, Disha Goel wrote:
> On power systems with 64k block size (where default page size is 64k) we
> encountered a kernel oops due to an integer overflow issue when writing
> near the last logical block of a file. The allocator could allocate a
> range where the end exceeds the maximum supported logical block
> (UINT32_MAX), leading to a subsequent BUG_ON. This issue has been
> addressed in the upstream kernel with commit 2dcf5fde6dff
> ("ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS").
> 
> 	==================================================
> 	kernel BUG at fs/ext4/mballoc.c:4448!
> 	Oops: Exception in kernel mode, sig: 5 [#1]
> 	CPU: 8 PID: 2880554 Comm: xfs_io
> 	NIP ext4_mb_use_inode_pa+0x110/0x160 [ext4]
> 	LR ext4_mb_use_inode_pa+0xac/0x160 [ext4]
> 	Call Trace:
> 		ext4_mb_new_inode_pa+0x134/0x3a0 [ext4]
> 		ext4_mb_try_best_found+0x158/0x280 [ext4]
> 		ext4_mb_regular_allocator+0x16c/0x940 [ext4]
> 		ext4_mb_new_blocks+0x610/0x960 [ext4]
> 		ext4_ext_map_blocks+0x858/0xa90 [ext4]
> 		ext4_map_blocks+0x218/0x800 [ext4]
> 		ext4_iomap_alloc+0x10c/0x260 [ext4]
> 		ext4_iomap_begin+0xfc/0x1f0 [ext4]
> 		iomap_iter+0xf0/0x190
> 		__iomap_dio_rw+0x208/0x690
> 		iomap_dio_rw+0x20/0x80
> 		ext4_dio_write_iter+0x210/0x4d0 [ext4]
> 		vfs_write+0x364/0x4e0
> 		sys_pwrite64+0xd4/0x120
> 		system_call_exception+0x164/0x310
> 		system_call_vectored_common+0xe8/0x278
> 	==================================================
> 
> This test has been extended to provide a hint about the relevant fix
> in case of failure.
> 
> Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
> ---

Looks good to me, will merge it if no more review points from ext4 list.

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/generic/735 | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/generic/735 b/tests/generic/735
> index 75b23d5e..0ba111a6 100755
> --- a/tests/generic/735
> +++ b/tests/generic/735
> @@ -6,16 +6,19 @@
>  #
>  # Append writes to a file with logical block numbers close to 0xffffffff
>  # and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
> -# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
> -# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> -#
> +# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for
> +# commit bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
> +# commit 2dcf5fde6dff ("ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS")
> +
>  . ./common/preamble
>  . ./common/populate
>  _begin_fstest auto quick insert prealloc
>  
>  # real QA test starts here
> -[[ "$FSTYP" =~ ext[0-9]+ ]] && _fixed_by_kernel_commit bc056e7163ac \
> -	"ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +if [[ "$FSTYP" =~ ext[0-9]+ ]]; then
> +	_fixed_by_kernel_commit bc056e7163ac "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
> +	_fixed_by_kernel_commit 2dcf5fde6dff "ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS"
> +fi
>  
>  _require_odirect
>  _require_xfs_io_command "falloc"
> -- 
> 2.39.1
> 
>
diff mbox series

Patch

diff --git a/tests/generic/735 b/tests/generic/735
index 75b23d5e..0ba111a6 100755
--- a/tests/generic/735
+++ b/tests/generic/735
@@ -6,16 +6,19 @@ 
 #
 # Append writes to a file with logical block numbers close to 0xffffffff
 # and observe if a kernel crash is caused by ext4_lblk_t overflow triggering
-# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for commit
-# bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
-#
+# BUG_ON at ext4_mb_new_inode_pa(). This is a regression test for
+# commit bc056e7163ac ("ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow")
+# commit 2dcf5fde6dff ("ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS")
+
 . ./common/preamble
 . ./common/populate
 _begin_fstest auto quick insert prealloc
 
 # real QA test starts here
-[[ "$FSTYP" =~ ext[0-9]+ ]] && _fixed_by_kernel_commit bc056e7163ac \
-	"ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
+if [[ "$FSTYP" =~ ext[0-9]+ ]]; then
+	_fixed_by_kernel_commit bc056e7163ac "ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow"
+	_fixed_by_kernel_commit 2dcf5fde6dff "ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS"
+fi
 
 _require_odirect
 _require_xfs_io_command "falloc"