Hi everyone,
A lot of things have happened in the move to make the kernel y2038
ready in recent times. I've sent out new patches recently but will be
on vacation for the next few weeks, so here's a quick update on where
we are today with recent changes and work in progress:
- A large number of small driver fixes got merged into linux-4.16.
Many of these were old patches I had done a while ago but that had
not made it in yet. There are a few dozen more of these coming, but
those have some dependency.
- Deepa Dinamani has done a lot of the groundwork for the system
call conversion. Her latest patch series that got merged now finally
adds new system call entry points for timekeeping related syscalls. They
are not wired up yet, but now we have a template for the remaining ones,
and we have sorted out the header file dependencies.
- I just sent a pull request for a second chunk of system calls:
The sysvipc semtimedop, semctl/shmctl/msgctl and
mq_timedsend/mq_timedreceive calls. I have more patches for most of
the remaining calls, and they should be simpler (this one was rather
tricky). A full list can be found in a spreadsheet I made[2].
- Baolin Wang has worked on RTC related issues and most recently
posted a series to convert the user space ABI for ALSA. This is
currently under discussion.
- The most complicated remaining part is the conversion of
the VFS layer. Deepa is getting a new series for this ready after
having done some groundwork over the past years. The current idea is
to have a flag-day patch using coccinelle to change the inode, iattr
and kstat structures over at the same time. Many file systems will
require further changes after that, but those can be done individually
through their respective maintainers.
- Firoz Khan has started looking at the system call entry
points in the architectures. We want to add the new system calls to
all 32-bit architectures at once, in order to have a baseline release
that C libraries can rely on for implementing 64-bit time_t on all
architectures. Even after the architecture removal series, we still
have over a dozen different syscall tables and each one is laid out
slightly differently, which makes it hard to change. To improve this,
Firoz is preparing a series that changes
all architectures to use a common table format as used by x86, arm
and s390 today.
- I have collected all those patches in a git tree [1] for testing.
This currently has updated system call entry points for 32-bit ARM
and x86, but no others so far. The system call numbers *will* change
before it gets merged, so be careful when building user space based
on this, but it should be a starting point for testing. I definitely
expect this to contain bugs still, especially to the end of the series,
but the start of it should be fairly solid. Some patches are marked
as work-in-progress or don't contain a proper changelog text. Those
will still get reworked before a first version is posted to the
mainling lists.
- There are two notable areas not included in that tree today:
v4l and socket timestamps. I've had patches for both in the past but
they need to be reworked.
Arnd
[1] https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=…
[2] https://docs.google.com/spreadsheets/d/1HCYwHXxs48TsTb6IGUduNjQnmfRvMPzCN6T…
We have two ways of getting the current time from a platform at boot
or during suspend: either using read_persistent_clock() or the rtc
class operation. We never need both, so I'm hiding the
read_persistent_clock variant when the generic RTC is enabled.
Since read_persistent_clock() and mktime() are deprecated because of
the y2038 overflow of time_t, we should use the time64_t based
replacements here.
Finally, the dependency on CONFIG_ARCH_USES_GETTIMEOFFSET looks
completely bogus in this case, so let's remove that. It was
added in commit b13b3f51ff7b ("m68k: fix inclusion of
arch_gettimeoffset for non-MMU 68k classic CPU types") to deal
with arch_gettimeoffset(), which has since been removed from
this file and is unrelated to the RTC functions.
The rtc accessors are only used by classic machines, while
coldfire uses proper RTC drivers, so we can put the old
ifdef back around both functions.
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
---
arch/m68k/kernel/time.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 6b4389a6e8ea..3a8b47f8f97b 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -71,7 +71,9 @@ static irqreturn_t timer_interrupt(int irq, void *dummy)
return IRQ_HANDLED;
}
-void read_persistent_clock(struct timespec *ts)
+#ifdef CONFIG_M68KCLASSIC
+#if !IS_BUILTIN(CONFIG_RTC_DRV_GENERIC)
+void read_persistent_clock64(struct timespec64 *ts)
{
struct rtc_time time;
@@ -83,11 +85,12 @@ void read_persistent_clock(struct timespec *ts)
mach_hwclk(0, &time);
- ts->tv_sec = mktime(time.tm_year + 1900, time.tm_mon + 1, time.tm_mday,
- time.tm_hour, time.tm_min, time.tm_sec);
+ ts->tv_sec = mktime64(time.tm_year + 1900, time.tm_mon + 1, time.tm_mday,
+ time.tm_hour, time.tm_min, time.tm_sec);
}
+#endif
-#if defined(CONFIG_ARCH_USES_GETTIMEOFFSET) && IS_ENABLED(CONFIG_RTC_DRV_GENERIC)
+#if IS_ENABLED(CONFIG_RTC_DRV_GENERIC)
static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)
{
mach_hwclk(0, tm);
@@ -145,8 +148,8 @@ static int __init rtc_init(void)
}
module_init(rtc_init);
-
-#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
+#endif /* CONFIG_RTC_DRV_GENERIC */
+#endif /* CONFIG M68KCLASSIC */
void __init time_init(void)
{
--
2.9.0
This is an update of a series I posted a long time ago [1], updating
the IPC subsystem to pass down 64-bit time stamps to user space.
In particular, for sys_msgctl, sys_semctl and sys_shmctl, I do not
introduce a completely new set of replacement system calls, but instead
extend the existing ones to return data in the reserved fields of the
normal data structure.
This should be completely transparent to any existing user space, and
only after the 32-bit time_t wraps, it will make a difference in the
returned data.
libc implementations will consequently have to provide their own data
structures when they move to 64-bit time_t, and convert the structures
in user space from the ones returned by the kernel.
In contrast, mq_timedsend, mq_timedreceive and and semtimedop all do
need to change because having a libc redefine the timespec type
breaks the ABI, so with this series, there will be two separate entry
points for 32-bit architectures.
There are three cases here:
- little-endian architectures (except powerpc and mips) can use
the normal layout and just cast the data structure to the user space
type that contains 64-bit numbers.
- parisc and sparc can do the same thing with big-endian user space
- little-endian powerpc and most big-endian architectures have
to flip the upper and lower 32-bit halves of the time_t value in memory,
but can otherwise keep using the normal layout
- mips and big-endian xtensa need to be more careful because
they are not consistent in their definitions, and they have to provide
custom libc implementations for the system calls to use 64-bit time_t.
Changes to v2 [2]:
- added patches for mq_timedsend, mq_timedreceive and and semtimedop
system calls
- add asm-generic/compat.h changes to prepare for actually using those
on 32-bit.
- fix 'make headers_install' as reported by Heiko Carstens
- fix MIPS build as reported by build bot
- Cc everyone on all patches as originally intended, not just on the
cover letter.
Changes to v1 [1]:
- Rebased to the latest kernel (4.17-rc)
- Dropped changes for removed architectures
- Simplified the IPC code changes, based on prior work from
both Deepa and Eric
- Fixed a few bugs that I found during rebasing, in parcular the
sparc version was incorrect.
I haven't seen any objections to v1 and will send a pull request
to Thomas Gleixner after Deepa's first patches are all merged there.
There are a few more patches in my tree [3] now, I'm still testing
those and should be able to send the next batch next week.
Arnd
[1] https://lkml.org/lkml/2015/5/20/605
[2] https://lwn.net/Articles/751676/
[3] git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-next
Arnd Bergmann (17):
y2038: asm-generic: Extend sysvipc data structures
y2038: alpha: Remove unneeded ipc uapi header files
y2038: ia64: Remove unneeded ipc uapi header files
y2038: s390: Remove unneeded ipc uapi header files
y2038: arm64: Extend sysvipc compat data structures
y2038: mips: Extend sysvipc data structures
y2038: x86: Extend sysvipc data structures
y2038: parisc: Extend sysvipc data structures
y2038: sparc: Extend sysvipc data structures
y2038: powerpc: Extend sysvipc data structures
y2038: xtensa: Extend sysvipc data structures
y2038: ipc: Use ktime_get_real_seconds consistently
y2038: ipc: Report long times to user space
y2038: ipc: Use __kernel_timespec
y2038: ipc: Enable COMPAT_32BIT_TIME
y2038: ipc: Redirect ipc(SEMTIMEDOP, ...) to compat_ksys_semtimedop
y2038: compat: Move common compat types to asm-generic/compat.h
Cc: linux-api(a)vger.kernel.org
Cc: linux-arch(a)vger.kernel.org
Cc: libc-alpha(a)sourceware.org
Cc: tglx(a)linutronix.de
Cc: deepa.kernel(a)gmail.com
Cc: viro(a)zeniv.linux.org.uk
Cc: ebiederm(a)xmission.com
Cc: albert.aribaud(a)3adev.fr
Cc: linux-s390(a)vger.kernel.org
Cc: schwidefsky(a)de.ibm.com
Cc: x86(a)kernel.org
Cc: catalin.marinas(a)arm.com
Cc: will.deacon(a)arm.com
Cc: linux-mips(a)linux-mips.org
Cc: jhogan(a)kernel.org
Cc: ralf(a)linux-mips.org
Cc: linuxppc-dev(a)lists.ozlabs.org
Cc: sparclinux(a)vger.kernel.org
arch/alpha/include/uapi/asm/Kbuild | 4 ++
arch/alpha/include/uapi/asm/ipcbuf.h | 2 -
arch/alpha/include/uapi/asm/msgbuf.h | 28 -----------
arch/alpha/include/uapi/asm/sembuf.h | 23 ---------
arch/alpha/include/uapi/asm/shmbuf.h | 39 ---------------
arch/arm64/include/asm/compat.h | 52 +++++++-------------
arch/ia64/include/uapi/asm/Kbuild | 4 ++
arch/ia64/include/uapi/asm/ipcbuf.h | 2 -
arch/ia64/include/uapi/asm/msgbuf.h | 28 -----------
arch/ia64/include/uapi/asm/sembuf.h | 23 ---------
arch/ia64/include/uapi/asm/shmbuf.h | 39 ---------------
arch/mips/include/asm/compat.h | 58 +++++++++--------------
arch/mips/include/uapi/asm/msgbuf.h | 57 ++++++++++++++--------
arch/mips/include/uapi/asm/sembuf.h | 15 +++++-
arch/mips/include/uapi/asm/shmbuf.h | 23 ++++++++-
arch/parisc/include/asm/compat.h | 50 +++++++-------------
arch/parisc/include/uapi/asm/msgbuf.h | 33 +++++++------
arch/parisc/include/uapi/asm/sembuf.h | 16 +++----
arch/parisc/include/uapi/asm/shmbuf.h | 19 ++++----
arch/powerpc/include/asm/compat.h | 50 +++++++-------------
arch/powerpc/include/uapi/asm/msgbuf.h | 18 +++----
arch/powerpc/include/uapi/asm/sembuf.h | 14 +++---
arch/powerpc/include/uapi/asm/shmbuf.h | 19 ++++----
arch/s390/include/asm/compat.h | 50 +++++++-------------
arch/s390/include/uapi/asm/Kbuild | 3 ++
arch/s390/include/uapi/asm/msgbuf.h | 38 ---------------
arch/s390/include/uapi/asm/sembuf.h | 30 ------------
arch/s390/include/uapi/asm/shmbuf.h | 49 -------------------
arch/sparc/include/asm/compat.h | 51 +++++++-------------
arch/sparc/include/uapi/asm/msgbuf.h | 22 ++++-----
arch/sparc/include/uapi/asm/sembuf.h | 16 +++----
arch/sparc/include/uapi/asm/shmbuf.h | 21 ++++-----
arch/x86/include/asm/compat.h | 51 +++++++-------------
arch/x86/include/uapi/asm/Kbuild | 5 +-
arch/x86/include/uapi/asm/msgbuf.h | 1 -
arch/x86/include/uapi/asm/sembuf.h | 11 ++++-
arch/x86/include/uapi/asm/shmbuf.h | 1 -
arch/xtensa/include/uapi/asm/msgbuf.h | 25 +++++-----
arch/xtensa/include/uapi/asm/sembuf.h | 17 ++++---
arch/xtensa/include/uapi/asm/shmbuf.h | 37 ++++-----------
include/asm-generic/compat.h | 24 +++++++++-
include/linux/compat.h | 2 -
include/linux/syscalls.h | 6 +--
include/uapi/asm-generic/msgbuf.h | 17 ++++---
include/uapi/asm-generic/sembuf.h | 26 ++++++----
include/uapi/asm-generic/shmbuf.h | 17 ++++---
ipc/mqueue.c | 86 +++++++++++++++++-----------------
ipc/msg.c | 20 +++++---
ipc/sem.c | 27 +++++++----
ipc/shm.c | 14 ++++--
ipc/syscall.c | 13 +++--
ipc/util.h | 4 +-
52 files changed, 493 insertions(+), 807 deletions(-)
delete mode 100644 arch/alpha/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/alpha/include/uapi/asm/msgbuf.h
delete mode 100644 arch/alpha/include/uapi/asm/sembuf.h
delete mode 100644 arch/alpha/include/uapi/asm/shmbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/msgbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/sembuf.h
delete mode 100644 arch/ia64/include/uapi/asm/shmbuf.h
delete mode 100644 arch/s390/include/uapi/asm/msgbuf.h
delete mode 100644 arch/s390/include/uapi/asm/sembuf.h
delete mode 100644 arch/s390/include/uapi/asm/shmbuf.h
delete mode 100644 arch/x86/include/uapi/asm/msgbuf.h
delete mode 100644 arch/x86/include/uapi/asm/shmbuf.h
--
2.9.0
The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:
Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)
are available in the git repository at:
git+ssh://gitolite@ra.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
tags/y2038-timekeeping
for you to fetch changes up to 2e294d2c97d6683fcdf1134d87be1c461dff8ffd:
nanosleep: change time types to safe __kernel_* types (2018-04-19
10:07:58 +0200)
----------------------------------------------------------------
y2038: timekeeping syscall changes
This is the first set of system call entry point changes to enable 32-bit
architectures to have variants on both 32-bit and 64-bit time_t. Typically
these system calls take a 'struct timespec' argument, but that structure
is defined in user space by the C library and its layout will change.
The kernel already supports handling the 32-bit time_t on 64-bit
architectures through the CONFIG_COMPAT mechanism. As there are a total
of 51 system calls suffering from this problem, reusing that mechanism
on 32-bit architectures.
We already have patches for most of the remaining system calls, but this
set contains most of the complexity and is best tested. There was one
last-minute regression that prevented it from going into 4.17, but that
is fixed now.
More details from Deepa's patch series description:
Big picture is as per the lwn article:
https://lwn.net/Articles/643234/ [2]
The series is directed at converting posix clock syscalls:
clock_gettime, clock_settime, clock_getres and clock_nanosleep
to use a new data structure __kernel_timespec at syscall boundaries.
__kernel_timespec maintains 64 bit time_t across all execution modes.
vdso will be handled as part of each architecture when they enable
support for 64 bit time_t.
The compat syscalls are repurposed to provide backward compatibility
by using them as native syscalls as well for 32 bit architectures.
They will continue to use timespec at syscall boundaries.
CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec
or timespec at syscall boundaries.
The series does the following:
1. Enable compat syscalls on 32 bit architectures.
2. Add a new __kernel_timespec type to be used as the data structure
for all the new syscalls.
3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in
[1] and [2] to switch to new definition of __kernel_timespec. It is
the same as struct timespec otherwise.
4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls.
----------------------------------------------------------------
Arnd Bergmann (2):
compat: add an asm-generic/compat.h file
sparc: compat: allow including asm/compat.h for 32-bit
Deepa Dinamani (10):
compat: Make compat helpers independent of CONFIG_COMPAT
include: Move compat_timespec/ timeval to compat_time.h
compat: enable compat_get/put_timespec64 always
arch: introduce CONFIG_64BIT_TIME
arch: Introduce CONFIG_COMPAT_32BIT_TIME
posix-clocks: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME
include: Add new y2038 safe __kernel_timespec
fix get_timespec64() for y2038 safe compat interfaces
change time types to new y2038 safe __kernel_* types
nanosleep: change time types to safe __kernel_* types
arch/Kconfig | 15 +++++++++
arch/alpha/include/asm/Kbuild | 1 +
arch/arc/include/asm/Kbuild | 1 +
arch/arm/include/asm/Kbuild | 1 +
arch/arm64/include/asm/compat.h | 11 -------
arch/arm64/include/asm/stat.h | 1 +
arch/arm64/kernel/hw_breakpoint.c | 1 -
arch/arm64/kernel/perf_regs.c | 2 +-
arch/c6x/include/asm/Kbuild | 1 +
arch/h8300/include/asm/Kbuild | 1 +
arch/hexagon/include/asm/Kbuild | 1 +
arch/ia64/include/asm/Kbuild | 1 +
arch/m68k/include/asm/Kbuild | 1 +
arch/microblaze/include/asm/Kbuild | 1 +
arch/mips/include/asm/compat.h | 11 -------
arch/mips/kernel/signal32.c | 2 +-
arch/nds32/include/asm/Kbuild | 1 +
arch/nios2/include/asm/Kbuild | 1 +
arch/openrisc/include/asm/Kbuild | 1 +
arch/parisc/include/asm/compat.h | 11 -------
arch/powerpc/include/asm/compat.h | 11 -------
arch/powerpc/kernel/asm-offsets.c | 2 +-
arch/powerpc/oprofile/backtrace.c | 1 +
arch/s390/hypfs/hypfs_sprp.c | 1 -
arch/s390/include/asm/compat.h | 11 -------
arch/s390/include/asm/elf.h | 4 +--
arch/s390/kvm/priv.c | 1 -
arch/s390/pci/pci_clp.c | 1 -
arch/sh/include/asm/Kbuild | 1 +
arch/sparc/include/asm/compat.h | 15 +++------
arch/um/include/asm/Kbuild | 1 +
arch/unicore32/include/asm/Kbuild | 1 +
arch/x86/events/core.c | 2 +-
arch/x86/include/asm/compat.h | 11 -------
arch/x86/include/asm/ftrace.h | 2 +-
arch/x86/kernel/sys_x86_64.c | 2 +-
arch/xtensa/include/asm/Kbuild | 1 +
drivers/s390/block/dasd_ioctl.c | 1 -
drivers/s390/char/fs3270.c | 1 -
drivers/s390/char/sclp_ctl.c | 1 -
drivers/s390/char/vmcp.c | 1 -
drivers/s390/cio/chsc_sch.c | 1 -
drivers/s390/net/qeth_core_main.c | 2 +-
include/asm-generic/compat.h | 3 ++
include/linux/compat.h | 12 ++++---
include/linux/compat_time.h | 23 ++++++++++++++
include/linux/restart_block.h | 7 ++--
include/linux/syscalls.h | 13 ++++----
include/linux/time.h | 4 +--
include/linux/time64.h | 10 +++++-
include/uapi/asm-generic/posix_types.h | 1 +
include/uapi/linux/time.h | 7 ++++
kernel/compat.c | 52 +++++-------------------------
kernel/time/hrtimer.c | 10 ++++--
kernel/time/posix-stubs.c | 12 ++++---
kernel/time/posix-timers.c | 24 ++++++++++----
kernel/time/time.c | 58 +++++++++++++++++++++++++++++++---
57 files changed, 201 insertions(+), 176 deletions(-)
create mode 100644 include/asm-generic/compat.h
create mode 100644 include/linux/compat_time.h
The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:
Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)
are available in the git repository at:
git+ssh://gitolite@ra.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
tags/y2038-timekeeping
for you to fetch changes up to 01909974b41036a6a8d3907c66cc7b41c9a73da9:
time: Change nanosleep to safe __kernel_* types (2018-04-19 13:32:03 +0200)
----------------------------------------------------------------
y2038: timekeeping syscall changes
This is the first set of system call entry point changes to enable 32-bit
architectures to have variants on both 32-bit and 64-bit time_t. Typically
these system calls take a 'struct timespec' argument, but that structure
is defined in user space by the C library and its layout will change.
The kernel already supports handling the 32-bit time_t on 64-bit
architectures through the CONFIG_COMPAT mechanism. As there are a total
of 51 system calls suffering from this problem, reusing that mechanism
on 32-bit architectures.
We already have patches for most of the remaining system calls, but this
set contains most of the complexity and is best tested. There was one
last-minute regression that prevented it from going into 4.17, but that
is fixed now.
More details from Deepa's patch series description:
Big picture is as per the lwn article:
https://lwn.net/Articles/643234/ [2]
The series is directed at converting posix clock syscalls:
clock_gettime, clock_settime, clock_getres and clock_nanosleep
to use a new data structure __kernel_timespec at syscall boundaries.
__kernel_timespec maintains 64 bit time_t across all execution modes.
vdso will be handled as part of each architecture when they enable
support for 64 bit time_t.
The compat syscalls are repurposed to provide backward compatibility
by using them as native syscalls as well for 32 bit architectures.
They will continue to use timespec at syscall boundaries.
CONFIG_64_BIT_TIME controls whether the syscalls use __kernel_timespec
or timespec at syscall boundaries.
The series does the following:
1. Enable compat syscalls on 32 bit architectures.
2. Add a new __kernel_timespec type to be used as the data structure
for all the new syscalls.
3. Add new config CONFIG_64BIT_TIME(intead of the CONFIG_COMPAT_TIME in
[1] and [2] to switch to new definition of __kernel_timespec. It is
the same as struct timespec otherwise.
4. Add new CONFIG_32BIT_TIME to conditionally compile compat syscalls.
----------------------------------------------------------------
v2: rewrote subject lines as suggested by Thomas, the contents
are unchanged. I Hope I understood all the requests right.
Arnd Bergmann (2):
time: Add an asm-generic/compat.h file
sparc: compat: Allow including asm/compat.h for 32-bit
Deepa Dinamani (10):
compat: Make compat helpers independent of CONFIG_COMPAT
compat: Move compat_timespec/ timeval to compat_time.h
compat: Enable compat_get/put_timespec64 always
time: Introduce CONFIG_64BIT_TIME in architectures
time: Introduce CONFIG_COMPAT_32BIT_TIME
posix-timers: Make compat syscalls depend on CONFIG_COMPAT_32BIT_TIME
time: Add new y2038 safe __kernel_timespec
time: Fix get_timespec64() for y2038 safe compat interfaces
time: Change types to new y2038 safe __kernel_* types
time: Change nanosleep to safe __kernel_* types
arch/Kconfig | 15 +++++++++
arch/alpha/include/asm/Kbuild | 1 +
arch/arc/include/asm/Kbuild | 1 +
arch/arm/include/asm/Kbuild | 1 +
arch/arm64/include/asm/compat.h | 11 -------
arch/arm64/include/asm/stat.h | 1 +
arch/arm64/kernel/hw_breakpoint.c | 1 -
arch/arm64/kernel/perf_regs.c | 2 +-
arch/c6x/include/asm/Kbuild | 1 +
arch/h8300/include/asm/Kbuild | 1 +
arch/hexagon/include/asm/Kbuild | 1 +
arch/ia64/include/asm/Kbuild | 1 +
arch/m68k/include/asm/Kbuild | 1 +
arch/microblaze/include/asm/Kbuild | 1 +
arch/mips/include/asm/compat.h | 11 -------
arch/mips/kernel/signal32.c | 2 +-
arch/nds32/include/asm/Kbuild | 1 +
arch/nios2/include/asm/Kbuild | 1 +
arch/openrisc/include/asm/Kbuild | 1 +
arch/parisc/include/asm/compat.h | 11 -------
arch/powerpc/include/asm/compat.h | 11 -------
arch/powerpc/kernel/asm-offsets.c | 2 +-
arch/powerpc/oprofile/backtrace.c | 1 +
arch/s390/hypfs/hypfs_sprp.c | 1 -
arch/s390/include/asm/compat.h | 11 -------
arch/s390/include/asm/elf.h | 4 +--
arch/s390/kvm/priv.c | 1 -
arch/s390/pci/pci_clp.c | 1 -
arch/sh/include/asm/Kbuild | 1 +
arch/sparc/include/asm/compat.h | 15 +++------
arch/um/include/asm/Kbuild | 1 +
arch/unicore32/include/asm/Kbuild | 1 +
arch/x86/events/core.c | 2 +-
arch/x86/include/asm/compat.h | 11 -------
arch/x86/include/asm/ftrace.h | 2 +-
arch/x86/kernel/sys_x86_64.c | 2 +-
arch/xtensa/include/asm/Kbuild | 1 +
drivers/s390/block/dasd_ioctl.c | 1 -
drivers/s390/char/fs3270.c | 1 -
drivers/s390/char/sclp_ctl.c | 1 -
drivers/s390/char/vmcp.c | 1 -
drivers/s390/cio/chsc_sch.c | 1 -
drivers/s390/net/qeth_core_main.c | 2 +-
include/asm-generic/compat.h | 3 ++
include/linux/compat.h | 12 ++++---
include/linux/compat_time.h | 23 ++++++++++++++
include/linux/restart_block.h | 7 ++--
include/linux/syscalls.h | 13 ++++----
include/linux/time.h | 4 +--
include/linux/time64.h | 10 +++++-
include/uapi/asm-generic/posix_types.h | 1 +
include/uapi/linux/time.h | 7 ++++
kernel/compat.c | 52 +++++-------------------------
kernel/time/hrtimer.c | 10 ++++--
kernel/time/posix-stubs.c | 12 ++++---
kernel/time/posix-timers.c | 24 ++++++++++----
kernel/time/time.c | 58 +++++++++++++++++++++++++++++++---
57 files changed, 201 insertions(+), 176 deletions(-)
create mode 100644 include/asm-generic/compat.h
create mode 100644 include/linux/compat_time.h
This is an update of a series I posted a long time ago [1], updating
the IPC subsystem to pass down 64-bit time stamps to user space.
In particular, for sys_msgctl, sys_semctl and sys_shmctl, I do not
introduce a completely new set of replacement system calls, but instead
extend the existing ones to return data in the reserved fields of the
normal data structure.
This should be completely transparent to any existing user space, and
only after the 32-bit time_t wraps, it will make a difference in the
returned data.
libc implementations will consequently have to provide their own data
structures when they move to 64-bit time_t, and convert the structures
in user space from the ones returned by the kernel.
There are three cases here:
- little-endian architectures (except powerpc and mips) can use
the normal layout and just cast the data structure to the user space
type that contains 64-bit numbers.
- parisc and sparc can do the same thing with big-endian user space
- little-endian powerpc and most big-endian architectures have
to flip the upper and lower 32-bit halves of the time_t value in memory,
but can otherwise keep using the normal layout
- mips and big-endian xtensa need to be more careful because
they are not consistent in their definitions, and they have to provide
custom libc implementations for the system calls to use 64-bit time_t.
Changes to the previous version include
- Rebased to the latest kernel (4.17-rc)
- Dropped changes for removed architectures
- Simplified the IPC code changes, based on prior work from
both Deepa and Eric
- Fixed a few bugs that I found during rebasing, in parcular the
sparc version was incorrect.
If everyone agrees with the series, I'd like to have it merged through
the tip tree once Deepa's earlier syscall series in there (I have both
in my y2038 tree [2]).
Arnd
[1] https://lkml.org/lkml/2015/5/20/605
[2] git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git y2038-next
Arnd Bergmann (13):
y2038: asm-generic: extend sysvipc data structures
y2038: alpha: remove unneeded ipc uapi header files
y2038: ia64: remove unneeded ipc uapi header files
y2038: s390: remove unneeded ipc uapi header files
y2038: arm64: extend sysvipc compat data structures
y2038: mips: extend sysvipc data structures
y2038: x86: extend sysvipc data structures
y2038: parisc: extend sysvipc data structures
y2038: sparc: extend sysvipc data structures
y2038: powerpc: extend sysvipc data structures
y2038: xtensa: extend sysvipc data structures
y2038: ipc: use ktime_get_real_seconds consistently
y2038: ipc: report long times to user space
Cc: linux-api(a)vger.kernel.org
Cc: linux-arch(a)vger.kernel.org
Cc: libc-alpha(a)sourceware.org
Cc: tglx(a)linutronix.de
Cc: deepa.kernel(a)gmail.com
Cc: viro(a)zeniv.linux.org.uk
Cc: ebiederm(a)xmission.com
Cc: albert.aribaud(a)3adev.fr
Cc: linux-s390(a)vger.kernel.org
Cc: schwidefsky(a)de.ibm.com
Cc: x86(a)kernel.org
Cc: catalin.marinas(a)arm.com
Cc: will.deacon(a)arm.com
Cc: linux-mips(a)linux-mips.org
Cc: jhogan(a)kernel.org
Cc: ralf(a)linux-mips.org
Cc: linuxppc-dev(a)lists.ozlabs.org
Cc: sparclinux(a)vger.kernel.org
arch/alpha/include/asm/Kbuild | 4 +++
arch/alpha/include/uapi/asm/ipcbuf.h | 2 --
arch/alpha/include/uapi/asm/msgbuf.h | 28 -----------------
arch/alpha/include/uapi/asm/sembuf.h | 23 --------------
arch/alpha/include/uapi/asm/shmbuf.h | 39 -----------------------
arch/arm64/include/asm/compat.h | 32 +++++++++----------
arch/ia64/include/asm/Kbuild | 4 +++
arch/ia64/include/uapi/asm/ipcbuf.h | 2 --
arch/ia64/include/uapi/asm/msgbuf.h | 28 -----------------
arch/ia64/include/uapi/asm/sembuf.h | 23 --------------
arch/ia64/include/uapi/asm/shmbuf.h | 39 -----------------------
arch/mips/include/asm/compat.h | 38 ++++++++++++-----------
arch/mips/include/uapi/asm/msgbuf.h | 57 ++++++++++++++++++++++------------
arch/mips/include/uapi/asm/sembuf.h | 15 +++++++--
arch/mips/include/uapi/asm/shmbuf.h | 23 ++++++++++++--
arch/parisc/include/asm/compat.h | 32 +++++++++----------
arch/parisc/include/uapi/asm/msgbuf.h | 33 ++++++++++----------
arch/parisc/include/uapi/asm/sembuf.h | 16 +++++-----
arch/parisc/include/uapi/asm/shmbuf.h | 19 +++++-------
arch/powerpc/include/asm/compat.h | 32 +++++++++----------
arch/powerpc/include/uapi/asm/msgbuf.h | 18 +++++------
arch/powerpc/include/uapi/asm/sembuf.h | 14 ++++-----
arch/powerpc/include/uapi/asm/shmbuf.h | 19 +++++-------
arch/s390/include/asm/Kbuild | 3 ++
arch/s390/include/asm/compat.h | 32 +++++++++----------
arch/s390/include/uapi/asm/msgbuf.h | 38 -----------------------
arch/s390/include/uapi/asm/sembuf.h | 30 ------------------
arch/s390/include/uapi/asm/shmbuf.h | 49 -----------------------------
arch/sparc/include/asm/compat.h | 32 +++++++++----------
arch/sparc/include/uapi/asm/msgbuf.h | 22 ++++++-------
arch/sparc/include/uapi/asm/sembuf.h | 16 +++++-----
arch/sparc/include/uapi/asm/shmbuf.h | 21 ++++++-------
arch/x86/include/asm/compat.h | 32 +++++++++----------
arch/x86/include/uapi/asm/Kbuild | 5 ++-
arch/x86/include/uapi/asm/msgbuf.h | 1 -
arch/x86/include/uapi/asm/sembuf.h | 11 ++++++-
arch/x86/include/uapi/asm/shmbuf.h | 1 -
arch/xtensa/include/uapi/asm/msgbuf.h | 25 +++++++--------
arch/xtensa/include/uapi/asm/sembuf.h | 17 +++++-----
arch/xtensa/include/uapi/asm/shmbuf.h | 37 +++++-----------------
include/uapi/asm-generic/msgbuf.h | 17 +++++-----
include/uapi/asm-generic/sembuf.h | 26 ++++++++++------
include/uapi/asm-generic/shmbuf.h | 17 +++++-----
ipc/msg.c | 20 ++++++++----
ipc/sem.c | 20 ++++++++----
ipc/shm.c | 14 +++++++--
46 files changed, 393 insertions(+), 633 deletions(-)
delete mode 100644 arch/alpha/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/alpha/include/uapi/asm/msgbuf.h
delete mode 100644 arch/alpha/include/uapi/asm/sembuf.h
delete mode 100644 arch/alpha/include/uapi/asm/shmbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/ipcbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/msgbuf.h
delete mode 100644 arch/ia64/include/uapi/asm/sembuf.h
delete mode 100644 arch/ia64/include/uapi/asm/shmbuf.h
delete mode 100644 arch/s390/include/uapi/asm/msgbuf.h
delete mode 100644 arch/s390/include/uapi/asm/sembuf.h
delete mode 100644 arch/s390/include/uapi/asm/shmbuf.h
delete mode 100644 arch/x86/include/uapi/asm/msgbuf.h
delete mode 100644 arch/x86/include/uapi/asm/shmbuf.h
--
2.9.0
We have several files on sparc that include linux/compat.h and expect
asm/compat.h not to be included, otherwise we get a build failure.
Since we need to include asm/compat.h for compat time_t handling
on all 32-bit architectures now, this hides some portions of
asm/compat.h in order to let the rest of the file get included.
Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
---
arch/sparc/include/asm/compat.h | 4 ++++
1 file changed, 4 insertions(+)
This is the fix for the y2038 syscall series that missed the 4.17 merge
window. I've now spent two more days doing extra build testing on all
64-bit archtectures building with and without CONFIG_COMPAT, as well
as without CONFIG_64BIT. I did not run into any additional build failures
after this patch, so my plan is to pick that up into my y2038 tree after
-rc1 and send Thomas a pull request a few days later for inclusion
in linux-4.18.
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index 161aeacbc9ad..4eb51d2dae98 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -157,6 +157,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr)
return (u32)(unsigned long)uptr;
}
+#ifdef CONFIG_COMPAT
static inline void __user *arch_compat_alloc_user_space(long len)
{
struct pt_regs *regs = current_thread_info()->kregs;
@@ -173,6 +174,7 @@ static inline void __user *arch_compat_alloc_user_space(long len)
return (void __user *) usp;
}
+#endif
struct compat_ipc64_perm {
compat_key_t key;
@@ -232,6 +234,7 @@ struct compat_shmid64_ds {
unsigned int __unused2;
};
+#ifdef CONFIG_COMPAT
static inline int is_compat_task(void)
{
return test_thread_flag(TIF_32BIT);
@@ -243,5 +246,6 @@ static inline bool in_compat_syscall(void)
return pt_regs_trap_type(current_pt_regs()) == 0x110;
}
#define in_compat_syscall in_compat_syscall
+#endif
#endif /* _ASM_SPARC64_COMPAT_H */
--
2.9.0