The patch titled prevent timespec/timeval to ktime_t overflow has been removed from the -mm tree. Its filename is prevent-timespec-timeval-to-ktime_t-overflow.patch This patch was dropped because it had testing failures ------------------------------------------------------ Subject: prevent timespec/timeval to ktime_t overflow From: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Frank v. Waveren pointed out that on 64bit machines the timespec to ktime_t conversion might overflow. This is also true for timeval to ktime_t conversions. This breaks a "sleep inf" on 64bit machines. While a timespec/timeval with tx.sec = MAX_LONG is valid by specification the internal representation of ktime_t is based on nanoseconds. The conversion of seconds to nanoseconds overflows for seconds values >= (MAX_LONG / NSEC_PER_SEC). Check the seconds argument to the conversion and limit it to the maximum time which can be represented by ktime_t. Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Frank v Waveren <fvw@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/linux/ktime.h | 5 +++++ 1 files changed, 5 insertions(+) diff -puN include/linux/ktime.h~prevent-timespec-timeval-to-ktime_t-overflow include/linux/ktime.h --- a/include/linux/ktime.h~prevent-timespec-timeval-to-ktime_t-overflow +++ a/include/linux/ktime.h @@ -57,6 +57,7 @@ typedef union { } ktime_t; #define KTIME_MAX (~((u64)1 << 63)) +#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) /* * ktime_t definitions when using the 64-bit scalar representation: @@ -73,6 +74,10 @@ typedef union { */ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) { +#if (BITS_PER_LONG == 64) + if (unlikely(secs >= KTIME_SEC_MAX)) + return (ktime_t){ .tv64 = KTIME_MAX }; +#endif return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; } _ Patches currently in -mm which might be from tglx@xxxxxxxxxxxxx are origin.patch prevent-timespec-timeval-to-ktime_t-overflow.patch git-mtd.patch mtd-maps-ixp4xx-partition-parsing.patch slab-fix-lockdep-warnings.patch slab-fix-lockdep-warnings-fix.patch slab-fix-lockdep-warnings-fix-2.patch rtmutex-clean-up-and-remove-some-extra-spinlocks.patch rtmutex-clean-up-and-remove-some-extra-spinlocks-more.patch posix-timers-fix-clock_nanosleep-doesnt-return-the-remaining-time-in-compatibility-mode-2.patch posix-timers-fix-the-flags-handling-in-posix_cpu_nsleep-2.patch simplify-update_times-avoid-jiffies-jiffies_64-aliasing-problem-2.patch do_sched_setscheduler-dont-take-tasklist_lock.patch introduce-is_rt_policy-helper.patch sched_setscheduler-fix-policy-checks.patch reparent_to_init-use-has_rt_policy.patch futex_find_get_task-dont-take-tasklist_lock.patch sys_get_robust_list-dont-take-tasklist_lock.patch genirq-convert-the-x86_64-architecture-to-irq-chips.patch genirq-convert-the-i386-architecture-to-irq-chips.patch genirq-irq-convert-the-move_irq-flag-from-a-32bit-word-to-a-single-bit.patch genirq-irq-add-moved_masked_irq.patch genirq-x86_64-irq-reenable-migrating-irqs-to-other-cpus.patch genirq-msi-simplify-msi-enable-and-disable.patch genirq-msi-make-the-msi-boolean-tests-return-either-0-or-1.patch genirq-msi-implement-helper-functions-read_msi_msg-and-write_msi_msg.patch genirq-msi-refactor-the-msi_ops.patch genirq-msi-simplify-the-msi-irq-limit-policy.patch genirq-irq-add-a-dynamic-irq-creation-api.patch genirq-ia64-irq-dynamic-irq-support.patch genirq-i386-irq-dynamic-irq-support.patch genirq-x86_64-irq-dynamic-irq-support.patch genirq-msi-make-the-msi-code-irq-based-and-not-vector-based.patch genirq-x86_64-irq-move-msi-message-composition-into-io_apicc.patch genirq-i386-irq-move-msi-message-composition-into-io_apicc.patch genirq-msi-only-build-msi-apicc-on-ia64.patch genirq-x86_64-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-i386-irq-remove-the-msi-assumption-that-irq-==-vector.patch genirq-irq-remove-msi-hacks.patch genirq-irq-generalize-the-check-for-hardirq_bits.patch genirq-x86_64-irq-make-the-external-irq-handlers-report-their-vector-not-the-irq-number.patch genirq-x86_64-irq-make-vector_irq-per-cpu.patch genirq-x86_64-irq-make-vector_irq-per-cpu-warning-fix.patch genirq-x86_64-irq-kill-gsi_irq_sharing.patch genirq-x86_64-irq-kill-irq-compression.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html