14 Jan, 2020

3 commits

  • clock_nanosleep() accepts absolute values of expiration time, if the
    TIMER_ABSTIME flag is set. This value is in the tasks time namespace,
    which has to be converted to the host time namespace.

    Co-developed-by: Dmitry Safonov
    Signed-off-by: Andrei Vagin
    Signed-off-by: Dmitry Safonov
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20191112012724.250792-18-dima@arista.com

    Andrei Vagin
     
  • clock_nanosleep() accepts absolute values of expiration time when
    TIMER_ABSTIME flag is set. This absolute value is inside the task's
    time namespace, and has to be converted to the host's time.

    There is timens_ktime_to_host() helper for converting time, but
    it accepts ktime argument.

    As a preparation, make hrtimer_nanosleep() accept a clock value in ktime
    instead of timespec64.

    Co-developed-by: Dmitry Safonov
    Signed-off-by: Andrei Vagin
    Signed-off-by: Dmitry Safonov
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20191112012724.250792-17-dima@arista.com

    Andrei Vagin
     
  • Adjust monotonic and boottime clocks with per-timens offsets. As the
    result a process inside time namespace will see timers and clocks corrected
    to offsets that were set when the namespace was created

    Note that applications usually go through vDSO to get time, which is not
    yet adjusted. Further changes will complete time namespace virtualisation
    with vDSO support.

    Co-developed-by: Dmitry Safonov
    Signed-off-by: Andrei Vagin
    Signed-off-by: Dmitry Safonov
    Signed-off-by: Thomas Gleixner
    Link: https://lore.kernel.org/r/20191112012724.250792-12-dima@arista.com

    Andrei Vagin
     

10 Jan, 2020

1 commit

  • Using compat_sys_getitimer and compat_sys_setitimer on alpha
    causes a link failure in the Alpha tinyconfig and other configurations
    that turn off CONFIG_POSIX_TIMERS.

    Use the same #ifdef check for the stub version as well.

    Fixes: 4c22ea2b9120 ("y2038: use compat_{get,set}_itimer on alpha")
    Reported-by: Guenter Roeck
    Reported-by: kbuild test robot
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Thomas Gleixner
    Tested-by: Guenter Roeck
    Link: https://lore.kernel.org/r/20191207191043.656328-1-arnd@arndb.de

    Arnd Bergmann
     

07 Feb, 2019

1 commit

  • A lot of system calls that pass a time_t somewhere have an implementation
    using a COMPAT_SYSCALL_DEFINEx() on 64-bit architectures, and have
    been reworked so that this implementation can now be used on 32-bit
    architectures as well.

    The missing step is to redefine them using the regular SYSCALL_DEFINEx()
    to get them out of the compat namespace and make it possible to build them
    on 32-bit architectures.

    Any system call that ends in 'time' gets a '32' suffix on its name for
    that version, while the others get a '_time32' suffix, to distinguish
    them from the normal version, which takes a 64-bit time argument in the
    future.

    In this step, only 64-bit architectures are changed, doing this rename
    first lets us avoid touching the 32-bit architectures twice.

    Acked-by: Catalin Marinas
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

23 Nov, 2018

