1. 29 8月, 2018 4 次提交
    • A
      y2038: utimes: Rework #ifdef guards for compat syscalls · 4faea239
      Arnd Bergmann 提交于
      After changing over to 64-bit time_t syscalls, many architectures will
      want compat_sys_utimensat() but not respective handlers for utime(),
      utimes() and futimesat(). This adds a new __ARCH_WANT_SYS_UTIME32 to
      complement __ARCH_WANT_SYS_UTIME. For now, all 64-bit architectures that
      support CONFIG_COMPAT set it, but future 64-bit architectures will not
      (tile would not have needed it either, but got removed).
      
      As older 32-bit architectures get converted to using CONFIG_64BIT_TIME,
      they will have to use __ARCH_WANT_SYS_UTIME32 instead of
      __ARCH_WANT_SYS_UTIME. Architectures using the generic syscall ABI don't
      need either of them as they never had a utime syscall.
      
      Since the compat_utimbuf structure is now required outside of
      CONFIG_COMPAT, I'm moving it into compat_time.h.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      ---
      changed from last version:
      - renamed __ARCH_WANT_COMPAT_SYS_UTIME to __ARCH_WANT_SYS_UTIME32
      4faea239
    • A
      y2038: Compile utimes()/futimesat() conditionally · 185cfaf7
      Arnd Bergmann 提交于
      There are four generations of utimes() syscalls: utime(), utimes(),
      futimesat() and utimensat(), each one being a superset of the previous
      one. For y2038 support, we have to add another one, which is the same
      as the existing utimensat() but always passes 64-bit times_t based
      timespec values.
      
      There are currently 10 architectures that only use utimensat(), two
      that use utimes(), futimesat() and utimensat() but not utime(), and 11
      architectures that have all four, and those define __ARCH_WANT_SYS_UTIME
      in order to get a sys_utime implementation. Since all the new
      architectures only want utimensat(), moving all the legacy entry points
      into a common __ARCH_WANT_SYS_UTIME guard simplifies the logic. Only alpha
      and ia64 grow a tiny bit as they now also get an unused sys_utime(),
      but it didn't seem worth the extra complexity of adding yet another
      ifdef for those.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      185cfaf7
    • A
      y2038: Change sys_utimensat() to use __kernel_timespec · a4f7a300
      Arnd Bergmann 提交于
      When 32-bit architectures get changed to support 64-bit time_t,
      utimensat() needs to use the new __kernel_timespec structure as its
      argument.
      
      The older utime(), utimes() and futimesat() system calls don't need a
      corresponding change as they are no longer used on C libraries that have
      64-bit time support.
      
      As we do for the other syscalls that have timespec arguments, we reuse
      the 'compat' syscall entry points to implement the traditional four
      interfaces, and only leave the new utimensat() as a native handler,
      so that the same code gets used on both 32-bit and 64-bit kernels
      on each syscall.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      a4f7a300
    • A
      asm-generic: Move common compat types to asm-generic/compat.h · fb373975
      Arnd Bergmann 提交于
      While converting compat system call handlers to work on 32-bit
      architectures, I found a number of types used in those handlers
      that are identical between all architectures.
      
      Let's move all the identical ones into asm-generic/compat.h to avoid
      having to add even more identical definitions of those types.
      
      For unknown reasons, mips defines __compat_gid32_t, __compat_uid32_t
      and compat_caddr_t as signed, while all others have them unsigned.
      This seems to be a mistake, but I'm leaving it alone here. The other
      types all differ by size or alignment on at least on architecture.
      
      compat_aio_context_t is currently defined in linux/compat.h but
      also needed for compat_sys_io_getevents(), so let's move it into
      the same place.
      
      While we still have not decided whether the 32-bit time handling
      will always use the compat syscalls, or in which form, I think this
      is a useful cleanup that we can merge regardless.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      fb373975
  2. 27 8月, 2018 3 次提交
    • A
      y2038: globally rename compat_time to old_time32 · 9afc5eee
      Arnd Bergmann 提交于
      Christoph Hellwig suggested a slightly different path for handling
      backwards compatibility with the 32-bit time_t based system calls:
      
      Rather than simply reusing the compat_sys_* entry points on 32-bit
      architectures unchanged, we get rid of those entry points and the
      compat_time types by renaming them to something that makes more sense
      on 32-bit architectures (which don't have a compat mode otherwise),
      and then share the entry points under the new name with the 64-bit
      architectures that use them for implementing the compatibility.
      
      The following types and interfaces are renamed here, and moved
      from linux/compat_time.h to linux/time32.h:
      
      old				new
      ---				---
      compat_time_t			old_time32_t
      struct compat_timeval		struct old_timeval32
      struct compat_timespec		struct old_timespec32
      struct compat_itimerspec	struct old_itimerspec32
      ns_to_compat_timeval()		ns_to_old_timeval32()
      get_compat_itimerspec64()	get_old_itimerspec32()
      put_compat_itimerspec64()	put_old_itimerspec32()
      compat_get_timespec64()		get_old_timespec32()
      compat_put_timespec64()		put_old_timespec32()
      
      As we already have aliases in place, this patch addresses only the
      instances that are relevant to the system call interface in particular,
      not those that occur in device drivers and other modules. Those
      will get handled separately, while providing the 64-bit version
      of the respective interfaces.
      
      I'm not renaming the timex, rusage and itimerval structures, as we are
      still debating what the new interface will look like, and whether we
      will need a replacement at all.
      
      This also doesn't change the names of the syscall entry points, which can
      be done more easily when we actually switch over the 32-bit architectures
      to use them, at that point we need to change COMPAT_SYSCALL_DEFINEx to
      SYSCALL_DEFINEx with a new name, e.g. with a _time32 suffix.
      Suggested-by: NChristoph Hellwig <hch@infradead.org>
      Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      9afc5eee
    • A
      y2038: make do_gettimeofday() and get_seconds() inline · 33e26418
      Arnd Bergmann 提交于
      get_seconds() and do_gettimeofday() are only used by a few modules now any
      more (waiting for the respective patches to get accepted), and they are
      among the last holdouts of code that is not y2038 safe in the core kernel.
      
      Move the implementation into the timekeeping32.h header to clean up
      the core kernel and isolate the old interfaces further.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      33e26418
    • A
      y2038: remove unused time interfaces · 97651640
      Arnd Bergmann 提交于
      After many small patches, at least some of the deprecated interfaces
      have no remaining users any more and can be removed:
      
        current_kernel_time
        do_settimeofday
        get_monotonic_boottime
        get_monotonic_boottime64
        get_monotonic_coarse
        get_monotonic_coarse64
        getrawmonotonic64
        ktime_get_real_ts
        timekeeping_clocktai
        timespec_trunc
        timespec_valid_strict
        time_to_tm
      
      For many of the remaining time functions, we are missing one or
      two patches that failed to make it into 4.19, they will be removed
      in the following merge window.
      
      The replacement functions for the removed interfaces are documented in
      Documentation/core-api/timekeeping.rst.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      97651640
  3. 24 8月, 2018 6 次提交
  4. 23 8月, 2018 27 次提交