Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp67645lqg; Wed, 10 Apr 2024 15:56:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUKDsAm2+ko7CYv4sYwBXWP5SY5nzU6QDJUzE3qNzjnpV5IYF/fmnFSDk9in26vj7rEXbVbAq1CRfPzLkFtU4hxh3pi+/oxCSti8LoUVg== X-Google-Smtp-Source: AGHT+IGb6dR7sHqqIfv605kHAP2YPgOJs+jN6gUa4oCdUQDPtGUYOZSq1U/Z1Ad7Hoy7XPxJ5+gK X-Received: by 2002:a05:6a21:78a9:b0:1a7:6918:9e96 with SMTP id bf41-20020a056a2178a900b001a769189e96mr5124688pzc.3.1712789818069; Wed, 10 Apr 2024 15:56:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712789818; cv=pass; d=google.com; s=arc-20160816; b=CXucy22HKWWu1RKCpEruOq5I9m7/mnrKq3d9D4k8qnrGqAE1Avy543ZJBi5EEqoUDA CkpysEv+B721F1+abOGpvU+ysnnoe70aRjfOa2KOlzNHEwWzQpFRRNiG1w/OY1fj1kp+ Pk7yG0EfloKHgYDJxaEOerzQPlRHgZv4AwlAy9TldylttDIrQnOc04Lg8hcrkyjE7+Nx 41XBkYJ9DZp6Ywl3v3/hhwqlLeuvInqQ7yQ8yIIrAUYGzpjNu2rgN5QcdcxdbyJfUxzG F9xi5sxWGJe41Tof9wWY69rHfyJ8UoUBrw3Z+YOmLSHzgbyzbU9Hvnr/VDgWOupTzey4 T5WA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:subject:cc:to:from:dkim-signature :dkim-signature:message-id; bh=PVNa4KLijTQ7CcOYu3CDLgD0Q8pt6GmBRvk3JFfaO1Y=; fh=joBs/8L+orz77ylyCy6wqNwwi35f7sYhLR+/TQjQjhI=; b=B7LxlHu942X4b2z5DSqGupfWfWix8A8l6o5oXJjV9hThKqFFUPmgQv+Gjx+kyD5Iie eiS62T8P0hVrb1uVdJ/cUW3GiXmk8xzb9k0cHH0976d5eUP70KB6FTAr4mpL3bQOyiXi CAXZLAHmSZqtpkBdPGi/ZKBj6KXkz94Y8KVLmWtvb5vHo/tF9a3i+cOpcNSoK8XPw+5k kk4ZigZWVAnMlrMUJrtpZ/VBliLs3zDMwUnRop+zz9n4EEIuncdOMOhuAbgBUwO7qNXK ANb+FAoiijFowYwRcTTpTVhUh+H4R5HqPTJb31ZMdSPAJOibt1cfKVLuKdXZJ16Uw8YD 0pRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EPSlGxp8; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=zb94DRPm; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-139482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id q36-20020a631f64000000b005dc3e746573si94817pgm.826.2024.04.10.15.56.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 15:56:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=EPSlGxp8; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=zb94DRPm; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-139482-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139482-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C1382B227DC for ; Wed, 10 Apr 2024 22:52:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D248D3F9D5; Wed, 10 Apr 2024 22:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="EPSlGxp8"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="zb94DRPm" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EF6057301 for ; Wed, 10 Apr 2024 22:47:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789227; cv=none; b=i5zttYu9p3a6bdfsSckoHFnwXCIxUT9Jg+ZWofv6bD1GkMqGb+MPgib54oe/yimrBa2nLDF99thJgUSokNqu/BSnI4JQGjhZkTLPFcxSPpcbkkqU+miIG+4QxlXMyN90Zh5+7hgPiWU1KIiIMQymhr6diP4DgF1GgRnSEv5TXpk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712789227; c=relaxed/simple; bh=5k+o9FSXZnXGzFOAjEfjafxS6KdlxmAI2+L7+gmWoPY=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=WyUHX1PnXfCMjtO5C7szpB9i9zTwGeZ4CViIRkg9gDftcg7gdFRcS5JXKx4mPCDWTmM5knFnYhbLLeCp7i/cOA7w1lsv/HaKPUp8lm5LLFnnwy4pYUWUXInilGkY443lo+H8QjC8D5TzslCT5ZuzULRGbwAkXDwhtbe6c38BuNk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=EPSlGxp8; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=zb94DRPm; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Message-ID: <20240410165552.772386179@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712789223; 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: references:references; bh=PVNa4KLijTQ7CcOYu3CDLgD0Q8pt6GmBRvk3JFfaO1Y=; b=EPSlGxp8JXih8Om6h4+9QdMXVPd8lx7psYKe5X7Gu8B0B3ImRetobqK89Hommw1hGBIczx wWJYhjwCG+BJSP+LNlODvhYswd4fzEsPb6HJUPE1yOtlTpKjx80w3p7ubFUyE/abtH2Xpw 4x4xZbpLdAY4rJPvjrZur/7dM0PB3Kvl5SJatuJ2YStmHVO8mE61HVOhdmm8b7MD7SHj+x +GQFtD+QREoUvpH+5xKbKbdOjz2pTwOwpKt6fISUtyM1PM8h425XkK46GzEI5jUxxRiDbG dIqIumyUmkndjun0XA7OxJzxfgK8vh9/sQ4oJINf22CvuEe/GD+f9Qa+GJw0Hg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712789223; 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: references:references; bh=PVNa4KLijTQ7CcOYu3CDLgD0Q8pt6GmBRvk3JFfaO1Y=; b=zb94DRPmudpBTbZH4Dd+LKY50DUrgeyku8OyhgZ7LMUeHbT7W5RzyggyT/keTQ/LEjTG1R sXuecsE6cnDPfSDw== From: Thomas Gleixner To: LKML Cc: Anna-Maria Behnsen , Frederic Weisbecker , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch V2 29/50] posix-timers: Drop signal if timer has been deleted or reprogrammed References: <20240410164558.316665885@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Thu, 11 Apr 2024 00:47:03 +0200 (CEST) No point in delivering a signal from the past. POSIX does not specify the behaviour here: - "The effect of disarming or resetting a timer with pending expiration notifications is unspecified." - "The disposition of pending signals for the deleted timer is unspecified." In both cases it is reasonable to expect that pending signals are discarded. Especially in the reprogramming case it does not make sense to account for previous overruns or to deliver a signal for a timer which has been disarmed. Drop the signal as that is conistent and understandable behaviour. Signed-off-by: Thomas Gleixner --- kernel/time/posix-timers.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -250,14 +250,14 @@ static void common_hrtimer_rearm(struct } /* - * This function is called from the signal delivery code if - * info::si_sys_private is not zero, which indicates that the timer has to - * be rearmed. Restart the timer and update info::si_overrun. + * This function is called from the signal delivery code. It decides + * whether the signal should be dropped and rearms interval timers. */ bool posixtimer_deliver_signal(struct kernel_siginfo *info) { struct k_itimer *timr; unsigned long flags; + bool ret = false; /* * Release siglock to ensure proper locking order versus @@ -279,6 +279,7 @@ bool posixtimer_deliver_signal(struct ke info->si_overrun = timer_overrun_to_int(timr, info->si_overrun); } + ret = true; unlock_timer(timr, flags); out: @@ -286,7 +287,7 @@ bool posixtimer_deliver_signal(struct ke /* Don't expose the si_sys_private value to userspace */ info->si_sys_private = 0; - return true; + return ret; } int posix_timer_queue_signal(struct k_itimer *timr)