mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
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
This commit is contained in:
committed by
Thomas Gleixner
parent
89dd8eecfe
commit
6cd889d43c
@@ -26,6 +26,7 @@
|
|||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/compat.h>
|
#include <linux/compat.h>
|
||||||
#include <linux/rcupdate.h>
|
#include <linux/rcupdate.h>
|
||||||
|
#include <linux/time_namespace.h>
|
||||||
|
|
||||||
struct timerfd_ctx {
|
struct timerfd_ctx {
|
||||||
union {
|
union {
|
||||||
@@ -196,6 +197,8 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (texp != 0) {
|
if (texp != 0) {
|
||||||
|
if (flags & TFD_TIMER_ABSTIME)
|
||||||
|
texp = timens_ktime_to_host(clockid, texp);
|
||||||
if (isalarm(ctx)) {
|
if (isalarm(ctx)) {
|
||||||
if (flags & TFD_TIMER_ABSTIME)
|
if (flags & TFD_TIMER_ABSTIME)
|
||||||
alarm_start(&ctx->t.alarm, texp);
|
alarm_start(&ctx->t.alarm, texp);
|
||||||
|
|||||||
Reference in New Issue
Block a user