summaryrefslogtreecommitdiffstats
path: root/fs/timerfd.c
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@gmail.com>2019-11-12 02:27:02 +0100
committerThomas Gleixner <tglx@linutronix.de>2020-01-14 12:20:53 +0100
commit6cd889d43c40b13f81a44c41896781ce70244769 (patch)
tree74a3f0575c0f0a31eb7deaa1ec8723ed0ce9166c /fs/timerfd.c
parenttime: Add do_timens_ktime_to_host() helper (diff)
downloadlinux-6cd889d43c40b13f81a44c41896781ce70244769.tar.xz
linux-6cd889d43c40b13f81a44c41896781ce70244769.zip
timerfd: Make timerfd_settime() time namespace aware
timerfd_settime() accepts an absolute value of the expiration time if TFD_TIMER_ABSTIME is specified. This value is in the task's time namespace and has to be converted to the host's time namespace. Co-developed-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Andrei Vagin <avagin@gmail.com> Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20191112012724.250792-14-dima@arista.com
Diffstat (limited to 'fs/timerfd.c')
-rw-r--r--fs/timerfd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/timerfd.c b/fs/timerfd.c
index ac7f59a58f94..c5509d2448e3 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -26,6 +26,7 @@
#include <linux/syscalls.h>
#include <linux/compat.h>
#include <linux/rcupdate.h>
+#include <linux/time_namespace.h>
struct timerfd_ctx {
union {
@@ -196,6 +197,8 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags,
}
if (texp != 0) {
+ if (flags & TFD_TIMER_ABSTIME)
+ texp = timens_ktime_to_host(clockid, texp);
if (isalarm(ctx)) {
if (flags & TFD_TIMER_ABSTIME)
alarm_start(&ctx->t.alarm, texp);