summaryrefslogtreecommitdiff
path: root/scripts/objdiff
diff options
context:
space:
mode:
authorHao Jia <jiahao1@lixiang.com>2026-08-25 17:23:16 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-08-27 22:49:27 -0700
commit94e54ebe565bd8d2efc4c601bf616ec789732865 (patch)
tree3956a25d7d5577d4a9afa32a70f8972f57ff0358 /scripts/objdiff
parent6540596081b4aaab8a9a88af13aa188a58e41582 (diff)
downloadlinux-next-94e54ebe565bd8d2efc4c601bf616ec789732865.tar.gz
linux-next-94e54ebe565bd8d2efc4c601bf616ec789732865.zip
zram: fix idle age_sec underflow in idle_store()
After commit 2e8ff2f51dde ("zram: use u32 for entry ac_time tracking"), idle_store() computes the idle cutoff as follows: cutoff = ktime_sub((u32)ktime_get_boottime_seconds(), age_sec); Because the left operand is cast to a 32-bit unsigned integer, when age_sec exceeds the current uptime, the subtraction wraps modulo 2^32 and the huge result is zero-extended into the s64 cutoff. mark_idle() subsequently marks every entry as idle instead of matching nothing, breaking the intended semantics of /sys/block/zramX/idle. For instance, running echo 86400 > idle on a machine up for only two minutes causes all newly written pages to be marked as idle and handed over to idle writeback and recompression. Drop the explicit cast to perform the subtraction in signed arithmetic again, restoring the previous behavior: an age_sec greater than uptime yields a negative cutoff, and one equal to uptime yields 0. Since a cutoff of 0 is now a valid computed value, it can no longer double as the "all" sentinel. Switch to KTIME_MIN instead, which no ac_time can be after. Link: https://lore.kernel.org/20260825092316.69658-1-jiahao.kernel@gmail.com Fixes: 2e8ff2f51dde ("zram: use u32 for entry ac_time tracking") Signed-off-by: Hao Jia <jiahao1@lixiang.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Minchan Kim <minchan@kernel.org> Cc: Sergey Senozhatsky <senozhatsky@chromium.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'scripts/objdiff')
0 files changed, 0 insertions, 0 deletions