public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] network/tc01.sh: Add a regression test for tc qdisc command
@ 2021-07-07  9:22 Yang Xu
  2021-07-07 14:03 ` Alexey Kodanev
  0 siblings, 1 reply; 11+ messages in thread
From: Yang Xu @ 2021-07-07  9:22 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 runtest/net.tcp_cmds                   |  1 +
 testcases/network/tcp_cmds/tc/Makefile | 13 +++++++
 testcases/network/tcp_cmds/tc/tc01.sh  | 51 ++++++++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 testcases/network/tcp_cmds/tc/Makefile
 create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh

diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index db47dfd5b..7e142de11 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -12,6 +12,7 @@ netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
 sendfile sendfile01.sh
+tc01 tc01.sh
 tcpdump tcpdump01.sh
 telnet telnet01.sh
 iptables iptables01.sh
diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
new file mode 100644
index 000000000..60150a1ce
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/Makefile
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= tc01.sh
+
+MAKE_TARGETS		:=
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
new file mode 100755
index 000000000..0a241843b
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/tc01.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
+# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
+#
+# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
+# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
+# because both devices are teql0, and it does not set qdisc_priv(sch)->m
+# leaving it zero on error path, then qdisc_create() imediately calls
+# teql_destroy() which does not expect zero master pointer and we get OOPS
+# on unpatched kernel.
+#
+# If we enable panic_on_oops, this case may crash.
+#
+# This kernel bug was introduced by
+# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
+# and has been fixed by
+# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
+#
+
+TST_TESTFUNC="do_test"
+TST_NEEDS_ROOT=1
+TST_NEEDS_DRIVERS="sch_teql"
+TST_NEEDS_CMDS="tc modprobe"
+sys_file="/proc/sys/kernel/panic_on_oops"
+. tst_test.sh
+
+do_test()
+{
+	[ ! -f "$sys_file" ] && tst_brk TCONF "$sys_file not enabled"
+	orig_value=$(cat "$sys_file")
+	if [ $orig_value = "0" ]; then
+		echo 1 > $sys_file
+	fi
+
+	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
+	modprobe $TST_NEEDS_DRIVERS
+
+	tc qdisc add dev teql0 root teql0 2>/dev/null
+	if [ $? -eq 0 ]; then
+		tst_res TFAIL "tc qdisc command succeeded unexpectedly"
+	else
+		tst_res TPASS "the bug was not reproduced"
+	fi
+
+	if [ $orig_value = "0" ]; then
+		 echo 0 > $sys_file
+	fi
+}
+
+tst_run
-- 
2.23.0


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

* [LTP] [PATCH] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-07  9:22 [LTP] [PATCH] network/tc01.sh: Add a regression test for tc qdisc command Yang Xu
@ 2021-07-07 14:03 ` Alexey Kodanev
  2021-07-08  6:22   ` xuyang2018.jy
  2021-07-08  8:42   ` [LTP] [PATCH v2] " Yang Xu
  0 siblings, 2 replies; 11+ messages in thread
From: Alexey Kodanev @ 2021-07-07 14:03 UTC (permalink / raw)
  To: ltp

Hi!
On 07.07.2021 12:22, Yang Xu wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  runtest/net.tcp_cmds                   |  1 +
>  testcases/network/tcp_cmds/tc/Makefile | 13 +++++++
>  testcases/network/tcp_cmds/tc/tc01.sh  | 51 ++++++++++++++++++++++++++
>  3 files changed, 65 insertions(+)
>  create mode 100644 testcases/network/tcp_cmds/tc/Makefile
>  create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh
> 
> diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
> index db47dfd5b..7e142de11 100644
> --- a/runtest/net.tcp_cmds
> +++ b/runtest/net.tcp_cmds
> @@ -12,6 +12,7 @@ netstat netstat01.sh
>  ping01 ping01.sh
>  ping02 ping02.sh
>  sendfile sendfile01.sh
> +tc01 tc01.sh
>  tcpdump tcpdump01.sh
>  telnet telnet01.sh
>  iptables iptables01.sh
> diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
> new file mode 100644
> index 000000000..60150a1ce
> --- /dev/null
> +++ b/testcases/network/tcp_cmds/tc/Makefile
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (C) 2009, Cisco Systems Inc.
> +# Ngie Cooper, July 2009
> +
> +top_srcdir		?= ../../../..
> +
> +include $(top_srcdir)/include/mk/env_pre.mk
> +
> +INSTALL_TARGETS		:= tc01.sh
> +
> +MAKE_TARGETS		:=
> +
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
> new file mode 100755
> index 000000000..0a241843b
> --- /dev/null
> +++ b/testcases/network/tcp_cmds/tc/tc01.sh
> @@ -0,0 +1,51 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
> +# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
> +#
> +# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
> +# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
> +# because both devices are teql0, and it does not set qdisc_priv(sch)->m
> +# leaving it zero on error path, then qdisc_create() imediately calls
> +# teql_destroy() which does not expect zero master pointer and we get OOPS
> +# on unpatched kernel.
> +#
> +# If we enable panic_on_oops, this case may crash.
> +#
> +# This kernel bug was introduced by
> +# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
> +# and has been fixed by
> +# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
> +#
> +
> +TST_TESTFUNC="do_test"
> +TST_NEEDS_ROOT=1
> +TST_NEEDS_DRIVERS="sch_teql"
> +TST_NEEDS_CMDS="tc modprobe"
> +sys_file="/proc/sys/kernel/panic_on_oops"
> +. tst_test.sh
> +
> +do_test()
> +{
> +	[ ! -f "$sys_file" ] && tst_brk TCONF "$sys_file not enabled"

Why this check is needed and also setting panic_on_oops to
trigger the bug? If not, I would suggest to remove them from
the test.

> +	orig_value=$(cat "$sys_file")
> +	if [ $orig_value = "0" ]; then
> +		echo 1 > $sys_file
> +	fi
> +
> +	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
> +	modprobe $TST_NEEDS_DRIVERS

setup()
{
	ROD modprobe $TST_NEEDS_DRIVERS
}

> +
> +	tc qdisc add dev teql0 root teql0 2>/dev/null

TST_EXP_FAIL tc qdisc add dev teql0 root teql0

> +	if [ $? -eq 0 ]; then
> +		tst_res TFAIL "tc qdisc command succeeded unexpectedly"
> +	else
> +		tst_res TPASS "the bug was not reproduced"
> +	fi
> +
> +	if [ $orig_value = "0" ]; then
> +		 echo 0 > $sys_file
> +	fi
> +}
> +
> +tst_run
>

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

