Skip to content

Commit

Permalink
alarmtimer: Make nanosleep() time namespace aware
Browse files Browse the repository at this point in the history
clock_nanosleep() accepts absolute values of expiration time when the
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.

Co-developed-by: Dmitry Safonov <[email protected]>
Signed-off-by: Andrei Vagin <[email protected]>
Signed-off-by: Dmitry Safonov <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
avagin authored and KAGA-KOKO committed Jan 14, 2020
1 parent 7da8b3a commit 0b9b9a3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/time/alarmtimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,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);
Expand Down

0 comments on commit 0b9b9a3

Please sign in to comment.