Thread (61 messages) flat view 61 messages, 7 authors, 2019-08-19

[PATCHv6 13/36] alarmtimer: Make nanosleep time namespace aware

From: Dmitry Safonov <hidden>
Date: 2019-08-15 16:39:03
Also in: lkml
Subsystem: the rest, timekeeping, clocksource core, ntp, alarmtimer · Maintainers: Linus Torvalds, John Stultz, Thomas Gleixner

From: Andrei Vagin <redacted>

clock_nanosleep() accepts absolute values of expiration time when
TIMER_ABSTIME flag is set. This absolute value is inside the task's
time namespace, and has to be converted to the host's time.

Signed-off-by: Andrei Vagin <redacted>
Co-developed-by: Dmitry Safonov <redacted>
Signed-off-by: Dmitry Safonov <redacted>
---
 kernel/time/alarmtimer.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index fbf18b26faed..751ed7f3cab2 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -825,6 +825,8 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
 		ktime_t now = alarm_bases[type].get_ktime();
 
 		exp = ktime_add_safe(now, exp);
+	} else {
+		exp = timens_ktime_to_host(which_clock, exp);
 	}
 
 	ret = alarmtimer_do_nsleep(&alarm, exp, type);
-- 
2.22.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help