* [LTP] [PATCH] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-07 14:03 ` Alexey Kodanev
@ 2021-07-08  6:22   ` xuyang2018.jy
  2021-07-08  8:42   ` [LTP] [PATCH v2] " Yang Xu
  1 sibling, 0 replies; 11+ messages in thread
From: xuyang2018.jy @ 2021-07-08  6:22 UTC (permalink / raw)
  To: ltp

Hi Alexey
> Hi!
> On 07.07.2021 12:22, Yang Xu wrote:
>> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
>> ---
>>   runtest/net.tcp_cmds                   |  1 +
>>   testcases/network/tcp_cmds/tc/Makefile | 13 +++++++
>>   testcases/network/tcp_cmds/tc/tc01.sh  | 51 ++++++++++++++++++++++++++
>>   3 files changed, 65 insertions(+)
>>   create mode 100644 testcases/network/tcp_cmds/tc/Makefile
>>   create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh
>>
>> diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
>> index db47dfd5b..7e142de11 100644
>> --- a/runtest/net.tcp_cmds
>> +++ b/runtest/net.tcp_cmds
>> @@ -12,6 +12,7 @@ netstat netstat01.sh
>>   ping01 ping01.sh
>>   ping02 ping02.sh
>>   sendfile sendfile01.sh
>> +tc01 tc01.sh
>>   tcpdump tcpdump01.sh
>>   telnet telnet01.sh
>>   iptables iptables01.sh
>> diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
>> new file mode 100644
>> index 000000000..60150a1ce
>> --- /dev/null
>> +++ b/testcases/network/tcp_cmds/tc/Makefile
>> @@ -0,0 +1,13 @@
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +# Copyright (C) 2009, Cisco Systems Inc.
>> +# Ngie Cooper, July 2009
>> +
>> +top_srcdir		?= ../../../..
>> +
>> +include $(top_srcdir)/include/mk/env_pre.mk
>> +
>> +INSTALL_TARGETS		:= tc01.sh
>> +
>> +MAKE_TARGETS		:=
>> +
>> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
>> diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
>> new file mode 100755
>> index 000000000..0a241843b
>> --- /dev/null
>> +++ b/testcases/network/tcp_cmds/tc/tc01.sh
>> @@ -0,0 +1,51 @@
>> +#!/bin/sh
>> +# SPDX-License-Identifier: GPL-2.0-or-later
>> +# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
>> +# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
>> +#
>> +# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
>> +# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
>> +# because both devices are teql0, and it does not set qdisc_priv(sch)->m
>> +# leaving it zero on error path, then qdisc_create() imediately calls
>> +# teql_destroy() which does not expect zero master pointer and we get OOPS
>> +# on unpatched kernel.
>> +#
>> +# If we enable panic_on_oops, this case may crash.
>> +#
>> +# This kernel bug was introduced by
>> +# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
>> +# and has been fixed by
>> +# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
>> +#
>> +
>> +TST_TESTFUNC="do_test"
>> +TST_NEEDS_ROOT=1
>> +TST_NEEDS_DRIVERS="sch_teql"
>> +TST_NEEDS_CMDS="tc modprobe"
>> +sys_file="/proc/sys/kernel/panic_on_oops"
>> +. tst_test.sh
>> +
>> +do_test()
>> +{
>> +	[ ! -f "$sys_file" ]&&  tst_brk TCONF "$sys_file not enabled"
>
> Why this check is needed and also setting panic_on_oops to
> trigger the bug? If not, I would suggest to remove them from
> the test.
>
Yes, I will remove it.

>> +	orig_value=$(cat "$sys_file")
>> +	if [ $orig_value = "0" ]; then
>> +		echo 1>  $sys_file
>> +	fi
>> +
>> +	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
>> +	modprobe $TST_NEEDS_DRIVERS
>
> setup()
> {
> 	ROD modprobe $TST_NEEDS_DRIVERS
> }
>
>> +
>> +	tc qdisc add dev teql0 root teql0 2>/dev/null
>
> TST_EXP_FAIL tc qdisc add dev teql0 root teql0
Will do these on v2.

Best Regards
Yang Xu
>
>> +	if [ $? -eq 0 ]; then
>> +		tst_res TFAIL "tc qdisc command succeeded unexpectedly"
>> +	else
>> +		tst_res TPASS "the bug was not reproduced"
>> +	fi
>> +
>> +	if [ $orig_value = "0" ]; then
>> +		 echo 0>  $sys_file
>> +	fi
>> +}
>> +
>> +tst_run
>>

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

* [LTP] [PATCH v2] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-07 14:03 ` Alexey Kodanev
  2021-07-08  6:22   ` xuyang2018.jy
@ 2021-07-08  8:42   ` Yang Xu
  2021-07-09 10:05     ` Alexey Kodanev
  1 sibling, 1 reply; 11+ messages in thread
From: Yang Xu @ 2021-07-08  8:42 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 runtest/net.tcp_cmds                   |  1 +
 testcases/network/tcp_cmds/tc/Makefile | 13 +++++++
 testcases/network/tcp_cmds/tc/tc01.sh  | 48 ++++++++++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100644 testcases/network/tcp_cmds/tc/Makefile
 create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh

diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index db47dfd5b..7e142de11 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -12,6 +12,7 @@ netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
 sendfile sendfile01.sh
+tc01 tc01.sh
 tcpdump tcpdump01.sh
 telnet telnet01.sh
 iptables iptables01.sh
diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
new file mode 100644
index 000000000..60150a1ce
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/Makefile
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= tc01.sh
+
+MAKE_TARGETS		:=
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
new file mode 100755
index 000000000..d4f0792bc
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/tc01.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
+# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
+#
+# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
+# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
+# because both devices are teql0, and it does not set qdisc_priv(sch)->m
+# leaving it zero on error path, then qdisc_create() imediately calls
+# teql_destroy() which does not expect zero master pointer and we get OOPS
+# on unpatched kernel.
+#
+# If we enable panic_on_oops, this case may crash.
+#
+# This kernel bug was introduced by
+# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
+# and has been fixed by
+# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
+#
+
+TST_SETUP="setup"
+TST_TESTFUNC="do_test"
+TST_NEEDS_ROOT=1
+TST_NEEDS_DRIVERS="sch_teql"
+TST_NEEDS_CMDS="tc modprobe dmesg grep"
+
+. tst_test.sh
+
+setup()
+{
+	ROD modprobe $TST_NEEDS_DRIVERS
+}
+
+do_test()
+{
+	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
+
+	EXPECT_FAIL tc qdisc add dev teql0 root teql0
+
+	dmesg | grep RIP | grep teql_destroy | grep sch_teql > /dev/null
+	if [ $? -eq 0 ]; then
+		tst_res TFAIL "This bug is reproduced."
+	else
+		tst_res TPASS "This bug is not reproduced."
+	fi
+}
+
+tst_run
-- 
2.23.0


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

* [LTP] [PATCH v2] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-08  8:42   ` [LTP] [PATCH v2] " Yang Xu
@ 2021-07-09 10:05     ` Alexey Kodanev
  2021-07-12  2:18       ` [LTP] [PATCH v3] " Yang Xu
  0 siblings, 1 reply; 11+ messages in thread
