diff options
| author | Karl Mehltretter <kmehltretter@gmail.com> | 2026-10-20 09:59:21 +0200 |
|---|---|---|
| committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2026-10-20 15:11:22 +0200 |
| commit | b253c2e96a80aac8e2bc67b425bf007ed78d4d8c (patch) | |
| tree | 1c4fedce7c3b3e2fd7a54bb88ac6568dbca100c3 /tools/lib/python | |
| parent | d691a96370b6cd7e684e4da1c473c09df963611b (diff) | |
rtc: class: Make the time32 hctosys limit configurable
The RTC_HCTOSYS feature faces an impossible dilemma on 32-bit systems:
a) systemd requires RTC_HCTOSYS=y with the correct timestamp
for its intended operation
b) broken RTC hardware can produce random future timestamps
beyond 2038 at boot time
c) time32 userspace immediately hangs if the time is set to a
date beyond 2038 and requires timestamps to be clamped
d) time64 userspace is intended to survive the actual 2038
date and requires timestamps to not be clamped
Commit b3a5ac42ab18 ("rtc: hctosys: Ensure system time doesn't overflow
time_t") introduced this limit to protect time32 userspace from future
RTC dates that can break boot and address constraints a), b) and c),
but broke d) in the process by limiting RTC_HCTOSYS to the time32 range
and falling back to RTC_HCTOSYS=n behavior when the RTC time overflows
that.
Make the behavior configurable with a new RTC_HCTOSYS_TIME32_LIMIT
option that chooses between breaking c) or d). On systems with
COMPAT_32BIT_TIME=n, only RTC_HCTOSYS_TIME32_LIMIT=n is allowed since
userspace can be assumed to be fully built for time64. 64-bit kernels
running 32-bit userland never had the cutoff and continue to not offer
the option.
Warn on rejection with the RTC date and option name so users can
identify the cause and find the setting.
[arnd: reword Kconfig text and patch description,
add COMPAT_32BIT_TIME dependency]
----
I ended up rewriting most of the text but kept Karl's ownership
as he did the original patch.
Fixes: b3a5ac42ab18 ("rtc: hctosys: Ensure system time doesn't overflow time_t")
Link: https://lore.kernel.org/all/20220908115337.1604277-1-arnd@kernel.org/
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20261020080026.2461578-1-arnd@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
