<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/time/time.c, branch v4.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2017-06-26T01:58:46Z</updated>
<entry>
<title>time: introduce {get,put}_itimerspec64</title>
<updated>2017-06-26T01:58:46Z</updated>
<author>
<name>Deepa Dinamani</name>
<email>deepa.kernel@gmail.com</email>
</author>
<published>2017-06-24T18:45:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d5b7ffbfbdacc29e4db035f90665951668fa9c58'/>
<id>urn:sha1:d5b7ffbfbdacc29e4db035f90665951668fa9c58</id>
<content type='text'>
As we change the user space type for the timerfd and posix timer
functions to newer data types, we need some form of conversion
helpers to avoid duplicating that logic.

Suggested-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Deepa Dinamani &lt;deepa.kernel@gmail.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>time: add get_timespec64 and put_timespec64</title>
<updated>2017-06-26T01:58:46Z</updated>
<author>
<name>Deepa Dinamani</name>
<email>deepa.kernel@gmail.com</email>
</author>
<published>2017-06-24T18:45:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f59dd9c886acb3abb188e8e94a99436560976835'/>
<id>urn:sha1:f59dd9c886acb3abb188e8e94a99436560976835</id>
<content type='text'>
Add helper functions to convert between struct timespec64 and
struct timespec at userspace boundaries.

This is a preparatory patch to use timespec64 as the basic type
internally in the kernel as timespec is not y2038 safe on 32 bit systems.
The patch helps the cause by containing all data conversions at the
userspace boundaries within these functions.

Suggested-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Deepa Dinamani &lt;deepa.kernel@gmail.com&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>time: Move compat_gettimeofday()/settimeofday() to native</title>
<updated>2017-06-13T22:00:46Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2017-06-07T08:42:41Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2b2d02856b3176701c91d723356f766d6ee27853'/>
<id>urn:sha1:2b2d02856b3176701c91d723356f766d6ee27853</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lkml.kernel.org/r/20170607084241.28657-16-viro@ZenIV.linux.org.uk

</content>
</entry>
<entry>
<title>time: Move compat_time()/stime() to native</title>
<updated>2017-06-13T22:00:45Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2017-06-07T08:42:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b180db2c8ca6692a10b79631cadc18d03303d494'/>
<id>urn:sha1:b180db2c8ca6692a10b79631cadc18d03303d494</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lkml.kernel.org/r/20170607084241.28657-15-viro@ZenIV.linux.org.uk

</content>
</entry>
<entry>
<title>ntp: Move adjtimex related compat syscalls to native counterparts</title>
<updated>2017-06-13T22:00:43Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2017-06-07T08:42:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3a4d44b6162555070194e486ff6b3799a8d323a2'/>
<id>urn:sha1:3a4d44b6162555070194e486ff6b3799a8d323a2</id>
<content type='text'>
Get rid of set_fs() mess and sanitize compat_{get,put}_timex(),
while we are at it.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Link: http://lkml.kernel.org/r/20170607084241.28657-9-viro@ZenIV.linux.org.uk

</content>
</entry>
<entry>
<title>time: delete current_fs_time()</title>
<updated>2017-05-12T22:57:15Z</updated>
<author>
<name>Deepa Dinamani</name>
<email>deepa.kernel@gmail.com</email>
</author>
<published>2017-05-12T22:46:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=572e0ca9b909339fbe017aaff1a225efb6db3b61'/>
<id>urn:sha1:572e0ca9b909339fbe017aaff1a225efb6db3b61</id>
<content type='text'>
All uses of the current_fs_time() function have been replaced by other
time interfaces.

And, its use cases can be fulfilled by current_time() or ktime_get_*
variants.

Link: http://lkml.kernel.org/r/1491613030-11599-13-git-send-email-deepa.kernel@gmail.com
Signed-off-by: Deepa Dinamani &lt;deepa.kernel@gmail.com&gt;
Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>time: Delete do_sys_setimeofday()</title>
<updated>2017-04-14T19:49:54Z</updated>
<author>
<name>Deepa Dinamani</name>
<email>deepa.kernel@gmail.com</email>
</author>
<published>2017-03-26T19:04:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2ac00f17b2e110c67ed2af3713bc04aec62e4608'/>
<id>urn:sha1:2ac00f17b2e110c67ed2af3713bc04aec62e4608</id>
<content type='text'>
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 &lt;deepa.kernel@gmail.com&gt;
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 &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>time: Introduce jiffies64_to_nsecs()</title>
<updated>2017-02-01T08:13:45Z</updated>
<author>
<name>Frederic Weisbecker</name>
<email>fweisbec@gmail.com</email>
</author>
<published>2017-01-31T03:09:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=07e5f5e353aaa61696c8353d87050994a0c4648a'/>
<id>urn:sha1:07e5f5e353aaa61696c8353d87050994a0c4648a</id>
<content type='text'>
This will be needed for the cputime_t to nsec conversion.

Signed-off-by: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
Cc: Paul Mackerras &lt;paulus@samba.org&gt;
Cc: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Fenghua Yu &lt;fenghua.yu@intel.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@redhat.com&gt;
Cc: Stanislaw Gruszka &lt;sgruszka@redhat.com&gt;
Cc: Wanpeng Li &lt;wanpeng.li@hotmail.com&gt;
Link: http://lkml.kernel.org/r/1485832191-26889-2-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>Replace &lt;asm/uaccess.h&gt; with &lt;linux/uaccess.h&gt; globally</title>
<updated>2016-12-24T19:46:01Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-12-24T19:46:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba'/>
<id>urn:sha1:7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba</id>
<content type='text'>
This was entirely automated, using the script by Al:

  PATT='^[[:blank:]]*#[[:blank:]]*include[[:blank:]]*&lt;asm/uaccess.h&gt;'
  sed -i -e "s!$PATT!#include &lt;linux/uaccess.h&gt;!" \
        $(git grep -l "$PATT"|grep -v ^include/linux/uaccess.h)

to do the replacement at the end of the merge window.

Requested-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>time: Avoid undefined behaviour in timespec64_add_safe()</title>
<updated>2016-08-31T21:43:35Z</updated>
<author>
<name>Vegard Nossum</name>
<email>vegard.nossum@oracle.com</email>
</author>
<published>2016-08-12T18:14:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=469e857f374640f6164913835ce30d0736b40a60'/>
<id>urn:sha1:469e857f374640f6164913835ce30d0736b40a60</id>
<content type='text'>
I ran into this:

    ================================================================================
    UBSAN: Undefined behaviour in kernel/time/time.c:783:2
    signed integer overflow:
    5273 + 9223372036854771711 cannot be represented in type 'long int'
    CPU: 0 PID: 17363 Comm: trinity-c0 Not tainted 4.8.0-rc1+ #88
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org
    04/01/2014
     0000000000000000 ffff88011457f8f0 ffffffff82344f50 0000000041b58ab3
     ffffffff84f98080 ffffffff82344ea4 ffff88011457f918 ffff88011457f8c8
     ffff88011457f8e0 7fffffffffffefff ffff88011457f6d8 dffffc0000000000
    Call Trace:
     [&lt;ffffffff82344f50&gt;] dump_stack+0xac/0xfc
     [&lt;ffffffff82344ea4&gt;] ? _atomic_dec_and_lock+0xc4/0xc4
     [&lt;ffffffff8242f4c8&gt;] ubsan_epilogue+0xd/0x8a
     [&lt;ffffffff8242fc04&gt;] handle_overflow+0x202/0x23d
     [&lt;ffffffff8242fa02&gt;] ? val_to_string.constprop.6+0x11e/0x11e
     [&lt;ffffffff823c7837&gt;] ? debug_smp_processor_id+0x17/0x20
     [&lt;ffffffff8131b581&gt;] ? __sigqueue_free.part.13+0x51/0x70
     [&lt;ffffffff8146d4e0&gt;] ? rcu_is_watching+0x110/0x110
     [&lt;ffffffff8242fc4d&gt;] __ubsan_handle_add_overflow+0xe/0x10
     [&lt;ffffffff81476ef8&gt;] timespec64_add_safe+0x298/0x340
     [&lt;ffffffff81476c60&gt;] ? timespec_add_safe+0x330/0x330
     [&lt;ffffffff812f7990&gt;] ? wait_noreap_copyout+0x1d0/0x1d0
     [&lt;ffffffff8184bf18&gt;] poll_select_set_timeout+0xf8/0x170
     [&lt;ffffffff8184be20&gt;] ? poll_schedule_timeout+0x2b0/0x2b0
     [&lt;ffffffff813aa9bb&gt;] ? __might_sleep+0x5b/0x260
     [&lt;ffffffff833c8a87&gt;] __sys_recvmmsg+0x107/0x790
     [&lt;ffffffff833c8980&gt;] ? SyS_recvmsg+0x20/0x20
     [&lt;ffffffff81486378&gt;] ? hrtimer_start_range_ns+0x3b8/0x1380
     [&lt;ffffffff845f8bfb&gt;] ? _raw_spin_unlock_irqrestore+0x3b/0x60
     [&lt;ffffffff8148bcea&gt;] ? do_setitimer+0x39a/0x8e0
     [&lt;ffffffff813aa9bb&gt;] ? __might_sleep+0x5b/0x260
     [&lt;ffffffff833c9110&gt;] ? __sys_recvmmsg+0x790/0x790
     [&lt;ffffffff833c91e9&gt;] SyS_recvmmsg+0xd9/0x160
     [&lt;ffffffff833c9110&gt;] ? __sys_recvmmsg+0x790/0x790
     [&lt;ffffffff823c7853&gt;] ? __this_cpu_preempt_check+0x13/0x20
     [&lt;ffffffff8162f680&gt;] ? __context_tracking_exit.part.3+0x30/0x1b0
     [&lt;ffffffff833c9110&gt;] ? __sys_recvmmsg+0x790/0x790
     [&lt;ffffffff81007bd3&gt;] do_syscall_64+0x1b3/0x4b0
     [&lt;ffffffff845f936a&gt;] entry_SYSCALL64_slow_path+0x25/0x25
    ================================================================================

Line 783 is this:

783         set_normalized_timespec64(&amp;res, lhs.tv_sec + rhs.tv_sec,
784                         lhs.tv_nsec + rhs.tv_nsec);

In other words, since lhs.tv_sec and rhs.tv_sec are both time64_t, this
is a signed addition which will cause undefined behaviour on overflow.

Note that this is not currently a huge concern since the kernel should be
built with -fno-strict-overflow by default, but could be a problem in the
future, a problem with older compilers, or other compilers than gcc.

The easiest way to avoid the overflow is to cast one of the arguments to
unsigned (so the addition will be done using unsigned arithmetic).

Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Richard Cochran &lt;richardcochran@gmail.com&gt;
Cc: Prarit Bhargava &lt;prarit@redhat.com&gt;
Signed-off-by: Vegard Nossum &lt;vegard.nossum@oracle.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
</feed>
