From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.171 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796280017; b=RN6Ge6da1qbzb+NniuQk4ZBWJIvSPP8Y+iGegDfKdYb73BfenVA4a8GSxp3TmOjaxanY qrJZawaiZ9d/5oYVN4YMhYlUVafhVKgQBCHlz2P7TamNuT7YW8aQKi0orHnIzgV+4jTXO S7gzpGDCOsHVfhpdBjCOob9A/Rbp+Zd281H0M9NiyNAEg2QYpoNTUiLMLFtxbA6Cz3BSJ v/hNpvvhSCeJ/SPvRMvPARDipYH/j51TOce7aEAtFN90IUosHTxMeTnwQHTZZb8GXeTUQ fxqQPUqfEXV6KTOptFTKyuY6KTAktBG92iqS+zDYcekBlEfupaIf3QhFgGcSgxGTrXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796280017; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding; bh=1155wqZUBuDw6/RQaOitGOgFwm9cr6XONOUHNHTqCE8=; b=C6mdxmRtxGluPhAv5aUzLcn/fNIWMN/BkGNcIhWJjOAoxi9+Idtd7I3KLrbSTv5gcLcK L9Avdmpj12OIvM/Cy20AYHB0WZeQXO3fzwSS9pko69nP/gobtBsMkcJBeRRFT09yJ+w1h FJDxePPpQXLbVwwYisHxdOri8hnusCo0fbnBd3oo2Xrt+qo0RqQ+FUhZAAHVPK+Spk6dj UQQT5GsI4nlFWfCyf+JPw9xOKqEycM/57CaqWsvEQJrcZp/zyBcOx6Wd55QyM8aM5YQJR pASklQdUHTNt8WJ3rkBK32ks/2sGc3IzzMxm3DjhpUTsiDMh0+/GxN16YDBP8T9wvbw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="J8lV4u/g"; arc=none smtp.remote-ip=74.125.82.171 Received: from mail-dy1-f171.google.com (mail-dy1-f171.google.com [74.125.82.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D83C6606A322 for ; Thu, 3 Dec 2026 06:40:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D83C6606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=J8lV4u/g Received: by mail-dy1-f171.google.com with SMTP id 5a478bee46e88-386cf1041cdso15614676eec.0 for ; Wed, 02 Dec 2026 22:40:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796280016; x=1796884816; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=1155wqZUBuDw6/RQaOitGOgFwm9cr6XONOUHNHTqCE8=; b=J8lV4u/gpkOgqk2EvwQ7izIaP+Cvg3vC7+MEIZPiliYSSi/21B1PPhzpp3IJLYTpTt S1hpu7DIxZ/ACPjOgOdLnHvWtYQRyr/dvEEwEqQduCgM5jENGUJCSLbpaPNU0Q3krnvU exc/exj8HyKb/T7D578CpXUr3zyuoEd2Oo3VDc70ui1wmqRXdGSxrbOXGLB3+OnYGiro Q9LTKEeo+KoFsX8BXoW3NlAMvtRBrasPoT9mLGW92wQhE5vzs8/03VkRd3sZiL/Ubjtt +ktiM6sKzj/KzsIq/vdCy/eDiT1RkJf1HxgpL9ROflSacdzM5ztdJopEkK3xbO4iFViF EL/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796280016; x=1796884816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=1155wqZUBuDw6/RQaOitGOgFwm9cr6XONOUHNHTqCE8=; b=BDTcVI4MrSttyOJKvUXKeSzZpUjvzHvKf2YyWnyKADnx1HH9rLr6Dc16toZZg4cb8n 5DF8jhEaRUiEDaB35Rmb39/wsBILJMxG8YOdu+Dk0a76YVlrf72ijRg6+kgStk5nwdb/ wMcsy6kLO+tm2M/ICLeSOg/45tJzkxkccc4UuPcpDxH3DSq9GElwsQ06wmdyRm/h9WhU DDahA2k7jgLxJcQW8ualAtOMHSVi0kL8YF4HBNy7CF8ixzTmoO0MOVz/AX2xSaC9bCn7 oi+OBPo3vB+HC8Y7znewqW67Ay4/Rg9BoAa9vdmotYgpoXHCKo6xJwxslnKVFelgqYAD BV8Q== X-Gm-Message-State: APuU4Z+YQ5oEntAzd+EAAYiqsxnjyaytPDrTgxjyXav26tO5f9vBj/yK VVdzRSKld+lxcjh594RGBT/57UY9zt4MrW+pw+jAQsnAljrKXuaeXdh3V8eZ6g== X-Gm-Gg: AZFdTZfehVheZ3s2reX9+4cgtLtFe0HgkSydNZq6Uk5lSenmvrLuxKwgFCLYKeFveGu dO2rmyhjqyUP2JbOVD8+TreWjnNqSZKZ/2bDTW7GyeKG0OkgO8X1Ip72J4hqIGYMyLP9vS+IOHM veblxVzsbtinASIieipVuwn3bj3mH5A7LDR0ktmRRee6rA0sHQELN5iw3BO7THIlmZLAZ5+OADY kV9VGy86NyQJviN5E1hE+cuk5w5Edb6lq/qomeNZE7XLtOMtLcgoHTZot50XsUNt7VHb99USU6f 4z9MWndk/3gMTdI+SjyL1Wk9V/nNntkXVANGngZXLTb5/h4wAyKZ712hLKwG1JwSgs0w+pwlptE A1XjudgwVnzrOGlLBy250f8srs31hPitmNMW2hNuxAQpZ6PrBs81pdzaPKcH73PV4Mew4SQAGvy QW8LqVNOPBlKui2gPmRaDzYCRBSSDnK+S9rSzxBVLZtAynIiZ/mvuZWfKubstN3w4q/uXFg87VM Tkx+HJFepOOp+8J5GI31gtzK279QktfqzBlUo3jWJZoIFgNcz2dJFN9cJeKXxZul+naGsQOF/AZ V5Q1BrKv2BY0clKkZlNpLSdLPHEXhK+1SF/plI4+rWS9XFtV/4qTeXnwxz69AigaiA7hcTlrgVk 5+4NdbsK0Q6HGsR2bBlEHKqcywk3HPxzI1OXX1TVL1XPBZj3gnnH1GscUGFD8lntMcQ== X-Received: by 2002:a05:693c:65d3:b0:387:435c:c225 with SMTP id 5a478bee46e88-387435cc4b1mr997535eec.24.1796280015926; Wed, 02 Dec 2026 22:40:15 -0800 (PST) Received: from l ([2603:8002:ea00:6800:96f2:cc7b:ccf:89d0]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-38566cd40c5sm154823913eec.10.2026.12.02.22.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 22:40:15 -0800 (PST) From: Dave Seddon To: netdev@vger.kernel.org Cc: Dave Seddon , Stephen Hemminger , David Ahern , Jamal Hadi Salim , Eric Dumazet , Odin Ugedal , Jay Vosburgh Subject: [PATCH iproute2 0/5] reject rates, sizes and times that overflow or are NaN Date: Wed, 2 Dec 2026 22:40:09 -0800 Message-ID: <20261203064014.2272012-1-dave.seddon.ca@gmail.com> X-Mailer: git-send-email 2.56.0 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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