Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp414411pxb; Thu, 23 Sep 2021 02:59:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhp4YurMXjCN9RZCI5Ahh1esgSamTBzXcT39ajF9zOkqU7MhMd/43grzSAb8AfZz0U/J7t X-Received: by 2002:a17:906:d04b:: with SMTP id bo11mr3960373ejb.513.1632391167967; Thu, 23 Sep 2021 02:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632391167; cv=none; d=google.com; s=arc-20160816; b=eortg+U3kGfMaeUa67aIJgl/VNpQ75N4Y9X2SfXJzcTiLGs0rHocJA5h3bgfWFhx56 jgmmkAaV7AuZE7hOQiUr3oOtu2Oz0ozdPZL6V14IFHbgLe474icpRz/okT9g2jbR36hN 9I41obO/QrpPfevI7scUgEv+KVQyGoVZc+QU6kcJ0S5hsDmfYOTqJIj8u643Ie5hfBmv w1rEcafp59ZCOzcr0uddtGi8KkUSCpYKKRm6oKrZAPJJSHpjZvT5QTaHF322hv9kojRO CRUoEMgBcoMeCVtQH1waDwGoQ4kRFAR83cEssQ0D1qhwFaupJkwplTJsS8FrVZElZ1Mn XP4g== 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=5Je/SAgT/J2pQ60AakoXLDn4EAT/Zw7YJ40Gy39s3h4=; b=JPDmfTbGS7YgsclXwLGx5IvQbeIodJrcPapMZdLKdDwXS4j0qUUjqpUh9PuMcHsRLW X7yDAkXgELroFwqhb8ZrnWafmAwzBp6mr7r9Y+W2xRjablmgNeBiNFUM209lUKIzedaa uld6pLnfeUkGkHwI21Y1hBxc9VJ6QevwXIUY7DS20cxC28TbQIoNCffUelcgtLQsGQg2 EVp+X5DFCjFreTgWKkAyah7gu82CTWLUWyjxAwpyhboMafmmqx+/Th90l9UmedQw7zFS 6uzj/GO1lnUz+HfzVaFj6KUFCuvYDlewrNN/jSyiTjiozEz/GUzJ89mZfYO3K6YsOuMR 0oBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=AQqq6pSD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=+7TybvjJ; 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 c4si4348306ejc.492.2021.09.23.02.59.04; Thu, 23 Sep 2021 02:59:27 -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=AQqq6pSD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=+7TybvjJ; 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 S240301AbhIWJ7S (ORCPT + 99 others); Thu, 23 Sep 2021 05:59:18 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:33440 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240233AbhIWJ7R (ORCPT ); Thu, 23 Sep 2021 05:59:17 -0400 Date: Thu, 23 Sep 2021 09:57:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632391065; 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=5Je/SAgT/J2pQ60AakoXLDn4EAT/Zw7YJ40Gy39s3h4=; b=AQqq6pSDO/+4Z9AEpJv5289EGDrESGWx9Y4YRLSjhBtI3+P64BDXHIB1Lbb/GLmvUAsqd3 wWDm7gIwpSpJRNIUXE8V4wQievj+Esx5kM9ybBxaATysYDqVIFk1/ytynjho9B0jNSCbDO m2YAylxZtbD0rqkr+2o0lYaj3nU+VOIKR8jycGC2wArHAV36O0P+Bd7H8KbHN2sma6mRS5 ssPi2i1FlWdBGaAp1c2GeCIoIyy8mBY9ow5Tr74v2cd1iWRgSmKwKFrL3piAry8KXnFzMD fCxT7VyEzv9QUCEVMbopQTbXExAV5PJB2RNXZ3U/Yfvr9I9v4F9VKBFFljXe7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632391065; 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=5Je/SAgT/J2pQ60AakoXLDn4EAT/Zw7YJ40Gy39s3h4=; b=+7TybvjJEDtY8QglG6+HVQhv0CXaGQP6FbO0taggMQ5PhILKarGnEDi0ByHUVWkwL9ylK/ RzQspBDH+6OYGTBA== From: "tip-bot2 for Frederic Weisbecker" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/urgent] posix-cpu-timers: Prevent spuriously armed 0-value itimer Cc: Victor Stinner , Chris Hixon , Frederic Weisbecker , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210913145332.232023-1-frederic@kernel.org> References: <20210913145332.232023-1-frederic@kernel.org> MIME-Version: 1.0 Message-ID: <163239106440.25758.1989053609281702993.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: 8cd9da85d2bd87ce889043e7b1735723dd10eb89 Gitweb: https://git.kernel.org/tip/8cd9da85d2bd87ce889043e7b1735723dd10eb89 Author: Frederic Weisbecker AuthorDate: Mon, 13 Sep 2021 16:53:32 +02:00 Committer: Thomas Gleixner CommitterDate: Thu, 23 Sep 2021 11:53:51 +02:00 posix-cpu-timers: Prevent spuriously armed 0-value itimer Resetting/stopping an itimer eventually leads to it being reprogrammed with an actual "0" value. As a result the itimer expires on the next tick, triggering an unexpected signal. To fix this, make sure that struct signal_struct::it[CPUCLOCK_PROF/VIRT]::expires is set to 0 when setitimer() passes a 0 it_value, indicating that the timer must stop. Fixes: 406dd42bd1ba ("posix-cpu-timers: Force next expiration recalc after itimer reset") Reported-by: Victor Stinner Reported-by: Chris Hixon Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20210913145332.232023-1-frederic@kernel.org --- kernel/time/posix-cpu-timers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index ee73686..643d412 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c @@ -1404,7 +1404,8 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clkid, } } - *newval += now; + if (*newval) + *newval += now; } /*