2 commits

  • The SPDX identifier defines the license of the file already. No need for
    the boilerplate.

    Signed-off-by: Thomas Gleixner
    Acked-by: Nicolas Pitre
    Acked-by: Kees Cook
    Acked-by: Ingo Molnar
    Acked-by: John Stultz
    Acked-by: Corey Minyard
    Cc: Peter Zijlstra
    Cc: Kate Stewart
    Cc: Philippe Ombredanne
    Cc: Peter Anvin
    Cc: Russell King
    Cc: Richard Cochran
    Cc: "Paul E. McKenney"
    Cc: David Riley
    Cc: Colin Cross
    Cc: Mark Brown
    Cc: Arnd Bergmann
    Link: https://lkml.kernel.org/r/20181031182253.215825217@linutronix.de

    Thomas Gleixner
     
  • Update the time(r) core files files with the correct SPDX license
    identifier based on the license text in the file itself. The SPDX
    identifier is a legally binding shorthand, which can be used instead of the
    full boiler plate text.

    This work is based on a script and data from Philippe Ombredanne, Kate
    Stewart and myself. The data has been created with two independent license
    scanners and manual inspection.

    The following files do not contain any direct license information and have
    been omitted from the big initial SPDX changes:

    timeconst.bc: The .bc files were not touched
    time.c, timer.c, timekeeping.c: Licence was deduced from EXPORT_SYMBOL_GPL

    As those files do not contain direct license references they fall under the
    project license, i.e. GPL V2 only.

    Signed-off-by: Thomas Gleixner
    Acked-by: Kees Cook
    Acked-by: Ingo Molnar
    Acked-by: John Stultz
    Acked-by: Corey Minyard
    Cc: Peter Zijlstra
    Cc: Kate Stewart
    Cc: Philippe Ombredanne
    Cc: Russell King
    Cc: Richard Cochran
    Cc: Nicolas Pitre
    Cc: David Riley
    Cc: Colin Cross
    Cc: Mark Brown
    Cc: H. Peter Anvin
    Cc: Paul E. McKenney
    Link: https://lkml.kernel.org/r/20181031182252.879109557@linutronix.de

    Thomas Gleixner
     

27 Aug, 2018

1 commit

  • 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: Christoph Hellwig
    Link: https://lore.kernel.org/lkml/20180705222110.GA5698@infradead.org/
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

19 Jun, 2018

1 commit

  • Some of the oddly named time accessor functions now have a more consistent
    naming, which should be used from now on so the aliases can be removed.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Thomas Gleixner
    Cc: y2038@lists.linaro.org
    Cc: Deepa Dinamani
    Cc: "Eric W. Biederman"
    Link: https://lkml.kernel.org/r/20180618143246.3865099-1-arnd@arndb.de

    Arnd Bergmann
     

02 May, 2018

1 commit


26 Apr, 2018

1 commit

  • Revert commits

    92af4dcb4e1c ("tracing: Unify the "boot" and "mono" tracing clocks")
    127bfa5f4342 ("hrtimer: Unify MONOTONIC and BOOTTIME clock behavior")
    7250a4047aa6 ("posix-timers: Unify MONOTONIC and BOOTTIME clock behavior")
    d6c7270e913d ("timekeeping: Remove boot time specific code")
    f2d6fdbfd238 ("Input: Evdev - unify MONOTONIC and BOOTTIME clock behavior")
    d6ed449afdb3 ("timekeeping: Make the MONOTONIC clock behave like the BOOTTIME clock")
    72199320d49d ("timekeeping: Add the new CLOCK_MONOTONIC_ACTIVE clock")

    As stated in the pull request for the unification of CLOCK_MONOTONIC and
    CLOCK_BOOTTIME, it was clear that we might have to revert the change.

    As reported by several folks systemd and other applications rely on the
    documented behaviour of CLOCK_MONOTONIC on Linux and break with the above
    changes. After resume daemons time out and other timeout related issues are
    observed. Rafael compiled this list:

    * systemd kills daemons on resume, after >WatchdogSec seconds
    of suspending (Genki Sky). [Verified that that's because systemd uses
    CLOCK_MONOTONIC and expects it to not include the suspend time.]

    * systemd-journald misbehaves after resume:
    systemd-journald[7266]: File /var/log/journal/016627c3c4784cd4812d4b7e96a34226/system.journal
    corrupted or uncleanly shut down, renaming and replacing.
    (Mike Galbraith).

    * NetworkManager reports "networking disabled" and networking is broken
    after resume 50% of the time (Pavel). [May be because of systemd.]

    * MATE desktop dims the display and starts the screensaver right after
    system resume (Pavel).

    * Full system hang during resume (me). [May be due to systemd or NM or both.]

    That happens on debian and open suse systems.

    It's sad, that these problems were neither catched in -next nor by those
    folks who expressed interest in this change.

    Reported-by: Rafael J. Wysocki
    Reported-by: Genki Sky ,
    Reported-by: Pavel Machek
    Signed-off-by: Thomas Gleixner
    Cc: Dmitry Torokhov
    Cc: John Stultz
    Cc: Jonathan Corbet
    Cc: Kevin Easton
    Cc: Linus Torvalds
    Cc: Mark Salyzyn
    Cc: Michael Kerrisk
    Cc: Peter Zijlstra
    Cc: Petr Mladek
    Cc: Prarit Bhargava
    Cc: Sergey Senozhatsky
    Cc: Steven Rostedt

    Thomas Gleixner
     

