Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4138759ybi; Mon, 29 Jul 2019 20:06:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJAopW9faUfI57lswl0gFzU5hKUoOfcgUM5s0uF5eZciX1ks4iB/V7ZHCGcDPWifdL+Zyb X-Received: by 2002:a17:90a:20a2:: with SMTP id f31mr113828853pjg.90.1564455990838; Mon, 29 Jul 2019 20:06:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564455990; cv=none; d=google.com; s=arc-20160816; b=Esj+/qJ3uFG2Wu6kQ47czD67Qa5Nrlj18Ygxc/39R+JVDRAa/htEPNiP86IY7Ethyh 47ulnIm+NGp7aJ36b5co6TwWAS07oVpE3AlS2VRuoGbA69rklD4zYC/5lRDhaesGyJ/g CQsWl4tsXcRIQXaePC5JH1KGgzCgSwD2glOO3n88CcFV4AfLLtEKvjpbePYGg1TpSNL8 gCaSlOmBYV/m9uN9TA9+Jv4fvmI3vUlLTV0Cbq67wTBeBvQIO+0GXQCo0oWSOHmWSgSL YmX7AcNe0Ds/zm9MM8a2HYhskFa0/RI0RfnRKxSAtiM1aYmDzPhelyUZERDdv+a1KxkJ vPqw== 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=s8TNpPfRzkd/STVPqA/OmSveOcsf2nPj4laDcq0UFS8=; b=v6xyCJ48HBURLAZ2GIReiKz7kgi5+Up48bh8RCvysWd58akHcyXP+FjYXHRtiTC8rt /+wIbx+FutYjwHsdTeRcYvoprxVl4TC4kuJQAVuswt+8uAAynSJNHy7EEY0xzHQvqYRb QWQi5+l/XoFWb2JRssUGvhefxXdNr39SuuzZNtVrvboMKtiLia9TvNaMyEiU75Z83NJ6 0xHsi+uLtFBbYihCtiP9WeCM8oXAFKn89TmofTZ32D+A0BjkfyDZrWrJ5brdeBvQ8na6 R8AUdU3Z2LRHJVm4WUIUZOduNJlMbTOJJAT4PQ8MN69CbzyTEZ2mjzB2yqkJpzdLbKw0 p9KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arista.com header.s=googlenew header.b=XLSDH1Nz; 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 h127si27469962pfe.44.2019.07.29.20.06.16; Mon, 29 Jul 2019 20:06:30 -0700 (PDT) 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=XLSDH1Nz; 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 S1730617AbfG2V71 (ORCPT + 99 others); Mon, 29 Jul 2019 17:59:27 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:46935 "EHLO mail-wr1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389456AbfG2V7M (ORCPT ); Mon, 29 Jul 2019 17:59:12 -0400 Received: by mail-wr1-f48.google.com with SMTP id z1so63447847wru.13 for ; Mon, 29 Jul 2019 14:59:11 -0700 (PDT) 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=s8TNpPfRzkd/STVPqA/OmSveOcsf2nPj4laDcq0UFS8=; b=XLSDH1Nz0pN5WkflENvDp7KvTw3mfOAw93+QETM26nPcTcrXiHz5NCHaZicpwAVudS 08sGxWHWCupk5AS1eb3Mjj7DhmEKpoJ/B5/v/mrJQoV/WVL92kuuyyGGTw+xXJ2AtJo6 wv3RjmYNrOp5Ebfu1maTC5CY+3LEOYTfdSI1CCMzXydYhNY1rlpTlQ79YydXQC2ZFYRL Njx7Y0qq+Y6FPL9qigsLXWF0UcXOe20NVim2m8H5Vyrz+fstXo1QuJ1i2hWsPdIqoo+6 diIJTvcmtx7MM+RCtUfbnWf0gBI/9EBVwLyUWh51gclK3psKYLncKyeIdB92GGwUggDD u8cA== 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=s8TNpPfRzkd/STVPqA/OmSveOcsf2nPj4laDcq0UFS8=; b=kRT05AYuwsjftrD9wrhP4C6NOZs/arUynlEwhgpSHBxrNHbSgGLCJnR8clZ2RKKMUB G5O5pcfgXZHalnJMDekbImKOSFPAI/evoEbIi0GOHtoaetahHac7g9hPLL20TNxzhtpf inZea/8p3LGHGBNtHQTK6osbEo8ZekFZZQZxqGys7tH9Y5qzSNb7hcQrRNtV2BcegJTc AO1MevoU6eqTAZXHSkabex7gkskNm769gJU4fvCVV1Ej1nPJTp4i4SRF385ptRKHK72E yhNPPfL2hTS7zX122fm5lSmAxk7gflvC21O3o3TKVFFkT1EuwJOOUPOM4loOnkjv1Hyk Jjhg== X-Gm-Message-State: APjAAAUKE8txo1x9u9LXQy5wSuAVav3VOpLlTgWdxKDJwXOiFanUGlX0 BXC1vtU16ixahyLkzodMA/uF9Xa8VkC2rRR6FqRZedeNg7KplehaVUPdEv5ke309XzFm2MTonET 8NBU87bby0xBPLhhn61dplRrhjxu0c2x/qr29tVF42iTmN8FIOSfuUF5UdNmB6Vhlvf6VER3e/A iFKZyYhj33hHma7pzuorgd8ma8bR0GTAz3eR7qZNI= X-Received: by 2002:adf:eb49:: with SMTP id u9mr2699879wrn.215.1564437550243; Mon, 29 Jul 2019 14:59:10 -0700 (PDT) Received: from Mindolluin.ire.aristanetworks.com ([217.173.96.166]) by smtp.gmail.com with ESMTPSA id x20sm49230728wmc.1.2019.07.29.14.59.08 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 14:59:09 -0700 (PDT) From: Dmitry Safonov To: linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Dmitry Safonov , Adrian Reber , Andrei Vagin , Andy Lutomirski , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Thomas Gleixner , Vincenzo Frascino , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org Subject: [PATCHv5 12/37] timerfd: Make timerfd_settime() time namespace aware Date: Mon, 29 Jul 2019 22:57:32 +0100 Message-Id: <20190729215758.28405-51-dima@arista.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729215758.28405-1-dima@arista.com> References: <20190729215758.28405-1-dima@arista.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CLOUD-SEC-AV-Info: arista,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrei Vagin timerfd_settime() accepts an absolute value of the experation time if TFD_TIMER_ABSTIME is specified. This value is in task's time namespace and has to be converted to the host's time namespace. Signed-off-by: Andrei Vagin Co-developed-by: Dmitry Safonov Signed-off-by: Dmitry Safonov --- fs/timerfd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/timerfd.c b/fs/timerfd.c index 6a6fc8aa1de7..9b0c2f65e7e8 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -26,6 +26,7 @@ #include #include #include +#include struct timerfd_ctx { union { @@ -196,6 +197,8 @@ static int timerfd_setup(struct timerfd_ctx *ctx, int flags, } if (texp != 0) { + if (flags & TFD_TIMER_ABSTIME) + texp = timens_ktime_to_host(clockid, texp); if (isalarm(ctx)) { if (flags & TFD_TIMER_ABSTIME) alarm_start(&ctx->t.alarm, texp); -- 2.22.0