From: Paolo Abeni <pabeni@redhat.com>
To: Justin Iurman <justin.iurman@uliege.be>, netdev@vger.kernel.org
Cc: davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
kuba@kernel.org, horms@kernel.org, Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net 7/7] selftests: net: test for lwtunnel dst ref loops
Date: Thu, 13 Mar 2025 13:56:46 +0100 [thread overview]
Message-ID: <3c39994e-548e-4d67-b8e4-3236d27a6ca6@redhat.com> (raw)
In-Reply-To: <20250311141238.19862-8-justin.iurman@uliege.be>
On 3/11/25 3:12 PM, Justin Iurman wrote:
> diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
> index 5b9baf708950..61e5116987f3 100644
> --- a/tools/testing/selftests/net/config
> +++ b/tools/testing/selftests/net/config
> @@ -107,3 +107,5 @@ CONFIG_XFRM_INTERFACE=m
> CONFIG_XFRM_USER=m
> CONFIG_IP_NF_MATCH_RPFILTER=m
> CONFIG_IP6_NF_MATCH_RPFILTER=m
> +CONFIG_IPV6_ILA=m
> +CONFIG_IPV6_RPL_LWTUNNEL=y
> diff --git a/tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh b/tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh
> new file mode 100755
> index 000000000000..9161f16154a5
> --- /dev/null
> +++ b/tools/testing/selftests/net/lwt_dst_cache_ref_loop.sh
> @@ -0,0 +1,250 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# Author: Justin Iurman <justin.iurman@uliege.be>
> +#
> +# WARNING
> +# -------
> +# This is just a dummy script that triggers encap cases with possible dst cache
> +# reference loops in affected lwt users (see list below). Some cases are
> +# pathological configurations for simplicity, others are valid. Overall, we
> +# don't want this issue to happen, no matter what. In order to catch any
> +# reference loops, kmemleak MUST be used. The results alone are always blindly
> +# successful, don't rely on them. Note that the following tests may crash the
> +# kernel if the fix to prevent lwtunnel_{input|output|xmit}() reentry loops is
> +# not present.
> +#
> +# Affected lwt users so far (please update accordingly if needed):
> +# - ila_lwt (output only)
> +# - ioam6_iptunnel (output only)
> +# - rpl_iptunnel (both input and output)
> +# - seg6_iptunnel (both input and output)
> +
> +source lib.sh
> +
> +check_compatibility()
> +{
> + setup_ns tmp_node &>/dev/null
> + if [ $? != 0 ]
> + then
We don't have formal codying stile written for shell files, but please
use tabs for indenting, and keep the 'then' keyword on the same line
with 'if'
> + echo "SKIP: Cannot create netns."
> + exit $ksft_skip
> + fi
> +
> + ip link add name veth0 netns $tmp_node type veth \
> + peer name veth1 netns $tmp_node &>/dev/null
> + local ret=$?
> +
> + ip -netns $tmp_node link set veth0 up &>/dev/null
> + ret=$((ret + $?))
> +
> + ip -netns $tmp_node link set veth1 up &>/dev/null
> + ret=$((ret + $?))
> +
> + if [ $ret != 0 ]
> + then
> + echo "SKIP: Cannot configure links."
> + cleanup_ns $tmp_node
If you add a:
trap cleanup EXIT
after setup, you can drop the explicit call in the various exit paths.
/P
prev parent reply other threads:[~2025-03-13 12:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250311141238.19862-1-justin.iurman@uliege.be>
2025-03-11 14:12 ` [PATCH net 7/7] selftests: net: test for lwtunnel dst ref loops Justin Iurman
2025-03-13 12:56 ` Paolo Abeni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3c39994e-548e-4d67-b8e4-3236d27a6ca6@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=justin.iurman@uliege.be \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).