Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4579034pxu; Tue, 20 Oct 2020 23:11:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKfsldLPduEISEUvm28s3IRBMBghcoNN0Ct+GDh7KrYLnjz3STHrzY2p+24al14pqOdgnx X-Received: by 2002:a17:906:b841:: with SMTP id ga1mr1827603ejb.29.1603260676094; Tue, 20 Oct 2020 23:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603260676; cv=none; d=google.com; s=arc-20160816; b=JPBUHwiTI+o367BQhHjBjBKHIxgkCxWXMlSqxqVnjM/dCsfpPQho2EJ0ZbXvrdEwaV PwgwOnivUJuRlJeWY/83eLNaicpqcK0CH/+z0/myH6yYTasRhrJZdwEvjqDJptWWbsFF PMRCQ0qBQtBsdZVt9IbYIDcqClcp+ymkFlwviIcJvC7/PDLQGs4hIhiuHuDii8QQ+7iV gzMZguMOM6U97Jx6v+/cRGghnyP0XvashxaiGV4hXlGNNLBhHBau68ZYnxRLS3+XX6MK b5mCSWGwCpHbuJLTkVY/PCl/7Ipa6gD2qz8Pp0oPY4HD8tao3UCv94Ngm9Hlcutd3E8N EoRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=uWs+ivyuBL9M0T5dbDcvO3t/OpLiDzKuGtHUeHzQOdQ=; b=JWiiH/YPqlh/BKmIFONfBT/nk+ogKkg4Q+VJGi2Qmb7UklL04b98Huw+EOB4glhT1Z 9I/mp6AKDQP7CWd2TmjLXps/dVH/JaWHsAshHdXOXAPZJWhRrLvwJ33NjVdtsAMjgUZd gA829M6uI/F2qfCYf8yh78j+xxR5pMiLvQ/ZI95hyioSFr+8PFIbSxuDt60N4Hr87ZRY C4ZocwK3XyMyeVlhHyanDmvSv2XuMYxshy8qrpCBYc5I5vHSPvH7xb6MP3ie3tERr7oN qajQ6MUpbRoCmyDyf4CJF6jwn6AxptZwcL+9G6ii3DSeUfOVQAowBiLCIFsibY/bAgiG zb9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4WUbSztG; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si746909edr.288.2020.10.20.23.10.54; Tue, 20 Oct 2020 23:11:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4WUbSztG; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408591AbgJTPLa (ORCPT + 99 others); Tue, 20 Oct 2020 11:11:30 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39850 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731650AbgJTPL2 (ORCPT ); Tue, 20 Oct 2020 11:11:28 -0400 Date: Tue, 20 Oct 2020 15:11:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1603206685; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uWs+ivyuBL9M0T5dbDcvO3t/OpLiDzKuGtHUeHzQOdQ=; b=4WUbSztGQ/pUGNOwVUGzaiJwBfAzxoSaCI4Sjhg2UyBTwYdpGbf9HelbYjatdR7bo/M6pJ 0AYUczwsX1BhndygOo33ICN5anNaAn1YfybhHnSHCBCvRHsHamfHcn5btcgHuZkPB4sK1D XWo2p7uRLdf0lVYX2cZmBa1bKX5TXmgBibhhWXkH80vpAV3hDyh5dN+wbhxJvjYJWkkhMc iBbE7DXuipUf+XUDvamqFHYH3Ms50lo/ChtDufiRExWl7gcfsvMxCkLrexmxyGb+XMZRc9 7sXQb3ihzMK0DhV2RG8x4hQImBnZkYEBRJamHJzGiYbmk91ZqO6QP4oWcPK+pg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1603206685; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uWs+ivyuBL9M0T5dbDcvO3t/OpLiDzKuGtHUeHzQOdQ=; b=mHcXy71LUdJT95lsLYjVtdcNHrI5A5dVFi450JzG/tVTiYLWJUUuqQpOKQGfstWgxI5LI+ 7Hod7eb4xwvoyACQ== From: "tip-bot2 for Andrei Vagin" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] futex: Adjust absolute futex timeouts with per time namespace offset Cc: Hans van der Laan , Andrei Vagin , Thomas Gleixner , Dmitry Safonov <0x7f454c46@gmail.com>, , x86 , LKML In-Reply-To: <20201015160020.293748-1-avagin@gmail.com> References: <20201015160020.293748-1-avagin@gmail.com> MIME-Version: 1.0 Message-ID: <160320668508.7002.6186011089896637829.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the timers/urgent branch of tip: Commit-ID: c2f7d08cccf4af2ce6992feaabb9e68e4ae0bff3 Gitweb: https://git.kernel.org/tip/c2f7d08cccf4af2ce6992feaabb9e68e4ae0bff3 Author: Andrei Vagin AuthorDate: Thu, 15 Oct 2020 09:00:19 -07:00 Committer: Thomas Gleixner CommitterDate: Tue, 20 Oct 2020 17:02:57 +02:00 futex: Adjust absolute futex timeouts with per time namespace offset For all commands except FUTEX_WAIT, the timeout is interpreted as an absolute value. This absolute value is inside the task's time namespace and has to be converted to the host's time. Fixes: 5a590f35add9 ("posix-clocks: Wire up clock_gettime() with timens offsets") Reported-by: Hans van der Laan Signed-off-by: Andrei Vagin Signed-off-by: Thomas Gleixner Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Cc: Link: https://lore.kernel.org/r/20201015160020.293748-1-avagin@gmail.com --- kernel/futex.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index 680854d..be68ac0 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -3797,6 +3798,8 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val, t = timespec64_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add_safe(ktime_get(), t); + else if (!(op & FUTEX_CLOCK_REALTIME)) + t = timens_ktime_to_host(CLOCK_MONOTONIC, t); tp = &t; } /* @@ -3989,6 +3992,8 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val, t = timespec64_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add_safe(ktime_get(), t); + else if (!(op & FUTEX_CLOCK_REALTIME)) + t = timens_ktime_to_host(CLOCK_MONOTONIC, t); tp = &t; } if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||