From: Alexey Kodanev @ 2021-07-09 10:05 UTC (permalink / raw)
  To: ltp

On 08.07.2021 11:42, Yang Xu wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
...
> +do_test()
> +{
> +	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
> +
> +	EXPECT_FAIL tc qdisc add dev teql0 root teql0
> +
> +	dmesg | grep RIP | grep teql_destroy | grep sch_teql > /dev/null

It can be simplified to:

if dmesg | grep -q 'RIP:.*sch_teql'; then

> +	if [ $? -eq 0 ]; then
> +		tst_res TFAIL "This bug is reproduced."
> +	else
> +		tst_res TPASS "This bug is not reproduced."
> +	fi
> +}
> +
> +tst_run
> 


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

* [LTP] [PATCH v3] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-09 10:05     ` Alexey Kodanev
@ 2021-07-12  2:18       ` Yang Xu
  2021-07-12  8:19         ` Alexey Kodanev
  0 siblings, 1 reply; 11+ messages in thread
From: Yang Xu @ 2021-07-12  2:18 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 runtest/net.tcp_cmds                   |  1 +
 testcases/network/tcp_cmds/tc/Makefile | 13 +++++++
 testcases/network/tcp_cmds/tc/tc01.sh  | 47 ++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 testcases/network/tcp_cmds/tc/Makefile
 create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh

diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index db47dfd5b..7e142de11 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -12,6 +12,7 @@ netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
 sendfile sendfile01.sh
+tc01 tc01.sh
 tcpdump tcpdump01.sh
 telnet telnet01.sh
 iptables iptables01.sh
diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
new file mode 100644
index 000000000..60150a1ce
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/Makefile
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2009, Cisco Systems Inc.
+# Ngie Cooper, July 2009
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= tc01.sh
+
+MAKE_TARGETS		:=
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
new file mode 100755
index 000000000..a9da45b41
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/tc01.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
+# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
+#
+# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
+# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
+# because both devices are teql0, and it does not set qdisc_priv(sch)->m
+# leaving it zero on error path, then qdisc_create() imediately calls
+# teql_destroy() which does not expect zero master pointer and we get OOPS
+# on unpatched kernel.
+#
+# If we enable panic_on_oops, this case may crash.
+#
+# This kernel bug was introduced by
+# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
+# and has been fixed by
+# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
+#
+
+TST_SETUP="setup"
+TST_TESTFUNC="do_test"
+TST_NEEDS_ROOT=1
+TST_NEEDS_DRIVERS="sch_teql"
+TST_NEEDS_CMDS="tc modprobe dmesg grep"
+
+. tst_test.sh
+
+setup()
+{
+	ROD modprobe $TST_NEEDS_DRIVERS
+}
+
+do_test()
+{
+	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
+
+	EXPECT_FAIL tc qdisc add dev teql0 root teql0
+
+	if dmesg | grep -q 'RIP:.*sch_teql'; then
+		tst_res TFAIL "This bug is reproduced."
+	else
+		tst_res TPASS "This bug is not reproduced."
+	fi
+}
+
+tst_run
-- 
2.23.0


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

* [LTP] [PATCH v3] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-12  2:18       ` [LTP] [PATCH v3] " Yang Xu
@ 2021-07-12  8:19         ` Alexey Kodanev
  2021-07-12  9:10           ` [LTP] [PATCH v4 1/2] " Yang Xu
  0 siblings, 1 reply; 11+ messages in thread