19 Apr, 2018

3 commits

  • Change over clock_nanosleep syscalls to use y2038 safe
    __kernel_timespec times. This will enable changing over
    of these syscalls to use new y2038 safe syscalls when
    the architectures define the CONFIG_64BIT_TIME.

    Note that nanosleep syscall is deprecated and does not have a
    plan for making it y2038 safe. But, the syscall should work as
    before on 64 bit machines and on 32 bit machines, the syscall
    works correctly until y2038 as before using the existing compat
    syscall version. There is no new syscall for supporting 64 bit
    time_t on 32 bit architectures.

    Cc: linux-api@vger.kernel.org
    Signed-off-by: Deepa Dinamani
    Signed-off-by: Arnd Bergmann

    Deepa Dinamani
     
  • Change over clock_settime, clock_gettime and clock_getres
    syscalls to use __kernel_timespec times. This will enable
    changing over of these syscalls to use new y2038 safe syscalls
    when the architectures define the CONFIG_64BIT_TIME.

    Cc: linux-api@vger.kernel.org
    Signed-off-by: Deepa Dinamani
    Signed-off-by: Arnd Bergmann

    Deepa Dinamani
     
  • clock_gettime, clock_settime, clock_getres and clock_nanosleep
    compat syscalls are also repurposed to provide backward compatibility
    to support 32 bit time_t on 32 bit systems.

    Note that nanosleep compat syscall will also be treated the same way
    as the above syscalls as it shares common handler functions with
    clock_nanosleep. But, there is no plan to provide y2038 safe solution
    for nanosleep.

    Signed-off-by: Deepa Dinamani
    Signed-off-by: Arnd Bergmann

    Deepa Dinamani
     

16 Apr, 2018

1 commit

  • Pull x86 fixes from Thomas Gleixner:
    "A set of fixes and updates for x86:

    - Address a swiotlb regression which was caused by the recent DMA
    rework and made driver fail because dma_direct_supported() returned
    false

    - Fix a signedness bug in the APIC ID validation which caused invalid
    APIC IDs to be detected as valid thereby bloating the CPU possible
    space.

    - Fix inconsisten config dependcy/select magic for the MFD_CS5535
    driver.

    - Fix a corruption of the physical address space bits when encryption
    has reduced the address space and late cpuinfo updates overwrite
    the reduced bit information with the original value.

    - Dominiks syscall rework which consolidates the architecture
    specific syscall functions so all syscalls can be wrapped with the
    same macros. This allows to switch x86/64 to struct pt_regs based
    syscalls. Extend the clearing of user space controlled registers in
    the entry patch to the lower registers"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/apic: Fix signedness bug in APIC ID validity checks
    x86/cpu: Prevent cpuinfo_x86::x86_phys_bits adjustment corruption
    x86/olpc: Fix inconsistent MFD_CS5535 configuration
    swiotlb: Use dma_direct_supported() for swiotlb_ops
    syscalls/x86: Adapt syscall_wrapper.h to the new syscall stub naming convention
    syscalls/core, syscalls/x86: Rename struct pt_regs-based sys_*() to __x64_sys_*()
    syscalls/core, syscalls/x86: Clean up compat syscall stub naming convention
    syscalls/core, syscalls/x86: Clean up syscall stub naming convention
    syscalls/x86: Extend register clearing on syscall entry to lower registers
    syscalls/x86: Unconditionally enable 'struct pt_regs' based syscalls on x86_64
    syscalls/x86: Use 'struct pt_regs' based syscall calling for IA32_EMULATION and x32
    syscalls/core: Prepare CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y for compat syscalls
    syscalls/x86: Use 'struct pt_regs' based syscall calling convention for 64-bit syscalls
    syscalls/core: Introduce CONFIG_ARCH_HAS_SYSCALL_WRAPPER=y
    x86/syscalls: Don't pointlessly reload the system call number
    x86/mm: Fix documentation of module mapping range with 4-level paging
    x86/cpuid: Switch to 'static const' specifier

    Linus Torvalds
     

