From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49C84C433E7 for ; Thu, 15 Oct 2020 14:13:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD28522248 for ; Thu, 15 Oct 2020 14:13:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jku5709T"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xpRQxwWg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728823AbgJOONp (ORCPT ); Thu, 15 Oct 2020 10:13:45 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38156 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726819AbgJOONp (ORCPT ); Thu, 15 Oct 2020 10:13:45 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1602771223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0MblahxxdvFHgwDWUgjvtntdmd40tCKymEtQpaSbYxg=; b=jku5709TczLf/IEI2LWL7lRlM4HazOcKaKE/facN7uxF1Dg6zReTeGFprxqQ0iTsX4cAom 3AivoOnyREXNkdWa2sakgTW9dpOR+auuxkVdy+KzccrRRBLzt/cZCVdkINU30H/xsLS1/2 81GP0SnvVQKOjXtxrwBHtUvtRpD6dsQj7n/X0INvqs70AOb3fRrizaXRPKtYnP86RjxjZJ 6tKiqHGbDW0u2BmxgfKivtF7n8mnQbx9aFVLacR529sBgdGth0OO8ZxpIMA1Ow0IWBEzat VAqITw2dUgye77g9rbEw2vm14cvAipoMVb6h1TjB+aB+e1DTO3eR8dCmc52grw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1602771223; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=0MblahxxdvFHgwDWUgjvtntdmd40tCKymEtQpaSbYxg=; b=xpRQxwWgOnSeDGPmR/KGoRxc3RSrHOIwZfp8nG7SiLAjvfQQGXlg5ypeFiyZa2A23KMu3d X8OyefJWOlRCb7Aw== To: Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , linux-kernel@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , Darren Hart , Shuah Khan , stable@vger.kernel.org Subject: Re: [PATCH 1/2] futex: adjust a futex timeout with a per-timens offset In-Reply-To: References: <20201015072909.271426-1-avagin@gmail.com> Date: Thu, 15 Oct 2020 16:13:42 +0200 Message-ID: <87lfg7a86h.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Thu, Oct 15 2020 at 14:26, Dmitry Safonov wrote: > On 10/15/20 8:29 AM, Andrei Vagin wrote: >> For all commands except FUTEX_WAIT, 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. >> >> Cc: >> Fixes: 5a590f35add9 ("posix-clocks: Wire up clock_gettime() with timens offsets") >> Reported-by: Hans van der Laan >> Signed-off-by: Andrei Vagin [..] >> @@ -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 (!(cmd & FUTEX_CLOCK_REALTIME)) >> + t = timens_ktime_to_host(CLOCK_MONOTONIC, t); > > Err, it probably should be > : else if (!(op & FUTEX_CLOCK_REALTIME)) Duh, you are right. I stared at it for a while and did not spot it. > And there's also > : SYSCALL_DEFINE6(futex_time32, ...) > which wants to be patched. Indeed. I zapped the commits. Thanks, tglx