lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <157894256874.19145.1461750936143633317.tip-bot2@tip-bot2>
Date:   Mon, 13 Jan 2020 19:09:28 -0000
From:   "tip-bot2 for Andrei Vagin" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Andrei Vagin <avagin@...nvz.org>, Dmitry Safonov <dima@...sta.com>,
        Thomas Gleixner <tglx@...utronix.de>, x86 <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [tip: timers/core] posix-timers: Make timer_settime() time namespace aware

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     d1ba7dda1bc0129bc8f85bff530748aef1e99e70
Gitweb:        https://git.kernel.org/tip/d1ba7dda1bc0129bc8f85bff530748aef1e99e70
Author:        Andrei Vagin <avagin@...il.com>
AuthorDate:    Tue, 12 Nov 2019 01:27:03 
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Mon, 13 Jan 2020 08:10:52 +01:00

posix-timers: Make timer_settime() time namespace aware

Wire timer_settime() syscall into time namespace virtualization.

sys_timer_settime() calls the ktime->timer_set() callback. Right now,
common_timer_set() is the only implementation for the callback.

The user-supplied expiry value is converted from timespec64 to ktime and
then timens_ktime_to_host() can be used to convert namespace's time to the
host time.

Inside a time namespace kernel's time differs by a fixed offset from a
user-supplied time, but only absolute values (TIMER_ABSTIME) must be
converted.

Co-developed-by: Dmitry Safonov <dima@...sta.com>
Signed-off-by: Andrei Vagin <avagin@...nvz.org>
Signed-off-by: Dmitry Safonov <dima@...sta.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://lore.kernel.org/r/20191112012724.250792-15-dima@arista.com

---
 kernel/time/posix-timers.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index d26b915..473082b 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -885,6 +885,8 @@ int common_timer_set(struct k_itimer *timr, int flags,
 
 	timr->it_interval = timespec64_to_ktime(new_setting->it_interval);
 	expires = timespec64_to_ktime(new_setting->it_value);
+	if (flags & TIMER_ABSTIME)
+		expires = timens_ktime_to_host(timr->it_clock, expires);
 	sigev_none = timr->it_sigev_notify == SIGEV_NONE;
 
 	kc->timer_arm(timr, expires, flags & TIMER_ABSTIME, sigev_none);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