From: Alexey Kodanev @ 2021-07-12  8:19 UTC (permalink / raw)
  To: ltp

Hi Xu!
On 12.07.2021 05:18, Yang Xu wrote:
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  runtest/net.tcp_cmds                   |  1 +
>  testcases/network/tcp_cmds/tc/Makefile | 13 +++++++
>  testcases/network/tcp_cmds/tc/tc01.sh  | 47 ++++++++++++++++++++++++++
>  3 files changed, 61 insertions(+)
>  create mode 100644 testcases/network/tcp_cmds/tc/Makefile
>  create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh
> 
> diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
> index db47dfd5b..7e142de11 100644
> --- a/runtest/net.tcp_cmds
> +++ b/runtest/net.tcp_cmds
> @@ -12,6 +12,7 @@ netstat netstat01.sh
>  ping01 ping01.sh
>  ping02 ping02.sh
>  sendfile sendfile01.sh
> +tc01 tc01.sh
>  tcpdump tcpdump01.sh
>  telnet telnet01.sh
>  iptables iptables01.sh
> diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
> new file mode 100644
> index 000000000..60150a1ce
> --- /dev/null
> +++ b/testcases/network/tcp_cmds/tc/Makefile
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (C) 2009, Cisco Systems Inc.
> +# Ngie Cooper, July 2009

Since it's a new Makefile, not sure if it should be copy-pasted
from the other tests...

> +
> +top_srcdir		?= ../../../..
> +
> +include $(top_srcdir)/include/mk/env_pre.mk
> +
> +INSTALL_TARGETS		:= tc01.sh
> +
> +MAKE_TARGETS		:=

There is no point adding an empty make targets here.

> +
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
> new file mode 100755
> index 000000000..a9da45b41
> --- /dev/null
> +++ b/testcases/network/tcp_cmds/tc/tc01.sh
> @@ -0,0 +1,47 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
> +# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
> +#
> +# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
> +# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
> +# because both devices are teql0, and it does not set qdisc_priv(sch)->m
> +# leaving it zero on error path, then qdisc_create() imediately calls
> +# teql_destroy() which does not expect zero master pointer and we get OOPS
> +# on unpatched kernel.
> +#
> +# If we enable panic_on_oops, this case may crash.
> +#
> +# This kernel bug was introduced by
> +# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
> +# and has been fixed by
> +# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
> +#
> +
> +TST_SETUP="setup"
> +TST_TESTFUNC="do_test"
> +TST_NEEDS_ROOT=1
> +TST_NEEDS_DRIVERS="sch_teql"
> +TST_NEEDS_CMDS="tc modprobe dmesg grep"
> +
> +. tst_test.sh
> +
> +setup()
> +{
> +	ROD modprobe $TST_NEEDS_DRIVERS
> +}
> +
> +do_test()
> +{
> +	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
> +
> +	EXPECT_FAIL tc qdisc add dev teql0 root teql0
> +
> +	if dmesg | grep -q 'RIP:.*sch_teql'; then
> +		tst_res TFAIL "This bug is reproduced."
> +	else
> +		tst_res TPASS "This bug is not reproduced."
> +	fi
> +}
> +
> +tst_run
> 

For the rest:

Reviewed-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>

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

* [LTP] [PATCH v4 1/2] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-12  8:19         ` Alexey Kodanev
@ 2021-07-12  9:10           ` Yang Xu
  2021-07-12  9:10             ` [LTP] [PATCH v4 2/2] testcase/network: Remove useless MAKE_TARGETS Yang Xu
  2021-07-19  5:45             ` [LTP] [PATCH v4 1/2] network/tc01.sh: Add a regression test for tc qdisc command xuyang2018.jy
  0 siblings, 2 replies; 11+ messages in thread
From: Yang Xu @ 2021-07-12  9:10 UTC (permalink / raw)
  To: ltp

Reviewed-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 runtest/net.tcp_cmds                   |  1 +
 testcases/network/tcp_cmds/tc/Makefile | 10 ++++++
 testcases/network/tcp_cmds/tc/tc01.sh  | 47 ++++++++++++++++++++++++++
 3 files changed, 58 insertions(+)
 create mode 100644 testcases/network/tcp_cmds/tc/Makefile
 create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh

diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
index db47dfd5b..7e142de11 100644
--- a/runtest/net.tcp_cmds
+++ b/runtest/net.tcp_cmds
@@ -12,6 +12,7 @@ netstat netstat01.sh
 ping01 ping01.sh
 ping02 ping02.sh
 sendfile sendfile01.sh
+tc01 tc01.sh
 tcpdump tcpdump01.sh
 telnet telnet01.sh
 iptables iptables01.sh
diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
new file mode 100644
index 000000000..b4d8b86ee
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/Makefile
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+INSTALL_TARGETS		:= tc01.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
new file mode 100755
index 000000000..a9da45b41
--- /dev/null
+++ b/testcases/network/tcp_cmds/tc/tc01.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
+# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
+#
+# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
+# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
+# because both devices are teql0, and it does not set qdisc_priv(sch)->m
+# leaving it zero on error path, then qdisc_create() imediately calls
+# teql_destroy() which does not expect zero master pointer and we get OOPS
+# on unpatched kernel.
+#
+# If we enable panic_on_oops, this case may crash.
+#
+# This kernel bug was introduced by
+# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
+# and has been fixed by
+# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
+#
+
+TST_SETUP="setup"
+TST_TESTFUNC="do_test"
+TST_NEEDS_ROOT=1
+TST_NEEDS_DRIVERS="sch_teql"
+TST_NEEDS_CMDS="tc modprobe dmesg grep"
+
+. tst_test.sh
+
+setup()
+{
+	ROD modprobe $TST_NEEDS_DRIVERS
+}
+
+do_test()
+{
+	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
+
+	EXPECT_FAIL tc qdisc add dev teql0 root teql0
+
+	if dmesg | grep -q 'RIP:.*sch_teql'; then
+		tst_res TFAIL "This bug is reproduced."
+	else
+		tst_res TPASS "This bug is not reproduced."
+	fi
+}
+
+tst_run
-- 
2.23.0


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

* [LTP] [PATCH v4 2/2] testcase/network: Remove useless MAKE_TARGETS
  2021-07-12  9:10           ` [LTP] [PATCH v4 1/2] " Yang Xu
@ 2021-07-12  9:10             ` Yang Xu
  2021-07-21 17:14               ` Petr Vorel
  2021-07-19  5:45             ` [LTP] [PATCH v4 1/2] network/tc01.sh: Add a regression test for tc qdisc command xuyang2018.jy
  1 sibling, 1 reply; 11+ messages in thread
From: Yang Xu @ 2021-07-12  9:10 UTC (permalink / raw)
  To: ltp

Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
---
 testcases/network/dhcp/Makefile                           | 2 --
 testcases/network/iproute/Makefile                        | 2 --
 testcases/network/multicast/mc_cmds/Makefile              | 2 --
 testcases/network/nfs/nfsstat01/Makefile                  | 2 --
 testcases/network/rpc/basic_tests/rpcinfo/Makefile        | 2 --
 testcases/network/rpc/basic_tests/rup/Makefile            | 2 --
 testcases/network/rpc/basic_tests/rusers/Makefile         | 2 --
 testcases/network/rpc/rpc-tirpc/Makefile                  | 2 --
 testcases/network/stress/broken_ip/Makefile               | 2 --
 testcases/network/stress/dns/Makefile                     | 2 --
 testcases/network/stress/ftp/Makefile                     | 2 --
 testcases/network/stress/http/Makefile                    | 2 --
 testcases/network/stress/icmp/multi-diffip/Makefile       | 2 --
 testcases/network/stress/icmp/multi-diffnic/Makefile      | 2 --
 testcases/network/stress/interface/Makefile               | 2 --
 testcases/network/stress/multicast/grp-operation/Makefile | 2 --
 testcases/network/stress/multicast/packet-flood/Makefile  | 2 --
 testcases/network/stress/multicast/query-flood/Makefile   | 2 --
 testcases/network/stress/tcp/multi-diffip/Makefile        | 2 --
 testcases/network/stress/tcp/multi-diffnic/Makefile       | 2 --
 testcases/network/stress/tcp/multi-diffport/Makefile      | 2 --
 testcases/network/stress/tcp/multi-sameport/Makefile      | 2 --
 testcases/network/stress/tcp/uni-basic/Makefile           | 2 --
 testcases/network/stress/tcp/uni-dsackoff/Makefile        | 2 --
 testcases/network/stress/tcp/uni-pktlossdup/Makefile      | 2 --
 testcases/network/stress/tcp/uni-sackoff/Makefile         | 2 --
 testcases/network/stress/tcp/uni-smallsend/Makefile       | 2 --
 testcases/network/stress/tcp/uni-tso/Makefile             | 2 --
 testcases/network/stress/tcp/uni-winscale/Makefile        | 1 -
 testcases/network/stress/udp/multi-diffip/Makefile        | 2 --
 testcases/network/stress/udp/multi-diffnic/Makefile       | 2 --
 testcases/network/stress/udp/multi-diffport/Makefile      | 2 --
 testcases/network/stress/udp/uni-basic/Makefile           | 2 --
 testcases/network/tcp_cmds/host/Makefile                  | 2 --
 testcases/network/tcp_cmds/ipneigh/Makefile               | 2 --
 testcases/network/tcp_cmds/netstat/Makefile               | 2 --
 testcases/network/tcp_cmds/ping/Makefile                  | 2 --
 testcases/network/tcp_cmds/tcpdump/Makefile               | 2 --
 testcases/network/tcp_cmds/telnet/Makefile                | 2 --
 testcases/network/xinetd/Makefile                         | 2 --
 40 files changed, 79 deletions(-)

diff --git a/testcases/network/dhcp/Makefile b/testcases/network/dhcp/Makefile
index 3750e698b..399301910 100644
--- a/testcases/network/dhcp/Makefile
+++ b/testcases/network/dhcp/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= dhcp_lib.sh dhcpd_tests.sh dnsmasq_tests.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/iproute/Makefile b/testcases/network/iproute/Makefile
index a18c7099e..30d8e11ed 100644
--- a/testcases/network/iproute/Makefile
+++ b/testcases/network/iproute/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= ip_tests.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/multicast/mc_cmds/Makefile b/testcases/network/multicast/mc_cmds/Makefile
index f4142ad0c..4d9e1bea8 100644
--- a/testcases/network/multicast/mc_cmds/Makefile
+++ b/testcases/network/multicast/mc_cmds/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS	:= mc_cmds.sh
 
