Netdev List
 help / color / mirror / Atom feed
* [PATCH iproute2 0/5] reject rates, sizes and times that overflow or are NaN
@ 2026-12-03  6:40 Dave Seddon
  2026-12-03  6:40 ` [PATCH iproute2 1/5] lib: get_rate64: reject overflow and NaN Dave Seddon
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dave Seddon @ 2026-12-03  6:40 UTC (permalink / raw)
  To: netdev
  Cc: Dave Seddon, Stephen Hemminger, David Ahern, Jamal Hadi Salim,
	Eric Dumazet, Odin Ugedal, Jay Vosburgh

get_rate64(), get_time(), get_time64() and get_time_rtt() convert a
parsed double to an integer with no range check, and the first three
also accept NaN. get_rate() and get_size64() have a check, but after
the conversion. Test before converting in each (patches 1, 3 and 4).

Patch 2 stops get_size() reading the size after get_size64() fails.
Patch 5 checks rtt and rttvar in ip route, which are scaled after the
parse.

Patches 1, 4 and 5 have a command that shows the problem on current
main; the one in patch 3 needs a sanitizer build. The read in patch 2
has no visible effect, as every caller tests the return value; clang's
static analyzer reports it.

Every command in the commit messages was run as written on current
main. A build with -fsanitize=undefined,float-cast-overflow reports
all six conversions on current main and none with the series applied.
The seven parsers were also compared with an independent model on
29094 generated inputs, on x86-64 and on arm64 (qemu-user): with the
series they agree on every input.

clang-tidy, the clang static analyzer, cppcheck and gcc -fanalyzer
report nothing new on the three files changed. With the series, the
parsers also ran clean under MemorySanitizer and libFuzzer.

Dave Seddon (5):
  lib: get_rate64: reject overflow and NaN
  lib: get_size: do not copy the size out when get_size64() fails
  lib: test for overflow before converting a rate or size
  lib: reject a time that does not fit the result type
  ip route: reject an rtt or rttvar that overflows when scaled

 ip/iproute.c     |  6 ++++--
 lib/utils.c      |  9 +++++++++
 lib/utils_math.c | 18 +++++++++---------
 3 files changed, 22 insertions(+), 11 deletions(-)

-- 
2.56.0


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

end of thread, other threads:[~2026-12-03  6:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  6:40 [PATCH iproute2 0/5] reject rates, sizes and times that overflow or are NaN Dave Seddon
2026-12-03  6:40 ` [PATCH iproute2 1/5] lib: get_rate64: reject overflow and NaN Dave Seddon
2026-12-03  6:40 ` [PATCH iproute2 2/5] lib: get_size: do not copy the size out when get_size64() fails Dave Seddon
2026-12-03  6:40 ` [PATCH iproute2 3/5] lib: test for overflow before converting a rate or size Dave Seddon
2026-12-03  6:40 ` [PATCH iproute2 4/5] lib: reject a time that does not fit the result type Dave Seddon
2026-12-03  6:40 ` [PATCH iproute2 5/5] ip route: reject an rtt or rttvar that overflows when scaled Dave Seddon

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