Re: [PATCH V2 blktests] block: add regression test for null-blk concurrently power/submit_queues test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jun 04, 2024 / 21:05, Yi Zhang wrote:
> null-blk currently power/submit_queues operations which will lead kernel
> null-ptr-dereference[1], add one regression test for it and the fix has
> been merged to v6.10-rc1 by [2].
> [1]
> https://lore.kernel.org/linux-block/CAHj4cs9LgsHLnjg8z06LQ3Pr5cax-+Ps+xT7AP7TPnEjStuwZA@xxxxxxxxxxxxxx/
> https://lore.kernel.org/linux-block/20240523153934.1937851-1-yukuai1@xxxxxxxxxxxxxxx/
> [2]
> commit a2db328b0839 ("null_blk: fix null-ptr-dereference while configuring 'power' and 'submit_queues'")

Thank you Yi. I ran the test case and it looks working good. It passes with
the kernel v6.10-rc2. It causes the hang with the kernel v6.9. To not confuse
blktests users with the hang, I will wait for the commit a2db328b0839 to land on
the stable kernels before I apply this patch.

One more thing I noticed is that your current patch requires loadable null_blk.
To allow it run with built-in null_blk, I would like to suggest additional
change below on top of your patch. It,

- calls _have_null_blk instead of _have_module null_blk,
- checks submit_queues parameter with _have_null_blk_feature instead of
  _have_module_param,
- does not call _init_null_blk, and
- uses nullb1 instead for nullb0.

Please let me know your thought about these changes. If you are ok with them, I
can fold them in the commit.

diff --git a/tests/block/038 b/tests/block/038
index fe3c7cd..56272be 100755
--- a/tests/block/038
+++ b/tests/block/038
@@ -12,9 +12,10 @@ DESCRIPTION="Test null-blk concurrent power/submit_queues operations"
 QUICK=1
 
 requires() {
-	_have_module null_blk
-	_have_module_param null_blk nr_devices
-	_have_module_param null_blk submit_queues
+	_have_null_blk
+	if ! _have_null_blk_feature submit_queues; then
+		SKIP_REASONS+=("null_blk does not support submit_queues")
+	fi
 }
 
 null_blk_power_loop() {
@@ -36,23 +37,15 @@ null_blk_submit_queues_loop() {
 test() {
 	echo "Running ${TEST_NAME}"
 
-	local nullb_params=(
-		nr_devices=0
-	)
-	if ! _init_null_blk "${nullb_params[@]}"; then
-		echo "Loading null_blk failed"
-		return 1
-	fi
-
-	if ! _configure_null_blk nullb0; then
-		echo "Configuring null_blk nullb0 failed"
+	if ! _configure_null_blk nullb1; then
+		echo "Configuring null_blk nullb1 failed"
 		return 1
 	fi
 
 	# fire off two null-blk power/submit_queues concurrently and wait
 	# for them to complete...
-	null_blk_power_loop nullb0 &
-	null_blk_submit_queues_loop nullb0 &
+	null_blk_power_loop nullb1 &
+	null_blk_submit_queues_loop nullb1 &
 	wait
 
 	_exit_null_blk





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux