diff options
| author | Hungyu Lin <dennylin0707@gmail.com> | 2026-10-20 23:34:33 +0000 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-10-25 22:43:19 +0100 |
| commit | d69cfd33b5a8d176124c564513b9ceb933595d93 (patch) | |
| tree | 633153319427facdccdd5a22c428fa5d76c6e140 /tools/perf/scripts/python/stackcollapse.py | |
| parent | ef60f61208a30eb5b941b707debdf04517271b4f (diff) | |
time/namespace: Fix overflow when converting absolute deadlines
do_timens_ktime_to_host() subtracts the namespace offset from an absolute
deadline and clamps the result to [0, KTIME_MAX]. A negative offset can
make a large deadline overflow to a negative value. Since ktime_t is
signed and KTIME_MAX is its maximum value, the subsequent comparison
against KTIME_MAX can never detect this overflow.
For example, with a -1 second boottime offset, an absolute CLOCK_BOOTTIME
timerfd deadline of KTIME_MAX can expire immediately. An absolute
clock_nanosleep() using the same clock and deadline can also return
immediately instead of waiting.
The earlier tim < offset check already handles the lower bound. A
negative subtraction result in the remaining branch therefore indicates
overflow. Detect that result and clamp it to KTIME_MAX.
Fixes: 89dd8eecfe961 ("time: Add do_timens_ktime_to_host() helper")
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261020233433.20997-1-dennylin0707@gmail.com
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