05 Apr, 2018

1 commit

  • It may be useful for an architecture to override the definitions of the
    COMPAT_SYSCALL_DEFINE0() and __COMPAT_SYSCALL_DEFINEx() macros in
    , in particular to use a different calling convention
    for syscalls. This patch provides a mechanism to do so, based on the
    previously introduced CONFIG_ARCH_HAS_SYSCALL_WRAPPER. If it is enabled,
    is included in and may be used
    to define the macros mentioned above. Moreover, as the syscall calling
    convention may be different if CONFIG_ARCH_HAS_SYSCALL_WRAPPER is set,
    the compat syscall function prototypes in are #ifndef'd
    out in that case.

    As some of the syscalls and/or compat syscalls may not be present,
    the COND_SYSCALL() and COND_SYSCALL_COMPAT() macros in kernel/sys_ni.c
    as well as the SYS_NI() and COMPAT_SYS_NI() macros in
    kernel/time/posix-stubs.c can be re-defined in iff
    CONFIG_ARCH_HAS_SYSCALL_WRAPPER is enabled.

    Signed-off-by: Dominik Brodowski
    Acked-by: Linus Torvalds
    Cc: Al Viro
    Cc: Andrew Morton
    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Denys Vlasenko
    Cc: H. Peter Anvin
    Cc: Josh Poimboeuf
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/20180405095307.3730-5-linux@dominikbrodowski.net
    Signed-off-by: Ingo Molnar

    Dominik Brodowski
     

13 Mar, 2018

1 commit

  • The planned change to unify the behaviour of the MONOTONIC and BOOTTIME
    clocks vs. suspend removes the ability to retrieve the active
    non-suspended time of a system.

    Provide a new CLOCK_MONOTONIC_ACTIVE clock which returns the active
    non-suspended time of the system via clock_gettime().

    This preserves the old behaviour of CLOCK_MONOTONIC before the
    BOOTTIME/MONOTONIC unification.

    This new clock also allows applications to detect programmatically that
    the MONOTONIC and BOOTTIME clocks are identical.

    Signed-off-by: Thomas Gleixner
    Cc: Dmitry Torokhov
    Cc: John Stultz
    Cc: Jonathan Corbet
    Cc: Kevin Easton
    Cc: Linus Torvalds
    Cc: Mark Salyzyn
    Cc: Michael Kerrisk
    Cc: Peter Zijlstra
    Cc: Petr Mladek
    Cc: Prarit Bhargava
    Cc: Sergey Senozhatsky
    Cc: Steven Rostedt
    Link: http://lkml.kernel.org/r/20180301165149.965235774@linutronix.de
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

17 Oct, 2017

1 commit

  • This is a follow-up to commit 5c4994102fb5 ("posix-timers: Use
    get_timespec64() and put_timespec64()"), which left two system call using
    copy_from_user()/copy_to_user().

    Change them as well for consistency.

    Signed-off-by: Arnd Bergmann
    Signed-off-by: Thomas Gleixner
    Acked-by: Nicolas Pitre
    Cc: y2038@lists.linaro.org
    Cc: John Stultz
    Cc: Al Viro
    Cc: Deepa Dinamani
    Link: https://lkml.kernel.org/r/20171013183009.3442318-1-arnd@arndb.de

    Arnd Bergmann
     

30 Jun, 2017

1 commit

  • Usage of these apis and their compat versions makes
    the syscalls: clock_gettime, clock_settime, clock_getres
    and their compat implementations simpler.

    This is a preparatory patch to isolate data conversions to
    struct timespec64 at userspace boundaries. This helps contain
    the changes needed to transition to new y2038 safe types.

    Signed-off-by: Deepa Dinamani
    Signed-off-by: Al Viro

    Deepa Dinamani
     

26 Jun, 2017

1 commit


14 Jun, 2017

8 commits


15 Apr, 2017

3 commits

  • struct timespec is not y2038 safe on 32 bit machines. Replace uses of
    struct timespec with struct timespec64 in the kernel.

    The syscall interfaces themselves will be changed in a separate series.

    Note that the restart_block parameter for nanosleep has also been left
    unchanged and will be part of syscall series noted above.

    Signed-off-by: Deepa Dinamani
    Cc: y2038@lists.linaro.org
    Cc: john.stultz@linaro.org
    Cc: arnd@arndb.de
    Link: http://lkml.kernel.org/r/1490555058-4603-8-git-send-email-deepa.kernel@gmail.com
    Signed-off-by: Thomas Gleixner

    Deepa Dinamani
     
  • struct timespec is not y2038 safe on 32 bit machines. Replace uses of
    struct timespec with struct timespec64 in the kernel.

    The syscall interfaces themselves will be changed in a separate series.

    Signed-off-by: Deepa Dinamani
    Cc: y2038@lists.linaro.org
    Cc: john.stultz@linaro.org
    Cc: arnd@arndb.de
    Link: http://lkml.kernel.org/r/1490555058-4603-4-git-send-email-deepa.kernel@gmail.com
    Signed-off-by: Thomas Gleixner

    Deepa Dinamani
     
  • struct timespec is not y2038 safe on 32 bit machines and needs to be
    replaced with struct timespec64.

    do_sys_timeofday() is just a wrapper function. Replace all calls to this
    function with direct calls to do_sys_timeofday64() instead and delete
    do_sys_timeofday().

    Signed-off-by: Deepa Dinamani
    Cc: y2038@lists.linaro.org
    Cc: john.stultz@linaro.org
    Cc: arnd@arndb.de
    Cc: linux-alpha@vger.kernel.org
    Link: http://lkml.kernel.org/r/1490555058-4603-2-git-send-email-deepa.kernel@gmail.com
    Signed-off-by: Thomas Gleixner

    Deepa Dinamani
     

16 Nov, 2016

1 commit

  • Some embedded systems have no use for them. This removes about
    25KB from the kernel binary size when configured out.

    Corresponding syscalls are routed to a stub logging the attempt to
    use those syscalls which should be enough of a clue if they were
    disabled without proper consideration. They are: timer_create,
    timer_gettime: timer_getoverrun, timer_settime, timer_delete,
    clock_adjtime, setitimer, getitimer, alarm.

    The clock_settime, clock_gettime, clock_getres and clock_nanosleep
    syscalls are replaced by simple wrappers compatible with CLOCK_REALTIME,
    CLOCK_MONOTONIC and CLOCK_BOOTTIME only which should cover the vast
    majority of use cases with very little code.

    Signed-off-by: Nicolas Pitre
    Acked-by: Richard Cochran
    Acked-by: Thomas Gleixner
    Acked-by: John Stultz
    Reviewed-by: Josh Triplett
    Cc: Paul Bolle
    Cc: linux-kbuild@vger.kernel.org
    Cc: netdev@vger.kernel.org
    Cc: Michal Marek
    Cc: Edward Cree
    Link: http://lkml.kernel.org/r/1478841010-28605-7-git-send-email-nicolas.pitre@linaro.org
    Signed-off-by: Thomas Gleixner

    Nicolas Pitre