selftests: mptcp: join: fix subflow_send_ack lookup
authorGeliang Tang <geliang.tang@linux.dev>
Fri, 15 Dec 2023 16:04:24 +0000 (17:04 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jan 2024 12:42:45 +0000 (12:42 +0000)
commit c8f021eec5817601dbd25ab7e3ad5c720965c688 upstream.

MPC backups tests will skip unexpected sometimes (For example, when
compiling kernel with an older version of gcc, such as gcc-8), since
static functions like mptcp_subflow_send_ack also be listed in
/proc/kallsyms, with a 't' in front of it, not 'T' ('T' is for a global
function):

 > grep "mptcp_subflow_send_ack" /proc/kallsyms

 0000000000000000 T __pfx___mptcp_subflow_send_ack
 0000000000000000 T __mptcp_subflow_send_ack
 0000000000000000 t __pfx_mptcp_subflow_send_ack
 0000000000000000 t mptcp_subflow_send_ack

In this case, mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"
will be false, MPC backups tests will skip. This is not what we expected.

The correct logic here should be: if mptcp_subflow_send_ack is not a
global function in /proc/kallsyms, do these MPC backups tests. So a 'T'
must be added in front of mptcp_subflow_send_ack.

Fixes: 632978f0a961 ("selftests: mptcp: join: skip MPC backups tests if not supported")
Cc: stable@vger.kernel.org
Signed-off-by: Geliang Tang <geliang.tang@linux.dev>
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/net/mptcp/mptcp_join.sh

index 8eec7d2..4632a95 100755 (executable)
@@ -2773,7 +2773,7 @@ backup_tests()
        fi
 
        if reset "mpc backup" &&
-          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
+          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
                pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
                speed=slow \
                        run_tests $ns1 $ns2 10.0.1.1
@@ -2782,7 +2782,7 @@ backup_tests()
        fi
 
        if reset "mpc backup both sides" &&
-          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
+          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
                pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow,backup
                pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow,backup
                speed=slow \
@@ -2792,7 +2792,7 @@ backup_tests()
        fi
 
        if reset "mpc switch to backup" &&
-          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
+          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
                pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
                sflags=backup speed=slow \
                        run_tests $ns1 $ns2 10.0.1.1
@@ -2801,7 +2801,7 @@ backup_tests()
        fi
 
        if reset "mpc switch to backup both sides" &&
-          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
+          continue_if mptcp_lib_kallsyms_doesnt_have "mptcp_subflow_send_ack$"; then
                pm_nl_add_endpoint $ns1 10.0.1.1 flags subflow
                pm_nl_add_endpoint $ns2 10.0.1.2 flags subflow
                sflags=backup speed=slow \