24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

18 Feb, 2020

1 commit

  • head is traversed using hlist_for_each_entry_rcu outside an RCU read-side
    critical section but under the protection of hash_lock.

    Hence, add corresponding lockdep expression to silence false-positive
    lockdep warnings, and harden RCU lists.

    [ tglx: Removed the macro and put the condition right where it's used ]

    Signed-off-by: Amol Grover
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20200216074330.GA14025@workstation-portable

    Amol Grover
     

14 Jan, 2020

8 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
     
  • Wire timer_settime() syscall into time namespace virtualization.

    sys_timer_settime() calls the ktime->timer_set() callback. Right now,
    common_timer_set() is the only implementation for the callback.

    The user-supplied expiry value is converted from timespec64 to ktime and
    then timens_ktime_to_host() can be used to convert namespace's time to the
    host time.

    Inside a time namespace kernel's time differs by a fixed offset from a
    user-supplied time, but only absolute values (TIMER_ABSTIME) must be
    converted.

    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-15-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
     
  • Now, when the clock_get_ktime() callback exists, the suboptimal
    timespec64-based conversion can be removed from common_timer_get().

    Suggested-by: Thomas Gleixner
    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-11-dima@arista.com

    Andrei Vagin
     
  • The callsite in common_timer_get() has already a comment:
    /*
    * The timespec64 based conversion is suboptimal, but it's not
    * worth to implement yet another callback.
    */
    kc->clock_get(timr->it_clock, &ts64);
    now = timespec64_to_ktime(ts64);

    The upcoming support for time namespaces requires to have access to:

    - The time in a task's time namespace for sys_clock_gettime()
    - The time in the root name space for common_timer_get()

    That adds a valid reason to finally implement a separate callback which
    returns the time in ktime_t format.

    Suggested-by: Thomas Gleixner
    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-10-dima@arista.com

    Andrei Vagin
     
  • The upcoming support for time namespaces requires to have access to:

    - The time in a task's time namespace for sys_clock_gettime()
    - The time in the root name space for common_timer_get()

    That adds a valid reason to finally implement a separate callback which
    returns the time in ktime_t format in (struct k_clock).

    As a preparation ground for introducing clock_get_ktime(), the original
    callback clock_get() was renamed into clock_get_timespec().
    Reflect the renaming into the callback implementations.

    Suggested-by: Thomas Gleixner
    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-7-dima@arista.com

    Andrei Vagin
     
  • The upcoming support for time namespaces requires to have access to:

    - The time in a task's time namespace for sys_clock_gettime()
    - The time in the root name space for common_timer_get()

    That adds a valid reason to finally implement a separate callback which
    returns the time in ktime_t format, rather than in (struct timespec).

    Rename the clock_get() callback to clock_get_timespec() as a preparation
    for introducing clock_get_ktime().

    Suggested-by: Thomas Gleixner
    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-6-dima@arista.com

    Andrei Vagin
     

21 Aug, 2019

2 commits

  • The handling of a priority inversion between timer cancelling and a a not
    well defined possible preemption of softirq kthread is not very clear.

    Especially in the posix timers side it's unclear why there is a specific RT
    wait callback.

    All the nice explanations can be found in the initial changelog of
    f61eff83cec9 (hrtimer: Prepare support for PREEMPT_RT").

    Extract the detailed informations from there and put it into comments.

    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190820132656.GC2093@lenoir

    Frederic Weisbecker
     
  • Posix timer delete retry loops are affected by the same priority inversion
    and live lock issues as the other timers.

    Provide a RT specific synchronization function which keeps a reference to
    the timer by holding rcu read lock to prevent the timer from being freed,
    dropping the timer lock and invoking the timer specific wait function via a
    new callback.

    This does not yet cover posix CPU timers because they need more special
    treatment on PREEMPT_RT.

    [ This is folded into the original attempt which did not use a callback. ]

    Originally-by: Anna-Maria Gleixenr
    Signed-off-by: Thomas Gleixner
    Reviewed-by: Frederic Weisbecker
    Link: https://lkml.kernel.org/r/20190819143801.656864506@linutronix.de

    Thomas Gleixner
     

02 Aug, 2019

3 commits

  • Timer deletion on PREEMPT_RT is prone to priority inversion and live
    locks. The hrtimer code has a synchronization mechanism for this. Posix CPU
    timers will grow one.

    But that mechanism cannot be invoked while holding the k_itimer lock
    because that can deadlock against the running timer callback. So the lock
    must be dropped which allows the timer to be freed.

    The timer free can be prevented by taking RCU readlock before dropping the
    lock, but because the rcu_head is part of the 'it' union a concurrent free
    will overwrite the hrtimer on which the task is trying to synchronize.

    Move the rcu_head out of the union to prevent this.

    [ tglx: Fixed up kernel-doc. Rewrote changelog ]

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20190730223828.965541887@linutronix.de

    Sebastian Andrzej Siewior
     
  • As a preparatory step for adding the PREEMPT RT specific synchronization
    mechanism to wait for a running timer callback, rework the timer cancel
    retry loops so they call a common function. This allows trivial
    substitution in one place.

    Originally-by: Anna-Maria Gleixner
    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20190730223828.874901027@linutronix.de

    Thomas Gleixner
     
  • do_timer_settime() has a 'flags' argument and uses 'flag' for the interrupt
    flags, which is confusing at best.

    Rename the argument so 'flags' can be used for interrupt flags as usual.

    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r/20190730223828.782664411@linutronix.de

    Thomas Gleixner
     

22 Jun, 2019

2 commits

  • itimer_delete() uses spin_lock_irqsave() to obtain a `flags' variable
    which can then be passed to unlock_timer(). It uses already spin_lock
    locking for the structure instead of lock_timer() because it has a timer
    which can not be removed by others at this point. The cleanup is always
    performed with enabled interrupts.

    Use spin_lock_irq() / spin_unlock_irq() so the `flags' variable can be
    removed.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190621143643.25649-3-bigeasy@linutronix.de

    Sebastian Andrzej Siewior
     
  • itimer_delete() is invoked during do_exit(). At this point it is the
    last thread in the group dying and doing the clean up.
    Since it is the last thread in the group, there can not be any other
    task attempting to lock the itimer which means the NULL assignment (which
    avoids lookups in __lock_timer()) is not required.

    The assignment and comment was copied in commit 0e568881178ff ("[PATCH]
    fix posix-timers to have proper per-process scope") from
    sys_timer_delete() which was/is the syscall interface and requires the
    assignment.

    Remove the superfluous ->it_signal = NULL assignment.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Link: https://lkml.kernel.org/r/20190621143643.25649-2-bigeasy@linutronix.de

    Sebastian Andrzej Siewior
     

07 Feb, 2019

5 commits

  • 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
     
  • struct timex is not y2038 safe.
    Switch all the syscall apis to use y2038 safe __kernel_timex.

    Note that sys_adjtimex() does not have a y2038 safe solution. C libraries
    can implement it by calling clock_adjtime(CLOCK_REALTIME, ...).

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

    Deepa Dinamani
     
  • struct timex is not y2038 safe.
    Replace all uses of timex with y2038 safe __kernel_timex.

    Note that struct __kernel_timex is an ABI interface definition.
    We could define a new structure based on __kernel_timex that
    is only available internally instead. Right now, there isn't
    a strong motivation for this as the structure is isolated to
    a few defined struct timex interfaces and such a structure would
    be exactly the same as struct timex.

    The patch was generated by the following coccinelle script:

    virtual patch

    @depends on patch forall@
    identifier ts;
    expression e;
    @@
    (
    - struct timex ts;
    + struct __kernel_timex ts;
    |
    - struct timex ts = {};
    + struct __kernel_timex ts = {};
    |
    - struct timex ts = e;
    + struct __kernel_timex ts = e;
    |
    - struct timex *ts;
    + struct __kernel_timex *ts;
    |
    (memset \| copy_from_user \| copy_to_user \)(...,
    - sizeof(struct timex))
    + sizeof(struct __kernel_timex))
    )

    @depends on patch forall@
    identifier ts;
    identifier fn;
    @@
    fn(...,
    - struct timex *ts,
    + struct __kernel_timex *ts,
    ...) {
    ...
    }

    @depends on patch forall@
    identifier ts;
    identifier fn;
    @@
    fn(...,
    - struct timex *ts) {
    + struct __kernel_timex *ts) {
    ...
    }

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

    Deepa Dinamani
     
  • sparc64 is the only architecture on Linux that has a 'timeval'
    definition with a 32-bit tv_usec but a 64-bit tv_sec. This causes
    problems for sparc32 compat mode when we convert it to use the
    new __kernel_timex type that has the same layout as all other
    64-bit architectures.

    To avoid adding sparc64 specific code into the generic adjtimex
    implementation, this adds a wrapper in the sparc64 system call handling
    that converts the sparc64 'timex' into the new '__kernel_timex'.

    At this point, the two structures are defined to be identical,
    but that will change in the next step once we convert sparc32.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • We want to reuse the compat_timex handling on 32-bit architectures the
    same way we are using the compat handling for timespec when moving to
    64-bit time_t.

    Move all definitions related to compat_timex out of the compat code
    into the normal timekeeping code, along with a rename to old_timex32,
    corresponding to the timespec/timeval structures, and make it controlled
    by CONFIG_COMPAT_32BIT_TIME, which 32-bit architectures will then select.

    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

26 Dec, 2018

1 commit

  • Pull timer updates from Thomas Gleixner:
    "The timer department delivers the following christmas presents:

    Core code:

    - Use proper seqcount initializer to make lockdep happy

    - SPDX annotations and cleanup of license boilerplates

    - Use DEFINE_SHOW_ATTRIBUTE() instead of open coding it

    - Minor cleanups

    Driver code:

    - Add the sched_clock for the arc timer (Alexey Brodkin)

    - Change the file timer names for riscv, rockchip, tegra20, sun4i and
    meson6 (Daniel Lezcano)

    - Add the DT bindings for r8a7796, r8a77470 and r8a774a1 (Biju Das)

    - Remove the early platform driver registration for timer-ti-dm
    (Bartosz Golaszewski)

    - Provide the sched_clock for the riscv timer (Anup Patel)

    - Add support for ARM64 for the imx-gpt and convert the imx-tpm to
    the timer-of API (Anson Huang)

    - Remove useless irq protection for the imx-gpt (Clément Péron)

    - Remove a duplicate function name for the vt8500 (Dan Carpenter)

    - Remove obsolete inclusion of for the tegra20 (Geert
    Uytterhoeven)

    - Demote the prcmu and the custom sched_clock for the dbx500 and the
    ux500 (Linus Walleij)

    - Add a new timer clock for the RDA8810PL (Manivannan Sadhasivam)

    - Rename the macro to stick to the register name and add the delay
    timer (Martin Blumenstingl)

    - Switch the bcm2835 to the SPDX identifier (Stefan Wahren)

    - Fix the interrupt register access on the fttmr010 (Tao Ren)

    - Add missing of_node_put in the initialization path on the
    integrator-ap (Yangtao Li)"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (39 commits)
    dt-bindings: timer: Document RDA8810PL SoC timer
    clocksource/drivers/rda: Add clock driver for RDA8810PL SoC
    clocksource/drivers/meson6: Change name meson6_timer timer-meson6
    clocksource/drivers/sun4i: Change name sun4i_timer to timer-sun4i
    clocksource/drivers/tegra20: Change name tegra20_timer to timer-tegra20
    clocksource/drivers/rockchip: Change name rockchip_timer to timer-rockchip
    clocksource/drivers/riscv: Change name riscv_timer to timer-riscv
    clocksource/drivers/riscv_timer: Provide the sched_clock
    clocksource/drivers/timer-imx-tpm: Specify clock name for timer-of
    clocksource/drivers/fttmr010: Fix invalid interrupt register access
    clocksource/drivers/integrator-ap: Add missing of_node_put()
    clocksource/drivers/bcm2835: Switch to SPDX identifier
    dt-bindings: timer: renesas, cmt: Document r8a774a1 CMT support
    clocksource/drivers/timer-imx-tpm: Convert the driver to timer-of
    clocksource/drivers/arc_timer: Utilize generic sched_clock
    dt-bindings: timer: renesas, cmt: Document r8a77470 CMT support
    dt-bindings: timer: renesas, cmt: Document r8a7796 CMT support
    clocksource/drivers/imx-gpt: Remove unnecessary irq protection
    clocksource/drivers/imx-gpt: Add support for ARM64
    clocksource/drivers/meson6_timer: Implement the ARM delay timer
    ...

    Linus Torvalds
     

18 Dec, 2018

1 commit

  • The signal delivery path of posix-timers can try to rearm the timer even if
    the interval is zero. That's handled for the common case (hrtimer) but not
    for alarm timers. In that case the forwarding function raises a division by
    zero exception.

    The handling for hrtimer based posix timers is wrong because it marks the
    timer as active despite the fact that it is stopped.

    Move the check from common_hrtimer_rearm() to posixtimer_rearm() to cure
    both issues.

    Reported-by: syzbot+9d38bedac9cc77b8ad5e@syzkaller.appspotmail.com
    Signed-off-by: Thomas Gleixner
    Cc: John Stultz
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: sboyd@kernel.org
    Cc: stable@vger.kernel.org
    Cc: syzkaller-bugs@googlegroups.com
    Link: http://lkml.kernel.org/r/alpine.DEB.2.21.1812171328050.1880@nanos.tec.linutronix.de
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

23 Nov, 2018

3 commits

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

    Remove also the completely outdated Montavista snail mail address.

    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: Peter Anvin
    Cc: Russell King
    Cc: Richard Cochran
    Cc: "Paul E. McKenney"
    Cc: Nicolas Pitre
    Cc: David Riley
    Cc: Colin Cross
    Cc: Mark Brown
    Link: https://lkml.kernel.org/r/20181031182253.479792883@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
     
  • Remove the pointless filenames in the top level comments. They have no
    value at all and just occupy space. While at it tidy up some of the
    comments and remove a stale one.

    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
    Link: https://lkml.kernel.org/r/20181031182252.794898238@linutronix.de

    Thomas Gleixner
     

26 Oct, 2018

1 commit

  • Pull timekeeping updates from Thomas Gleixner:
    "The timers and timekeeping departement provides:

    - Another large y2038 update with further preparations for providing
    the y2038 safe timespecs closer to the syscalls.

    - An overhaul of the SHCMT clocksource driver

    - SPDX license identifier updates

    - Small cleanups and fixes all over the place"

    * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits)
    tick/sched : Remove redundant cpu_online() check
    clocksource/drivers/dw_apb: Add reset control
    clocksource: Remove obsolete CLOCKSOURCE_OF_DECLARE
    clocksource/drivers: Unify the names to timer-* format
    clocksource/drivers/sh_cmt: Add R-Car gen3 support
    dt-bindings: timer: renesas: cmt: document R-Car gen3 support
    clocksource/drivers/sh_cmt: Properly line-wrap sh_cmt_of_table[] initializer
    clocksource/drivers/sh_cmt: Fix clocksource width for 32-bit machines
    clocksource/drivers/sh_cmt: Fixup for 64-bit machines
    clocksource/drivers/sh_tmu: Convert to SPDX identifiers
    clocksource/drivers/sh_mtu2: Convert to SPDX identifiers
    clocksource/drivers/sh_cmt: Convert to SPDX identifiers
    clocksource/drivers/renesas-ostm: Convert to SPDX identifiers
    clocksource: Convert to using %pOFn instead of device_node.name
    tick/broadcast: Remove redundant check
    RISC-V: Request newstat syscalls
    y2038: signal: Change rt_sigtimedwait to use __kernel_timespec
    y2038: socket: Change recvmmsg to use __kernel_timespec
    y2038: sched: Change sched_rr_get_interval to use __kernel_timespec
    y2038: utimes: Rework #ifdef guards for compat syscalls
    ...

    Linus Torvalds
     

03 Oct, 2018

1 commit

  • Linus recently observed that if we did not worry about the padding
    member in struct siginfo it is only about 48 bytes, and 48 bytes is
    much nicer than 128 bytes for allocating on the stack and copying
    around in the kernel.

    The obvious thing of only adding the padding when userspace is
    including siginfo.h won't work as there are sigframe definitions in
    the kernel that embed struct siginfo.

    So split siginfo in two; kernel_siginfo and siginfo. Keeping the
    traditional name for the userspace definition. While the version that
    is used internally to the kernel and ultimately will not be padded to
    128 bytes is called kernel_siginfo.

    The definition of struct kernel_siginfo I have put in include/signal_types.h

    A set of buildtime checks has been added to verify the two structures have
    the same field offsets.

    To make it easy to verify the change kernel_siginfo retains the same
    size as siginfo. The reduction in size comes in a following change.

    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

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
     

22 Aug, 2018

1 commit

  • …iederm/user-namespace

    Pull core signal handling updates from Eric Biederman:
    "It was observed that a periodic timer in combination with a
    sufficiently expensive fork could prevent fork from every completing.
    This contains the changes to remove the need for that restart.

    This set of changes is split into several parts:

    - The first part makes PIDTYPE_TGID a proper pid type instead
    something only for very special cases. The part starts using
    PIDTYPE_TGID enough so that in __send_signal where signals are
    actually delivered we know if the signal is being sent to a a group
    of processes or just a single process.

    - With that prep work out of the way the logic in fork is modified so
    that fork logically makes signals received while it is running
    appear to be received after the fork completes"

    * 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (22 commits)
    signal: Don't send signals to tasks that don't exist
    signal: Don't restart fork when signals come in.
    fork: Have new threads join on-going signal group stops
    fork: Skip setting TIF_SIGPENDING in ptrace_init_task
    signal: Add calculate_sigpending()
    fork: Unconditionally exit if a fatal signal is pending
    fork: Move and describe why the code examines PIDNS_ADDING
    signal: Push pid type down into complete_signal.
    signal: Push pid type down into __send_signal
    signal: Push pid type down into send_signal
    signal: Pass pid type into do_send_sig_info
    signal: Pass pid type into send_sigio_to_task & send_sigurg_to_task
    signal: Pass pid type into group_send_sig_info
    signal: Pass pid and pid type into send_sigqueue
    posix-timers: Noralize good_sigevent
    signal: Use PIDTYPE_TGID to clearly store where file signals will be sent
    pid: Implement PIDTYPE_TGID
    pids: Move the pgrp and session pid pointers from task_struct to signal_struct
    kvm: Don't open code task_pid in kvm_vcpu_ioctl
    pids: Compute task_tgid using signal->leader_pid
    ...

    Linus Torvalds
     

14 Aug, 2018

1 commit

  • Pull parisc updates from Helge Deller:

    - parisc now uses the generic dma_noncoherent_ops implementation
    (Christoph Hellwig)

    - further memory barrier and spinlock improvements (John David Anglin)

    - prepare removal of current_text_addr() functions (Nick Desaulniers)

    - improve kernel stack unwinding on parisc (me)

    - drop ENOTSUP which was defined on parisc only (me)

    * 'parisc-4.19-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
    parisc: Fix and improve kernel stack unwinding
    parisc: Remove unnecessary barriers from spinlock.h
    parisc: Remove ordered stores from syscall.S
    parisc: prefer _THIS_IP_ and _RET_IP_ statement expressions
    parisc: Add HAVE_REGS_AND_STACK_ACCESS_API feature
    parisc: Drop architecture-specific ENOTSUP define
    parisc: use generic dma_noncoherent_ops
    parisc: always use flush_kernel_dcache_range for DMA cache maintainance
    parisc: merge pcx_dma_ops and pcxl_dma_ops

    Linus Torvalds
     

13 Aug, 2018

1 commit

  • parisc is the only Linux architecture which has defined a value for ENOTSUP.
    All other architectures #define ENOTSUP as EOPNOTSUPP in their libc headers.

    Having an own value for ENOTSUP which is different than EOPNOTSUPP often gives
    problems with userspace programs which expect both to be the same. One such
    example is a build error in the libuv package, as can be seen in
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=900237.

    Since we dropped HP-UX support, there is no real benefit in keeping an own
    value for ENOTSUP. This patch drops the parisc value for ENOTSUP from the
    kernel sources. glibc needs no patch, it reuses the exported headers.

    Signed-off-by: Helge Deller

    Helge Deller
     

21 Jul, 2018

2 commits

  • Make the code more maintainable by performing more of the signal
    related work in send_sigqueue.

    A quick inspection of do_timer_create will show that this code path
    does not lookup a thread group by a thread's pid. Making it safe
    to find the task pointed to by it_pid with "pid_task(it_pid, type)";

    This supports the changes needed in fork to tell if a signal was sent
    to a single process or a group of processes.

    Having the pid to task transition in signal.c will also make it easier
    to sort out races with de_thread and and the thread group leader
    exiting when it comes time to address that.

    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • In good_sigevent directly compute the default return value as
    "task_tgid(current)". This is exactly the same as
    "task_pid(current->group_leader)" but written more clearly.

    In the thread case first compute the thread's pid. Then veify that
    attached to that pid is a thread of the current thread group.

    This has the net effect of making the code a little clearer, and
    making it obvious that posix timers never look up a process by a the
    pid of a thread.

    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

02 Jul, 2018

2 commits

  • The posix timer overrun handling is broken because the forwarding functions
    can return a huge number of overruns which does not fit in an int. As a
    consequence timer_getoverrun(2) and siginfo::si_overrun can turn into
    random number generators.

    The k_clock::timer_forward() callbacks return a 64 bit value now. Make
    k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal
    accounting is correct. 3Remove the temporary (int) casts.

    Add a helper function which clamps the overrun value returned to user space
    via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value
    between 0 and INT_MAX. INT_MAX is an indicator for user space that the
    overrun value has been clamped.

    Reported-by: Team OWL337
    Signed-off-by: Thomas Gleixner
    Acked-by: John Stultz
    Cc: Peter Zijlstra
    Cc: Michael Kerrisk
    Link: https://lkml.kernel.org/r/20180626132705.018623573@linutronix.de

    Thomas Gleixner
     
  • The posix timer ti_overrun handling is broken because the forwarding
    functions can return a huge number of overruns which does not fit in an
    int. As a consequence timer_getoverrun(2) and siginfo::si_overrun can turn
    into random number generators.

    As a first step to address that let the timer_forward() callbacks return
    the full 64 bit value.

    Cast it to (int) temporarily until k_itimer::ti_overrun is converted to
    64bit and the conversion to user space visible values is sanitized.

    Reported-by: Team OWL337
    Signed-off-by: Thomas Gleixner
    Acked-by: John Stultz
    Cc: Peter Zijlstra
    Cc: Michael Kerrisk
    Link: https://lkml.kernel.org/r/20180626132704.922098090@linutronix.de

    Thomas Gleixner
     

24 Jun, 2018

1 commit

  • timer_set/gettime and timerfd_set/get apis use struct itimerspec at the
    user interface layer. struct itimerspec is not y2038-safe. Change these
    interfaces to use y2038-safe struct __kernel_itimerspec instead. This will
    help define new syscalls when 32bit architectures select CONFIG_64BIT_TIME.

    Signed-off-by: Deepa Dinamani
    Signed-off-by: Thomas Gleixner
    Cc: arnd@arndb.de
    Cc: viro@zeniv.linux.org.uk
    Cc: linux-fsdevel@vger.kernel.org
    Cc: linux-api@vger.kernel.org
    Cc: y2038@lists.linaro.org
    Link: https://lkml.kernel.org/r/20180617051144.29756-4-deepa.kernel@gmail.com

    Deepa Dinamani
     

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