-MAKE_TARGETS	:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/nfs/nfsstat01/Makefile b/testcases/network/nfs/nfsstat01/Makefile
index 6c6c4fd9c..cfde9aee9 100644
--- a/testcases/network/nfs/nfsstat01/Makefile
+++ b/testcases/network/nfs/nfsstat01/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= nfsstat01
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/basic_tests/rpcinfo/Makefile b/testcases/network/rpc/basic_tests/rpcinfo/Makefile
index 6b844038b..8a8a11402 100644
--- a/testcases/network/rpc/basic_tests/rpcinfo/Makefile
+++ b/testcases/network/rpc/basic_tests/rpcinfo/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= rpcinfo01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/basic_tests/rup/Makefile b/testcases/network/rpc/basic_tests/rup/Makefile
index a4dee681a..e0ebaaa58 100644
--- a/testcases/network/rpc/basic_tests/rup/Makefile
+++ b/testcases/network/rpc/basic_tests/rup/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= rup01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/basic_tests/rusers/Makefile b/testcases/network/rpc/basic_tests/rusers/Makefile
index b5f69f596..345365171 100644
--- a/testcases/network/rpc/basic_tests/rusers/Makefile
+++ b/testcases/network/rpc/basic_tests/rusers/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= rusers01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/rpc/rpc-tirpc/Makefile b/testcases/network/rpc/rpc-tirpc/Makefile
index 4fb080965..d2e1318c6 100644
--- a/testcases/network/rpc/rpc-tirpc/Makefile
+++ b/testcases/network/rpc/rpc-tirpc/Makefile
@@ -7,6 +7,4 @@ include	$(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= rpc_test.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_trunk_target.mk
diff --git a/testcases/network/stress/broken_ip/Makefile b/testcases/network/stress/broken_ip/Makefile
index e530c7c13..0a5207a94 100644
--- a/testcases/network/stress/broken_ip/Makefile
+++ b/testcases/network/stress/broken_ip/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= broken_ip*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/dns/Makefile b/testcases/network/stress/dns/Makefile
index a345f12fa..4c34ee24b 100644
--- a/testcases/network/stress/dns/Makefile
+++ b/testcases/network/stress/dns/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= *.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/ftp/Makefile b/testcases/network/stress/ftp/Makefile
index 38cbd13a5..9257ef9c6 100644
--- a/testcases/network/stress/ftp/Makefile
+++ b/testcases/network/stress/ftp/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= *.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/http/Makefile b/testcases/network/stress/http/Makefile
index 4529865e1..f354293b0 100644
--- a/testcases/network/stress/http/Makefile
+++ b/testcases/network/stress/http/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= *.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/icmp/multi-diffip/Makefile b/testcases/network/stress/icmp/multi-diffip/Makefile
index d0bfb3701..5fd73aadf 100644
--- a/testcases/network/stress/icmp/multi-diffip/Makefile
+++ b/testcases/network/stress/icmp/multi-diffip/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= icmp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/icmp/multi-diffnic/Makefile b/testcases/network/stress/icmp/multi-diffnic/Makefile
index 5eb10125f..63389ab55 100644
--- a/testcases/network/stress/icmp/multi-diffnic/Makefile
+++ b/testcases/network/stress/icmp/multi-diffnic/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= icmp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/interface/Makefile b/testcases/network/stress/interface/Makefile
index 4ae3e7b6d..7ebeec142 100644
--- a/testcases/network/stress/interface/Makefile
+++ b/testcases/network/stress/interface/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= *.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/multicast/grp-operation/Makefile b/testcases/network/stress/multicast/grp-operation/Makefile
index a31290115..267dca06a 100644
--- a/testcases/network/stress/multicast/grp-operation/Makefile
+++ b/testcases/network/stress/multicast/grp-operation/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= mcast*.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/multicast/packet-flood/Makefile b/testcases/network/stress/multicast/packet-flood/Makefile
index e99a8efce..e6c8115f4 100644
--- a/testcases/network/stress/multicast/packet-flood/Makefile
+++ b/testcases/network/stress/multicast/packet-flood/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= mcast*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/multicast/query-flood/Makefile b/testcases/network/stress/multicast/query-flood/Makefile
index e99a8efce..e6c8115f4 100644
--- a/testcases/network/stress/multicast/query-flood/Makefile
+++ b/testcases/network/stress/multicast/query-flood/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= mcast*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/multi-diffip/Makefile b/testcases/network/stress/tcp/multi-diffip/Makefile
index ccf58633d..727b2ccb7 100644
--- a/testcases/network/stress/tcp/multi-diffip/Makefile
+++ b/testcases/network/stress/tcp/multi-diffip/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/multi-diffnic/Makefile b/testcases/network/stress/tcp/multi-diffnic/Makefile
index b0894ac67..936562841 100644
--- a/testcases/network/stress/tcp/multi-diffnic/Makefile
+++ b/testcases/network/stress/tcp/multi-diffnic/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/multi-diffport/Makefile b/testcases/network/stress/tcp/multi-diffport/Makefile
index cfd508502..4f1b77beb 100644
--- a/testcases/network/stress/tcp/multi-diffport/Makefile
+++ b/testcases/network/stress/tcp/multi-diffport/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/multi-sameport/Makefile b/testcases/network/stress/tcp/multi-sameport/Makefile
index dd6f269e3..be2472f92 100644
--- a/testcases/network/stress/tcp/multi-sameport/Makefile
+++ b/testcases/network/stress/tcp/multi-sameport/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-basic/Makefile b/testcases/network/stress/tcp/uni-basic/Makefile
index 310e8f047..f5e692091 100644
--- a/testcases/network/stress/tcp/uni-basic/Makefile
+++ b/testcases/network/stress/tcp/uni-basic/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-dsackoff/Makefile b/testcases/network/stress/tcp/uni-dsackoff/Makefile
index 4b858b1d6..f8fe935b9 100644
--- a/testcases/network/stress/tcp/uni-dsackoff/Makefile
+++ b/testcases/network/stress/tcp/uni-dsackoff/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-pktlossdup/Makefile b/testcases/network/stress/tcp/uni-pktlossdup/Makefile
index d6511f753..10525cf3c 100644
--- a/testcases/network/stress/tcp/uni-pktlossdup/Makefile
+++ b/testcases/network/stress/tcp/uni-pktlossdup/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-sackoff/Makefile b/testcases/network/stress/tcp/uni-sackoff/Makefile
index ef469d633..0d8735872 100644
--- a/testcases/network/stress/tcp/uni-sackoff/Makefile
+++ b/testcases/network/stress/tcp/uni-sackoff/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-smallsend/Makefile b/testcases/network/stress/tcp/uni-smallsend/Makefile
index ba5fbbb43..de4bb0cd5 100644
--- a/testcases/network/stress/tcp/uni-smallsend/Makefile
+++ b/testcases/network/stress/tcp/uni-smallsend/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-tso/Makefile b/testcases/network/stress/tcp/uni-tso/Makefile
index 7aafd1613..cd70ed22f 100644
--- a/testcases/network/stress/tcp/uni-tso/Makefile
+++ b/testcases/network/stress/tcp/uni-tso/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/tcp/uni-winscale/Makefile b/testcases/network/stress/tcp/uni-winscale/Makefile
index 895848604..b29a4b2ef 100644
--- a/testcases/network/stress/tcp/uni-winscale/Makefile
+++ b/testcases/network/stress/tcp/uni-winscale/Makefile
@@ -26,6 +26,5 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcp*
 
-MAKE_TARGETS		:=
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/udp/multi-diffip/Makefile b/testcases/network/stress/udp/multi-diffip/Makefile
index 654704021..2592c71b1 100644
--- a/testcases/network/stress/udp/multi-diffip/Makefile
+++ b/testcases/network/stress/udp/multi-diffip/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= udp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/udp/multi-diffnic/Makefile b/testcases/network/stress/udp/multi-diffnic/Makefile
index d542555a2..5bc2107a7 100644
--- a/testcases/network/stress/udp/multi-diffnic/Makefile
+++ b/testcases/network/stress/udp/multi-diffnic/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= udp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/udp/multi-diffport/Makefile b/testcases/network/stress/udp/multi-diffport/Makefile
index 66714c95c..118e54cb6 100644
--- a/testcases/network/stress/udp/multi-diffport/Makefile
+++ b/testcases/network/stress/udp/multi-diffport/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= udp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/stress/udp/uni-basic/Makefile b/testcases/network/stress/udp/uni-basic/Makefile
index 4f9c91e01..7f6ae674d 100644
--- a/testcases/network/stress/udp/uni-basic/Makefile
+++ b/testcases/network/stress/udp/uni-basic/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= udp*
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/host/Makefile b/testcases/network/tcp_cmds/host/Makefile
index 53eed9861..453951e0d 100644
--- a/testcases/network/tcp_cmds/host/Makefile
+++ b/testcases/network/tcp_cmds/host/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= host01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/ipneigh/Makefile b/testcases/network/tcp_cmds/ipneigh/Makefile
index 64cc87b92..cf3f731a8 100644
--- a/testcases/network/tcp_cmds/ipneigh/Makefile
+++ b/testcases/network/tcp_cmds/ipneigh/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= ipneigh01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/netstat/Makefile b/testcases/network/tcp_cmds/netstat/Makefile
index 9b46ebb18..b29bea50c 100644
--- a/testcases/network/tcp_cmds/netstat/Makefile
+++ b/testcases/network/tcp_cmds/netstat/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= netstat01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/ping/Makefile b/testcases/network/tcp_cmds/ping/Makefile
index f8293e573..ed00eb16a 100644
--- a/testcases/network/tcp_cmds/ping/Makefile
+++ b/testcases/network/tcp_cmds/ping/Makefile
@@ -10,6 +10,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 INSTALL_TARGETS		:= ping01.sh \
 			   ping02.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/tcpdump/Makefile b/testcases/network/tcp_cmds/tcpdump/Makefile
index ed06cb81f..747d1e5e9 100644
--- a/testcases/network/tcp_cmds/tcpdump/Makefile
+++ b/testcases/network/tcp_cmds/tcpdump/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= tcpdump01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/tcp_cmds/telnet/Makefile b/testcases/network/tcp_cmds/telnet/Makefile
index fefdf6be8..90e879de2 100644
--- a/testcases/network/tcp_cmds/telnet/Makefile
+++ b/testcases/network/tcp_cmds/telnet/Makefile
@@ -26,6 +26,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= telnet01.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/network/xinetd/Makefile b/testcases/network/xinetd/Makefile
index f0ddf1446..b789b2a3a 100644
--- a/testcases/network/xinetd/Makefile
+++ b/testcases/network/xinetd/Makefile
@@ -8,6 +8,4 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 INSTALL_TARGETS		:= xinetd_tests.sh
 
-MAKE_TARGETS		:=
-
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
-- 
2.23.0


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

* [LTP] [PATCH v4 1/2] network/tc01.sh: Add a regression test for tc qdisc command
  2021-07-12  9:10           ` [LTP] [PATCH v4 1/2] " Yang Xu
  2021-07-12  9:10             ` [LTP] [PATCH v4 2/2] testcase/network: Remove useless MAKE_TARGETS Yang Xu
@ 2021-07-19  5:45             ` xuyang2018.jy
  1 sibling, 0 replies; 11+ messages in thread
From: xuyang2018.jy @ 2021-07-19  5:45 UTC (permalink / raw)
  To: ltp

Hi Alexey

Thanks for your review, I have merged this patch.

Best Regards
Yang Xu

> Reviewed-by: Alexey Kodanev<aleksei.kodanev@bell-sw.com>
> Signed-off-by: Yang Xu<xuyang2018.jy@fujitsu.com>
> ---
>   runtest/net.tcp_cmds                   |  1 +
>   testcases/network/tcp_cmds/tc/Makefile | 10 ++++++
>   testcases/network/tcp_cmds/tc/tc01.sh  | 47 ++++++++++++++++++++++++++
>   3 files changed, 58 insertions(+)
>   create mode 100644 testcases/network/tcp_cmds/tc/Makefile
>   create mode 100755 testcases/network/tcp_cmds/tc/tc01.sh
> 
> diff --git a/runtest/net.tcp_cmds b/runtest/net.tcp_cmds
> index db47dfd5b..7e142de11 100644
> --- a/runtest/net.tcp_cmds
> +++ b/runtest/net.tcp_cmds
> @@ -12,6 +12,7 @@ netstat netstat01.sh
>   ping01 ping01.sh
>   ping02 ping02.sh
>   sendfile sendfile01.sh
> +tc01 tc01.sh
>   tcpdump tcpdump01.sh
>   telnet telnet01.sh
>   iptables iptables01.sh
> diff --git a/testcases/network/tcp_cmds/tc/Makefile b/testcases/network/tcp_cmds/tc/Makefile
> new file mode 100644
> index 000000000..b4d8b86ee
> --- /dev/null
> +++ b/testcases/network/tcp_cmds/tc/Makefile
> @@ -0,0 +1,10 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
> +
> +top_srcdir		?= ../../../..
> +
> +include $(top_srcdir)/include/mk/env_pre.mk
> +
> +INSTALL_TARGETS		:= tc01.sh
> +
> +include $(top_srcdir)/include/mk/generic_leaf_target.mk
> diff --git a/testcases/network/tcp_cmds/tc/tc01.sh b/testcases/network/tcp_cmds/tc/tc01.sh
> new file mode 100755
> index 000000000..a9da45b41
> --- /dev/null
> +++ b/testcases/network/tcp_cmds/tc/tc01.sh
> @@ -0,0 +1,47 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Copyright (c) 2021 FUJITSU LIMITED. All rights reserved.
> +# Author: Yang Xu<xuyang2018.jy@fujitsu.com>
> +#
> +# When using "tc qdisc add dev teql0 root teql0 command", qdisc_create()
> +# calls teql_qdisc_init() it imediately fails after check "if (m->dev == dev)"
> +# because both devices are teql0, and it does not set qdisc_priv(sch)->m
> +# leaving it zero on error path, then qdisc_create() imediately calls
> +# teql_destroy() which does not expect zero master pointer and we get OOPS
> +# on unpatched kernel.
> +#
> +# If we enable panic_on_oops, this case may crash.
> +#
> +# This kernel bug was introduced by
> +# commit 87b60cfacf9f ("net_sched: fix error recovery at qdisc creation")
> +# and has been fixed by
> +# commit 1ffbc7ea9160 ("net: sched: sch_teql: fix null-pointer dereference")
> +#
> +
> +TST_SETUP="setup"
> +TST_TESTFUNC="do_test"
> +TST_NEEDS_ROOT=1
> +TST_NEEDS_DRIVERS="sch_teql"
> +TST_NEEDS_CMDS="tc modprobe dmesg grep"
> +
> +. tst_test.sh
> +
> +setup()
> +{
> +	ROD modprobe $TST_NEEDS_DRIVERS
> +}
> +
> +do_test()
> +{
> +	tst_res TINFO "Use tc qdisc command to trigger a null-pointer dereference"
> +
> +	EXPECT_FAIL tc qdisc add dev teql0 root teql0
> +
> +	if dmesg | grep -q 'RIP:.*sch_teql'; then
> +		tst_res TFAIL "This bug is reproduced."
> +	else
> +		tst_res TPASS "This bug is not reproduced."
> +	fi
> +}
> +
> +tst_run

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

* [LTP] [PATCH v4 2/2] testcase/network: Remove useless MAKE_TARGETS
  2021-07-12  9:10             ` [LTP] [PATCH v4 2/2] testcase/network: Remove useless MAKE_TARGETS Yang Xu
@ 2021-07-21 17:14               ` Petr Vorel
  0 siblings, 0 replies; 11+ messages in thread
From: Petr Vorel @ 2021-07-21 17:14 UTC (permalink / raw)
  To: ltp

Hi Xu,

obviously correct, merged.

Kind regards,
Petr

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

end of thread, other threads:[~2021-07-21 17:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-07  9:22 [LTP] [PATCH] network/tc01.sh: Add a regression test for tc qdisc command Yang Xu
2021-07-07 14:03 ` Alexey Kodanev
2021-07-08  6:22   ` xuyang2018.jy
2021-07-08  8:42   ` [LTP] [PATCH v2] " Yang Xu
2021-07-09 10:05     ` Alexey Kodanev
2021-07-12  2:18       ` [LTP] [PATCH v3] " Yang Xu
2021-07-12  8:19         ` Alexey Kodanev
2021-07-12  9:10           ` [LTP] [PATCH v4 1/2] " Yang Xu
2021-07-12  9:10             ` [LTP] [PATCH v4 2/2] testcase/network: Remove useless MAKE_TARGETS Yang Xu
2021-07-21 17:14               ` Petr Vorel
2021-07-19  5:45             ` [LTP] [PATCH v4 1/2] network/tc01.sh: Add a regression test for tc qdisc command xuyang2018.jy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox