<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/fs/timerfd.c, branch v4.9.296</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.296</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.296'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-05-08T05:47:54Z</updated>
<entry>
<title>timerfd: Protect the might cancel mechanism proper</title>
<updated>2017-05-08T05:47:54Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2017-01-31T14:24:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=00cca9768ebe1ac4ac16366662dd9087b6e5f4e7'/>
<id>urn:sha1:00cca9768ebe1ac4ac16366662dd9087b6e5f4e7</id>
<content type='text'>
commit 1e38da300e1e395a15048b0af1e5305bd91402f6 upstream.

The handling of the might_cancel queueing is not properly protected, so
parallel operations on the file descriptor can race with each other and
lead to list corruptions or use after free.

Protect the context for these operations with a seperate lock.

The wait queue lock cannot be reused for this because that would create a
lock inversion scenario vs. the cancel lock. Replacing might_cancel with an
atomic (atomic_t or atomic bit) does not help either because it still can
race vs. the actual list operation.

Reported-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: "linux-fsdevel@vger.kernel.org"
Cc: syzkaller &lt;syzkaller@googlegroups.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: linux-fsdevel@vger.kernel.org
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1701311521430.3457@nanos
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>timerfd: Reject ALARM timerfds without CAP_WAKE_ALARM</title>
<updated>2016-06-09T21:42:38Z</updated>
<author>
<name>Eric Caruso</name>
<email>ejcaruso@google.com</email>
</author>
<published>2016-06-08T23:08:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2895a5e5b3ae78d9923a91fce405d4a2f32c4309'/>
<id>urn:sha1:2895a5e5b3ae78d9923a91fce405d4a2f32c4309</id>
<content type='text'>
timerfd gives processes a way to set wake alarms, but unlike timers made using
timer_create, timerfds don't check whether the process has CAP_WAKE_ALARM
before setting alarm-time timers. CAP_WAKE_ALARM is supposed to gate this
behavior and so it makes sense that we should deny permission to create such
timerfds if the process doesn't have this capability.

Signed-off-by: Eric Caruso &lt;ejcaruso@google.com&gt;
Cc: Todd Poynor &lt;toddpoynor@google.com&gt;
Link: http://lkml.kernel.org/r/1465427339-96209-1-git-send-email-ejcaruso@chromium.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>timerfd: Handle relative timers with CONFIG_TIME_LOW_RES proper</title>
<updated>2016-01-17T10:13:55Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2016-01-14T16:54:46Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b62526ed11a1fe3861ab98d40b7fdab8981d788a'/>
<id>urn:sha1:b62526ed11a1fe3861ab98d40b7fdab8981d788a</id>
<content type='text'>
Helge reported that a relative timer can return a remaining time larger than
the programmed relative time on parisc and other architectures which have
CONFIG_TIME_LOW_RES set. This happens because we add a jiffie to the resulting
expiry time to prevent short timeouts.

Use the new function hrtimer_expires_remaining_adjusted() to calculate the
remaining time. It takes that extra added time into account for relative
timers.

Reported-and-tested-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: linux-m68k@lists.linux-m68k.org
Cc: dhowells@redhat.com
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20160114164159.354500742@linutronix.de
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>fs: Convert show_fdinfo functions to void</title>
<updated>2014-11-05T19:13:23Z</updated>
<author>
<name>Joe Perches</name>
<email>joe@perches.com</email>
</author>
<published>2014-09-29T23:08:25Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a3816ab0e8fe542a89a53b82506a8ddac063fbe3'/>
<id>urn:sha1:a3816ab0e8fe542a89a53b82506a8ddac063fbe3</id>
<content type='text'>
seq_printf functions shouldn't really check the return value.
Checking seq_has_overflowed() occasionally is used instead.

Update vfs documentation.

Link: http://lkml.kernel.org/p/e37e6e7b76acbdcc3bb4ab2a57c8f8ca1ae11b9a.1412031505.git.joe@perches.com

Cc: David S. Miller &lt;davem@davemloft.net&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Signed-off-by: Joe Perches &lt;joe@perches.com&gt;
[ did a few clean ups ]
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>timerfd: Remove an always true check</title>
<updated>2014-08-27T09:17:48Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2014-08-01T08:28:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=88299c9bdb109e0d95abdca648065631ff91b2cb'/>
<id>urn:sha1:88299c9bdb109e0d95abdca648065631ff91b2cb</id>
<content type='text'>
We would have returned -EINVAL earlier if ticks wasn't set.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Cc: Alexander Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Link: http://lkml.kernel.org/r/20140801082848.GF28869@mwanda
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>timerfd: Use ktime_mono_to_real()</title>
<updated>2014-07-23T17:18:02Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2014-07-16T21:04:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=53cc7bad37fcb90e47ef729ef9818a2ed93ee862'/>
<id>urn:sha1:53cc7bad37fcb90e47ef729ef9818a2ed93ee862</id>
<content type='text'>
We have a few other use cases of ktime_get_monotonic_offset() which
can be optimized with ktime_mono_to_real(). The timerfd code uses the
offset only for comparison, so we can use ktime_mono_to_real(0) for
this as well.

