diff mbox series

[net-next] selftests/tc-testing: replace mq with invalid parent ID

Message ID 20230531072511.6927-1-shaozhengchao@huawei.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] selftests/tc-testing: replace mq with invalid parent ID | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 29 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shaozhengchao May 31, 2023, 7:25 a.m. UTC
The test case shown in [1] triggers the kernel to access the null pointer.
Therefore, add related test cases to mq.
The test results are as follows:

./tdc.py -e 0531
1..1
ok 1 0531 - Replace mq with invalid parent ID

./tdc.py -c mq
1..8
ok 1 ce7d - Add mq Qdisc to multi-queue device (4 queues)
ok 2 2f82 - Add mq Qdisc to multi-queue device (256 queues)
ok 3 c525 - Add duplicate mq Qdisc
ok 4 128a - Delete nonexistent mq Qdisc
ok 5 03a9 - Delete mq Qdisc twice
ok 6 be0f - Add mq Qdisc to single-queue device
ok 7 1023 - Show mq class
ok 8 0531 - Replace mq with invalid parent ID

[1] https://lore.kernel.org/all/20230527093747.3583502-1-shaozhengchao@huawei.com/
Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
---
 .../tc-testing/tc-tests/qdiscs/mq.json        | 25 ++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

Comments

Pedro Tammela May 31, 2023, 1:52 p.m. UTC | #1
On 31/05/2023 04:25, Zhengchao Shao wrote:
> The test case shown in [1] triggers the kernel to access the null pointer.
> Therefore, add related test cases to mq.
> The test results are as follows:
> 
> ./tdc.py -e 0531
> 1..1
> ok 1 0531 - Replace mq with invalid parent ID
> 
> ./tdc.py -c mq
> 1..8
> ok 1 ce7d - Add mq Qdisc to multi-queue device (4 queues)
> ok 2 2f82 - Add mq Qdisc to multi-queue device (256 queues)
> ok 3 c525 - Add duplicate mq Qdisc
> ok 4 128a - Delete nonexistent mq Qdisc
> ok 5 03a9 - Delete mq Qdisc twice
> ok 6 be0f - Add mq Qdisc to single-queue device
> ok 7 1023 - Show mq class
> ok 8 0531 - Replace mq with invalid parent ID
> 
> [1] https://lore.kernel.org/all/20230527093747.3583502-1-shaozhengchao@huawei.com/
> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
> ---
>   .../tc-testing/tc-tests/qdiscs/mq.json        | 25 ++++++++++++++++++-
>   1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
> index 44fbfc6caec7..ddd4a48bfe65 100644
> --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
> @@ -155,5 +155,28 @@
>               "teardown": [
>                   "echo \"1\" > /sys/bus/netdevsim/del_device"
>               ]
> -        }
> +	},
> +	{
> +		"id": "0531",
> +		"name": "Replace mq with invalid parent ID",
> +		"category": [
> +			"qdisc",
> +			"mq"
> +		],
> +		"plugins": {
> +			"requires": "nsPlugin"
> +		},
> +		"setup": [
> +			"echo \"1 1 16\" > /sys/bus/netdevsim/new_device",
> +			"$TC qdisc add dev $ETH root handle ffff: mq"
> +		],
> +		"cmdUnderTest": "$TC qdisc replace dev $ETH parent ffff:fff1 handle ffff: mq",
> +		"expExitCode": "2",
> +		"verifyCmd": "$TC qdisc show dev $ETH",
> +		"matchPattern": "qdisc fq_codel 0: parent ffff",

The default qdisc could be pfifo_fast or some other qdisc depending on 
the config file
Perhaps it's better to match against:
"qdisc [a-zA-Z0-9_]+ 0: parent ffff"

> +		"matchCount": "16",
> +		"teardown": [
> +			"echo \"1\" > /sys/bus/netdevsim/del_device"
> +		]
> +	}
>   ]
shaozhengchao June 1, 2023, 12:45 a.m. UTC | #2
On 2023/5/31 21:52, Pedro Tammela wrote:
> On 31/05/2023 04:25, Zhengchao Shao wrote:
>> The test case shown in [1] triggers the kernel to access the null 
>> pointer.
>> Therefore, add related test cases to mq.
>> The test results are as follows:
>>
>> ./tdc.py -e 0531
>> 1..1
>> ok 1 0531 - Replace mq with invalid parent ID
>>
>> ./tdc.py -c mq
>> 1..8
>> ok 1 ce7d - Add mq Qdisc to multi-queue device (4 queues)
>> ok 2 2f82 - Add mq Qdisc to multi-queue device (256 queues)
>> ok 3 c525 - Add duplicate mq Qdisc
>> ok 4 128a - Delete nonexistent mq Qdisc
>> ok 5 03a9 - Delete mq Qdisc twice
>> ok 6 be0f - Add mq Qdisc to single-queue device
>> ok 7 1023 - Show mq class
>> ok 8 0531 - Replace mq with invalid parent ID
>>
>> [1] 
>> https://lore.kernel.org/all/20230527093747.3583502-1-shaozhengchao@huawei.com/
>> Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com>
>> ---
>>   .../tc-testing/tc-tests/qdiscs/mq.json        | 25 ++++++++++++++++++-
>>   1 file changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git 
>> a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json 
>> b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
>> index 44fbfc6caec7..ddd4a48bfe65 100644
>> --- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
>> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
>> @@ -155,5 +155,28 @@
>>               "teardown": [
>>                   "echo \"1\" > /sys/bus/netdevsim/del_device"
>>               ]
>> -        }
>> +    },
>> +    {
>> +        "id": "0531",
>> +        "name": "Replace mq with invalid parent ID",
>> +        "category": [
>> +            "qdisc",
>> +            "mq"
>> +        ],
>> +        "plugins": {
>> +            "requires": "nsPlugin"
>> +        },
>> +        "setup": [
>> +            "echo \"1 1 16\" > /sys/bus/netdevsim/new_device",
>> +            "$TC qdisc add dev $ETH root handle ffff: mq"
>> +        ],
>> +        "cmdUnderTest": "$TC qdisc replace dev $ETH parent ffff:fff1 
>> handle ffff: mq",
>> +        "expExitCode": "2",
>> +        "verifyCmd": "$TC qdisc show dev $ETH",
>> +        "matchPattern": "qdisc fq_codel 0: parent ffff",
> 
> The default qdisc could be pfifo_fast or some other qdisc depending on 
> the config file
> Perhaps it's better to match against:
> "qdisc [a-zA-Z0-9_]+ 0: parent ffff"
> 
Hi Pedro:
	You are right here.I will send V2. Thank you.

Zhengchao Shao
	
>> +        "matchCount": "16",
>> +        "teardown": [
>> +            "echo \"1\" > /sys/bus/netdevsim/del_device"
>> +        ]
>> +    }
>>   ]
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
index 44fbfc6caec7..ddd4a48bfe65 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/mq.json
@@ -155,5 +155,28 @@ 
             "teardown": [
                 "echo \"1\" > /sys/bus/netdevsim/del_device"
             ]
-        }
+	},
+	{
+		"id": "0531",
+		"name": "Replace mq with invalid parent ID",
+		"category": [
+			"qdisc",
+			"mq"
+		],
+		"plugins": {
+			"requires": "nsPlugin"
+		},
+		"setup": [
+			"echo \"1 1 16\" > /sys/bus/netdevsim/new_device",
+			"$TC qdisc add dev $ETH root handle ffff: mq"
+		],
+		"cmdUnderTest": "$TC qdisc replace dev $ETH parent ffff:fff1 handle ffff: mq",
+		"expExitCode": "2",
+		"verifyCmd": "$TC qdisc show dev $ETH",
+		"matchPattern": "qdisc fq_codel 0: parent ffff",
+		"matchCount": "16",
+		"teardown": [
+			"echo \"1\" > /sys/bus/netdevsim/del_device"
+		]
+	}
 ]