[PATCH 0/2] sysctl: Two jiffies converter regressions from 2dc164a48e6f
From: Zhan Xusheng
Date: Mon Sep 21 2026 - 23:12:40 EST
Following commit afdf35cfae0d ("sysctl: Fix type truncation in
sysctl_msec_to_jiffies") I went through the rest of the converter family.
Commit 2dc164a48e6f ("sysctl: Create converter functions with two new
macros") dropped two guards when it folded the open-coded conversions into
macros:
- the read path hands a sign-extended int to the converter, so reading
back any negative value produces a wrapped number
- mult_hz() multiplies unbounded, and the caller's INT_MAX check
inspects the product, so it cannot see a wrap
clock_t_to_jiffies(), used by the userhz variant, kept its own saturation
and is not affected.
Tested on x86_64 at HZ=1000 under QEMU, writing and reading back
tcp_fin_timeout, tcp_keepalive_time, ipfrag_time, icmp_ratelimit and
neigh/default/retrans_time before and after. I did not test 32-bit or
other HZ values.
One thing I am not sure about: afdf35cfae0d carries Fixes: b96b5c6708ea,
but the "jif > INT_MAX" guard the ms variant used to have also went away
in 2dc164a48e6f.
Zhan Xusheng (2):
sysctl: Negate before converting in the int read path
time/jiffies: Saturate in mult_hz() instead of wrapping
kernel/sysctl.c | 2 +-
kernel/time/jiffies.c | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
base-commit: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4
--
2.43.0