Funny enough text size shrinks with that on ARM and x8664 !?

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>timerfd: Implement timerfd_ioctl method to restore timerfd_ctx::ticks, v3</title>
<updated>2014-07-18T09:49:57Z</updated>
<author>
<name>Cyrill Gorcunov</name>
<email>gorcunov@openvz.org</email>
</author>
<published>2014-07-15T21:54:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=5442e9fbd7c23172a1c9bc736629cd123a9923f0'/>
<id>urn:sha1:5442e9fbd7c23172a1c9bc736629cd123a9923f0</id>
<content type='text'>
The read() of timerfd files allows to fetch the number of timer ticks
while there is no way to set it back from userspace.

To restore the timer's state as it was at checkpoint moment we need
a path to bring @ticks back. Initially I thought about writing ticks
back via write() interface but it seems such API is somehow obscure.

Instead implement timerfd_ioctl() method with TFD_IOC_SET_TICKS
command which allows to adjust @ticks into non-zero value waking
up the waiters.

I wrapped code with CONFIG_CHECKPOINT_RESTORE which can be
dropped off if there users except c/r camp appear.

v2 (by akpm@):
 - Use define timerfd_ioctl NULL for non c/r config

v3:
 - Use copy_from_user for @ticks fetching since
   not all arch support get_user for 8 byte argument

Signed-off-by: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Michael Kerrisk &lt;mtk.manpages@gmail.com&gt;
Cc: Andrey Vagin &lt;avagin@openvz.org&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Christopher Covington &lt;cov@codeaurora.org&gt;
Cc: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Cc: Vladimir Davydov &lt;vdavydov@parallels.com&gt;
Link: http://lkml.kernel.org/r/20140715215703.285617923@openvz.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>timerfd: Implement show_fdinfo method</title>
<updated>2014-07-18T09:49:57Z</updated>
<author>
<name>Cyrill Gorcunov</name>
<email>gorcunov@openvz.org</email>
</author>
<published>2014-07-15T21:54:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=af9c4957cf212ad9cf0bee34c95cb11de5426e85'/>
<id>urn:sha1:af9c4957cf212ad9cf0bee34c95cb11de5426e85</id>
<content type='text'>
For checkpoint/restore of timerfd files we need to know how exactly
the timer were armed, to be able to recreate it on restore stage.
Thus implement show_fdinfo method which provides enough information
for that.

One of significant changes I think is the addition of @settime_flags
member. Currently there are two flags TFD_TIMER_ABSTIME and
TFD_TIMER_CANCEL_ON_SET, and the second can be found from
@might_cancel variable but in case if the flags will be extended
in future we most probably will have to somehow remember them
explicitly anyway so I guss doing that right now won't hurt.

To not bloat the timerfd_ctx structure I've converted @expired
to short integer and defined @settime_flags as short too.

v2 (by avagin@, vdavydov@ and tglx@):

 - Add it_value/it_interval fields
 - Save flags being used in timerfd_setup in context

v3 (by tglx@):
 - don't forget to use CONFIG_PROC_FS

v4 (by akpm@):
 -Use define timerfd_show NULL for non c/r config

Signed-off-by: Cyrill Gorcunov &lt;gorcunov@openvz.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Michael Kerrisk &lt;mtk.manpages@gmail.com&gt;
Cc: Andrey Vagin &lt;avagin@openvz.org&gt;
Cc: Pavel Emelyanov &lt;xemul@parallels.com&gt;
Cc: Vladimir Davydov &lt;vdavydov@parallels.com&gt;
Link: http://lkml.kernel.org/r/20140715215703.114365649@openvz.org
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
</content>
</entry>
<entry>
<title>timerfd: support CLOCK_BOOTTIME clock</title>
<updated>2014-01-24T00:57:40Z</updated>
<author>
<name>Greg Hackmann</name>
<email>ghackmann@google.com</email>
</author>
<published>2014-01-08T18:57:03Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4a2378a943f09907fb1ae35c15de917f60289c14'/>
<id>urn:sha1:4a2378a943f09907fb1ae35c15de917f60289c14</id>
<content type='text'>
Add CLOCK_BOOTTIME support to timerfd

Signed-off-by: Greg Hackmann &lt;ghackmann@google.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
<entry>
<title>timerfd: Add alarm timers</title>
<updated>2013-05-29T19:57:34Z</updated>
<author>
<name>Todd Poynor</name>
<email>toddpoynor@google.com</email>
</author>
<published>2013-05-15T21:38:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=11ffa9d6065f344a9bd769a2452f26f2f671e5f8'/>
<id>urn:sha1:11ffa9d6065f344a9bd769a2452f26f2f671e5f8</id>
<content type='text'>
Add support for clocks CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM,
thereby enabling wakeup alarm timers via file descriptors.

Signed-off-by: Todd Poynor &lt;toddpoynor@google.com&gt;
Signed-off-by: John Stultz &lt;john.stultz@linaro.org&gt;
</content>
</entry>
</feed>
