1. 13 3月, 2018 1 次提交
    • T
      timekeeping: Add the new CLOCK_MONOTONIC_ACTIVE clock · 72199320
      Thomas Gleixner 提交于
      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: NThomas Gleixner <tglx@linutronix.de>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Kevin Easton <kevin@guarana.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salyzyn <salyzyn@android.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/20180301165149.965235774@linutronix.deSigned-off-by: NIngo Molnar <mingo@kernel.org>
      72199320
  2. 23 1月, 2018 1 次提交
  3. 15 12月, 2017 1 次提交
    • T
      posix-timer: Properly check sigevent->sigev_notify · cef31d9a
      Thomas Gleixner 提交于
      timer_create() specifies via sigevent->sigev_notify the signal delivery for
      the new timer. The valid modes are SIGEV_NONE, SIGEV_SIGNAL, SIGEV_THREAD
      and (SIGEV_SIGNAL | SIGEV_THREAD_ID).
      
      The sanity check in good_sigevent() is only checking the valid combination
      for the SIGEV_THREAD_ID bit, i.e. SIGEV_SIGNAL, but if SIGEV_THREAD_ID is
      not set it accepts any random value.
      
      This has no real effects on the posix timer and signal delivery code, but
      it affects show_timer() which handles the output of /proc/$PID/timers. That
      function uses a string array to pretty print sigev_notify. The access to
      that array has no bound checks, so random sigev_notify cause access beyond
      the array bounds.
      
      Add proper checks for the valid notify modes and remove the SIGEV_THREAD_ID
      masking from various code pathes as SIGEV_NONE can never be set in
      combination with SIGEV_THREAD_ID.
      Reported-by: NEric Biggers <ebiggers3@gmail.com>
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Reported-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: stable@vger.kernel.org
      cef31d9a
  4. 30 6月, 2017 3 次提交
  5. 14 6月, 2017 10 次提交
  6. 13 6月, 2017 2 次提交
    • T
      posix-timers: Handle relative posix-timers correctly · 67edab48
      Thomas Gleixner 提交于
      The recent rework of the posix timer internals broke the magic posix
      mechanism, which requires that relative timers are not affected by
      modifications of the underlying clock. That means relative CLOCK_REALTIME
      timers cannot use CLOCK_REALTIME, because that can be set and adjusted. The
      underlying hrtimer switches the clock for these timers to CLOCK_MONOTONIC.
      
      That still works, but reading the remaining time of such a timer has been
      broken in the rework. The old code used the hrtimer internals directly and
      avoided the posix clock callbacks. Now common_timer_get() uses the
      underlying kclock->timer_get() callback, which is still CLOCK_REALTIME
      based. So the remaining time of such a timer is calculated against the
      wrong time base.
      
      Handle it by switching the k_itimer->kclock pointer according to the
      resulting hrtimer mode. k_itimer->it_clock still contains CLOCK_REALTIME
      because the timer might be set with ABSTIME later and then it needs to
      switch back to the realtime posix clock implementation.
      
      Fixes: eae1c4ae ("posix-timers: Make use of cancel/arm callbacks")
      Reported-by: NAndrei Vagin <avagin@virtuozzo.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Link: http://lkml.kernel.org/r/20170609201156.GB21491@outlook.office365.com
      67edab48
    • T
      posix-timers: Zero out oldval itimerspec · 5c7a3a3d
      Thomas Gleixner 提交于
      The recent posix timer rework moved the clearing of the itimerspec to the
      real syscall implementation, but forgot that the kclock->timer_get() is
      used by timer_settime() as well. That results in an uninitialized variable
      and bogus values returned to user space.
      
      Add the missing memset to timer_settime().
      
      Fixes: eabdec04 ("posix-timers: Zero settings value in common code")
      Reported-by: NAndrei Vagin <avagin@virtuozzo.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: John Stultz <john.stultz@linaro.org>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Link: http://lkml.kernel.org/r/20170609201156.GB21491@outlook.office365.com
      5c7a3a3d
  7. 12 6月, 2017 1 次提交
  8. 04 6月, 2017 13 次提交
  9. 27 5月, 2017 1 次提交
  10. 15 4月, 2017 6 次提交
  11. 02 3月, 2017 1 次提交