OSDN Git Service

rtc: hctosys: Ensure system time doesn't overflow time_t
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 8 Mar 2018 22:27:31 +0000 (23:27 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 May 2018 05:49:10 +0000 (07:49 +0200)
commit0cf2a2141a9971617a3609cad0aeedb694b50fe6
treeaf074c6beecd47206579e7cb4910b98cbbf8588c
parent634ac348e9a4b64a7295d7532ac706304799bc81
rtc: hctosys: Ensure system time doesn't overflow time_t

[ Upstream commit b3a5ac42ab18b7d1a8f2f072ca0ee76a3b754a43 ]

On 32bit platforms, time_t is still a signed 32bit long. If it is
overflowed, userspace and the kernel cant agree on the current system time.
This causes multiple issues, in particular with systemd:
https://github.com/systemd/systemd/issues/1143

A good workaround is to simply avoid using hctosys which is something I
greatly encourage as the time is better set by userspace.

However, many distribution enable it and use systemd which is rendering the
system unusable in case the RTC holds a date after 2038 (and more so after
2106). Many drivers have workaround for this case and they should be
eliminated so there is only one place left to fix when userspace is able to
cope with dates after the 31bit overflow.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rtc/hctosys.c