Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp5666329ima; Tue, 5 Feb 2019 16:16:17 -0800 (PST) X-Google-Smtp-Source: AHgI3IYTVwc2xHgnXpmkSUDzEGl8MIdDlSoezTfKIPzm2lKMVkjfwvHp29RLG0Fy6fcfg7tO3Gei X-Received: by 2002:a63:4948:: with SMTP id y8mr7002458pgk.32.1549412177120; Tue, 05 Feb 2019 16:16:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549412177; cv=none; d=google.com; s=arc-20160816; b=bAyYGjzvjyJemTCMIQg32azSXDoSPezBkRq5fhD0kMSVuxkPHqUkXR0vEq/FCnj4Wq DHCsJwokeJQQSll2vc7UaSa7Ba97ap+M9bdpCWDxhilRFHVd73CwMFSD5zdm79A2kMIK CypNGH+ksdJbxSkPdnNfjZtG5EsVWva9rvfKzp92W/+En8Q8XHzsmY7RGtNVFDM/62yW LGqUsv7mqVERhsV77fgA/B3GUIM97g/DvG/YwmTS1CsM2IKZN2M1+iG3ThgS6rWJ8R+t IWnUaLwArbCynhv8f1J9HjLXMb4neYHwJtCds4Z3cO37fuzG7D16YjAvxaw6aJUAis6B MWMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G8ebtD0PUJZzL4V55Z6Zjj8nffme1FjZTkLJ2ixHSJ4=; b=qiBHq44jDFFov2UcxO/IYpv4BpvejgKs5fbmYX8ZyRlPFhELdzk8wxE0mtOImrR33c bBt5UJVAZAYfFS0li03sU60aW5qGoBH88tt15Of0RTRgolKQAZ0niQtgLvzDn9A5N7gi 0E7lnUFgOqmYEZhYcTxPab2qFQpfzNQEOHUXjQdzTTtb6RBT+CZNTqbI1SWYZgPCKyei TeficQguSGeINTqzHkTx5RwElpyPqIQ38axS18/vqJO14Nz3MC83c7Sxmwrb1Vu/gc0Z xAEP/QaLmeV9StzCOF2skh7/n3ynyWWnqfihM5I9PHRZET0m4HwVnu89uXbNWzgTwdfA 17gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=MGq++3go; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s27si4160558pgm.501.2019.02.05.16.16.01; Tue, 05 Feb 2019 16:16:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=MGq++3go; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=arista.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729778AbfBFANz (ORCPT + 99 others); Tue, 5 Feb 2019 19:13:55 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:33342 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727327AbfBFALT (ORCPT ); Tue, 5 Feb 2019 19:11:19 -0500 Received: by mail-ed1-f65.google.com with SMTP id p6so4517858eds.0 for ; Tue, 05 Feb 2019 16:11:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=googlenew; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G8ebtD0PUJZzL4V55Z6Zjj8nffme1FjZTkLJ2ixHSJ4=; b=MGq++3goR1a7kJbU4vTTpimixiyed7M0i0ACMPjuJYBknjvQH1297QuIzRXLwBbY70 sX1Tcl6+dMBPfnTAyV8IrKgKud77KAIzVy5sCs4YenD3Cf6JVZmVPL2UqKH+QBV1/YHi 9FMVeba/ep4x0CgxY+e9fabMUCcrHgYQruHVUYylDka8WVX1EDariVvXpgfKi+eUBXFB FNRNbpUSKeqfc+Liul01fku+tkupT9Ht9qJDLmtqHupfV5ePQBsiyRXUOjeO1JEeKnKr 5xAQHgtZ3mnvGeYxw5w8CV2mdtwphPpwqKJC8dpwBBgBpdSIR2kdrCNbZ1LYJsgUwnYH m96w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G8ebtD0PUJZzL4V55Z6Zjj8nffme1FjZTkLJ2ixHSJ4=; b=uWtbpzolU58yBT4LufQQKEeYeLQsZiFWq7A1gLjLrno6hFwDVSQcsZRrsPC5E8rakE YU9ZnYG76fHmDySLA9QhEvI7+XwtWGfTd6EFAF72jisKB//NudHZYZ42VasNz8egjLYg +HKeAIOgHS0EIbND1R7IBjrCIzqMHYUHZYriIEcEeNp5psRmgtMKhIM+aLoT93K3xc5+ 3OhRfcORXNcZTUgm5VO+T3T7qPg4V2Ae+CgE/ZZgSgYBF2J6vvHeOAs5F9yQvf6p5wse pTCh4gBJ+t1kYBK4OZftmreVnxSsd6MwAMwY+Jbw0RW2q7jFzcwKdbuHazE+VF0dzgdb NAJQ== X-Gm-Message-State: AHQUAubr7CtuoT08QUi2rwsbfQFxM2QCiJvKNIc61DA0TOPru3a2MZw+ woj7e1cXF1LwlWSr46zDJkE66Ondy+M= X-Received: by 2002:a17:906:470a:: with SMTP id y10mr5311866ejq.236.1549411877498; Tue, 05 Feb 2019 16:11:17 -0800 (PST) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id p30sm5489594eda.68.2019.02.05.16.11.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 05 Feb 2019 16:11:16 -0800 (PST) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Andrei Vagin , Dmitry Safonov , Adrian Reber , Andrei Vagin , Andy Lutomirski , Andy Tucker , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , Dmitry Safonov <0x7f454c46@gmail.com>, "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [PATCH 06/32] posix-timers/timens: Take into account clock offsets Date: Wed, 6 Feb 2019 00:10:40 +0000 Message-Id: <20190206001107.16488-7-dima@arista.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190206001107.16488-1-dima@arista.com> References: <20190206001107.16488-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin Wire timer_settime() syscall into time namespace virtualization. Signed-off-by: Andrei Vagin Signed-off-by: Dmitry Safonov --- kernel/time/posix-timers.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 782708054df2..d008dfd5b081 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -854,10 +854,6 @@ static int do_timer_settime(timer_t timer_id, int flags, unsigned long flag; int error = 0; - if (!timespec64_valid(&new_spec64->it_interval) || - !timespec64_valid(&new_spec64->it_value)) - return -EINVAL; - if (old_spec64) memset(old_spec64, 0, sizeof(*old_spec64)); retry: @@ -865,6 +861,15 @@ static int do_timer_settime(timer_t timer_id, int flags, if (!timr) return -EINVAL; + if (flags & TIMER_ABSTIME) + timens_clock_to_host(timr->it_clock, &new_spec64->it_value); + + if (!timespec64_valid(&new_spec64->it_interval) || + !timespec64_valid(&new_spec64->it_value)) { + unlock_timer(timr, flag); + return -EINVAL; + } + kc = timr->kclock; if (WARN_ON_ONCE(!kc || !kc->timer_set)) error = -EINVAL; -- 2.20.1