From: Brian Grech via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] cve/icmp_rate_limit01: Lower icmp_msgs_per_sec for debug kernel reliability
Date: Wed, 22 Jul 2026 13:14:58 -0500 [thread overview]
Message-ID: <20260722181458.2230141-1-bgrech@redhat.com> (raw)
On debug kernels with CONFIG_PROVE_LOCKING or PREEMPT_RT, each socket
operation (bind, sendto) takes ~3-4ms instead of <0.5ms on a normal
kernel. At the default icmp_msgs_per_sec=1000, the token bucket refills
~371 tokens during the 371ms it takes to send 100 packets, so rate
limiting never engages and all batches return identical error counts,
causing a false TFAIL.
Lower icmp_msgs_per_sec to 10 in both the global save_restore and the
child network namespace. At 10/sec the bucket cannot meaningfully refill
during the send loop regardless of kernel speed, while the 2s inter-batch
sleep still allows full credit recovery (10 * 2 = 20 = burst).
Also add PATH_IPV4_ICMP_MSGS_PER_SEC to tst_path_defs.h alongside the
existing PATH_IPV4_ICMP_MSGS_BURST macro.
Assisted-by: ClaudeCode:claude-sonnet-4-6
Signed-off-by: Brian Grech <bgrech@redhat.com>
---
include/tst_path_defs.h | 1 +
testcases/cve/icmp_rate_limit01.c | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/tst_path_defs.h b/include/tst_path_defs.h
index 1a60028d3..35fb24274 100644
--- a/include/tst_path_defs.h
+++ b/include/tst_path_defs.h
@@ -79,6 +79,7 @@
#define PATH_IPV4_ICMP_RATEMASK "/proc/sys/net/ipv4/icmp_ratemask"
#define PATH_IPV4_ICMP_ECHO_IGNORE_ALL "/proc/sys/net/ipv4/icmp_echo_ignore_all"
#define PATH_IPV4_ICMP_MSGS_BURST "/proc/sys/net/ipv4/icmp_msgs_burst"
+#define PATH_IPV4_ICMP_MSGS_PER_SEC "/proc/sys/net/ipv4/icmp_msgs_per_sec"
#define PATH_IPV4_TCP_PROBE_INTERVAL "/proc/sys/net/ipv4/tcp_probe_interval"
#define PATH_IPV4_TCP_KEEPALIVE_TIME "/proc/sys/net/ipv4/tcp_keepalive_time"
#define PATH_IPV4_TCP_NOTSENT_LOWAT "/proc/sys/net/ipv4/tcp_notsent_lowat"
diff --git a/testcases/cve/icmp_rate_limit01.c b/testcases/cve/icmp_rate_limit01.c
index ee2e73544..fa10ae58f 100644
--- a/testcases/cve/icmp_rate_limit01.c
+++ b/testcases/cve/icmp_rate_limit01.c
@@ -63,12 +63,17 @@ static void setup(void)
childns = SAFE_OPEN("/proc/self/ns/net", O_RDONLY);
/*
- * Set namespace local rate limit if needed. The global limit might
- * be ignored otherwise.
+ * Set namespace local rate limits if needed. The global limits might
+ * be ignored otherwise. Lower icmp_msgs_per_sec to ensure rate limiting
+ * engages even on slow debug kernels where the send loop takes long
+ * enough that the token bucket refills mid-batch at the default 1000/sec.
*/
if (!access(PATH_IPV4_ICMP_MSGS_BURST, F_OK))
SAFE_FILE_PRINTF(PATH_IPV4_ICMP_MSGS_BURST, "50");
+ if (!access(PATH_IPV4_ICMP_MSGS_PER_SEC, F_OK))
+ SAFE_FILE_PRINTF(PATH_IPV4_ICMP_MSGS_PER_SEC, "10");
+
/* Configure child namespace */
CREATE_VETH_PAIR("ltp_veth1", "ltp_veth2");
NETDEV_ADD_ADDRESS_INET("ltp_veth2", htonl(DSTADDR), NETMASK,
@@ -263,6 +268,7 @@ static struct tst_test test = {
},
.save_restore = (const struct tst_path_val[]) {
{PATH_IPV4_ICMP_MSGS_BURST, "50", TST_SR_TBROK},
+ {PATH_IPV4_ICMP_MSGS_PER_SEC, "10", TST_SR_SKIP},
{PATH_USER_MAX_USER_NAMESPACES, "1024", TST_SR_SKIP},
{}
},
--
2.55.0
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next reply other threads:[~2026-07-22 18:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 18:14 Brian Grech via ltp [this message]
2026-07-22 19:20 ` [LTP] cve/icmp_rate_limit01: Lower icmp_msgs_per_sec for debug kernel reliability linuxtestproject.agent
2026-07-22 21:26 ` [LTP] [PATCH v2] " Brian Grech via ltp
2026-07-22 23:05 ` [LTP] " linuxtestproject.agent
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=20260722181458.2230141-1-bgrech@redhat.com \
--to=ltp@lists.linux.it \
--cc=bgrech@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.