Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2490376pxj; Mon, 10 May 2021 04:21:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjaIjCZ3iPECYA2eCTygCmWeDtlfkG7+USxW2yCaAEstQtAZ9aOYCooO1lWHmizp+KgGc8 X-Received: by 2002:a05:6402:177c:: with SMTP id da28mr28194786edb.135.1620645713906; Mon, 10 May 2021 04:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645713; cv=none; d=google.com; s=arc-20160816; b=WX3QYT/p/zmtv4QHW81E2fxqu7jRYmOUyXy7PkenChz3VSzBmHZfoJpvX52/lNWsKY LkvSZn65iBfjtTR2tA3gznVx+GwL6QNEp84qJGwT8SnQg951+4o0Um6DiauNYGi82Biv 7XZHWBm529xKYNctJhmjv1riUIYzWsknubK6WTR4kjleGPdhNF69lCwEZLC4MC71/sHH /BKSlgYmt3751GCf93ZdBhyaWKFq076k2qCtDyKGShHJYHAnoXvfyiIX+yKqMJq1WiiF AzvuLzdY24X6Mxx8CQBSK5rYQhaO8Po1qKY3jA/ikrHuo5qT7PmtLSB07hAcHThU/7/n i/8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Rl3Ce0IendET/xABtmD5thbLY9mvMbgq1C2Unp/VDRY=; b=KXSZ4L7jDWKBX7xYG89XZqRMpmoNovvFIGeD79D3QzQkwN9liHvJ5jrVr8H7h9WSsM ds32MN4UWd3L9Q0seGNuvjrzJke5Pu7piiE5GXitI51QAtIogOzMUw/g+t4NISRIr4Mf rGX+paUS2ZsD9BD4zg0ba4jXOvHiBqWe93h+L7l3DS7xsN5qem6h3i/5QoWU82kYSlzW KzZgSG6v5Mb6qGJHfgkVXhiK1cYgo+4Jd79S1LzV4GUNEh798LrZzlQWj/DAOrlznOLj qnU1/R8URR7Ub42ZjXKkPtnT9p/TiJxv3YYCsKgfOGwFyLx1kkKFjZi2u0lFVIjxbAKL hV4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1eBcfcTW; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c16si12862554edv.148.2021.05.10.04.21.30; Mon, 10 May 2021 04:21:53 -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=@linuxfoundation.org header.s=korg header.b=1eBcfcTW; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238440AbhEJLRs (ORCPT + 99 others); Mon, 10 May 2021 07:17:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233030AbhEJKyQ (ORCPT ); Mon, 10 May 2021 06:54:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3999A617C9; Mon, 10 May 2021 10:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643304; bh=EVCg1XGegpEbWfwV406v3j5pS0KOf3SUH5UaDhcl/Ac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1eBcfcTWUGQuGC35/Fcvc2zreTFM1dOQ2C8RUxOKVQmCSwAAPgddhSth4utjiYPl6 HVEeTTgI6uIGhiOdTW42o7jCUqz+yZT+o0N6nFXxJJzz1xTHvFUjbmc4H0DvMkay00 Bx6+VnNPJbz9Q6EtmR7uX4r8VDytsLOHRFf3jKWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , "Peter Zijlstra (Intel)" Subject: [PATCH 5.10 261/299] futex: Do not apply time namespace adjustment on FUTEX_LOCK_PI Date: Mon, 10 May 2021 12:20:58 +0200 Message-Id: <20210510102013.572972268@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner commit cdf78db4070967869e4d027c11f4dd825d8f815a upstream. FUTEX_LOCK_PI does not require to have the FUTEX_CLOCK_REALTIME bit set because it has been using CLOCK_REALTIME based absolute timeouts forever. Due to that, the time namespace adjustment which is applied when FUTEX_CLOCK_REALTIME is not set, will wrongly take place for FUTEX_LOCK_PI and wreckage the timeout. Exclude it from that procedure. Fixes: c2f7d08cccf4 ("futex: Adjust absolute futex timeouts with per time namespace offset") Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210422194704.984540159@linutronix.de Signed-off-by: Greg Kroah-Hartman --- kernel/futex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -3784,7 +3784,7 @@ SYSCALL_DEFINE6(futex, u32 __user *, uad t = timespec64_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add_safe(ktime_get(), t); - else if (!(op & FUTEX_CLOCK_REALTIME)) + else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME)) t = timens_ktime_to_host(CLOCK_MONOTONIC, t); tp = &t; } @@ -3978,7 +3978,7 @@ SYSCALL_DEFINE6(futex_time32, u32 __user t = timespec64_to_ktime(ts); if (cmd == FUTEX_WAIT) t = ktime_add_safe(ktime_get(), t); - else if (!(op & FUTEX_CLOCK_REALTIME)) + else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME)) t = timens_ktime_to_host(CLOCK_MONOTONIC, t); tp = &t; }