Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp486035lqp; Mon, 10 Jun 2024 09:49:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUTY3uP7emASyh3I6db2SQIiy9mgrfEB09W36YLV6Px6jvHbp0WxlgeUZB2AlYOd60I4xNov0FI1Imm0U9LXMOTDnEUzam8+Eb5VxxCdQ== X-Google-Smtp-Source: AGHT+IHBqNxZYFCmc5NziJML62WIMJQ6IkrvEd9FLnJuyS4HuRmuZ6Kw+cloDFcmP1gi7ns1V2t+ X-Received: by 2002:a05:6a21:27a7:b0:1b7:a9d4:f4e1 with SMTP id adf61e73a8af0-1b86bc48bb2mr215548637.5.1718038155430; Mon, 10 Jun 2024 09:49:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718038155; cv=pass; d=google.com; s=arc-20160816; b=uX/NA11WulsIg8b5X8bhERjSQVpFgJejVW3OuegSYBAetNL0eHkrjzWYwxDsbLZ+rb lBuUmPTvy1XFWRP6xSGF79fFsmWHvGtjmoVzxkVa3m4ybxeSVqhBtOZNgr7C2Ks4s/Gq W+dQo5acMmONIjXO8mv3kg+wIVAaFm0FW4X+3Ja/oREgjEo4aNZ5Nww4YE1vKEZDDRvt wzoxaGZORaZbSsW0cC2zxcqNtD/5awNWffzK8XXEzZtkKhg72Sg3AXsufyj7Kgj3bhMm JiM3Mznjbp7n9ctE9OzHqfKEXUXljnqkmIhM1l4msf4Qi/u63K4VCDDJi+bFgTL85AN5 fhuw== 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=QpVFfX+BMDYm5Zwd87xFGQHwhHlgo6UWEB/NKRWYGfHqbOzUO/4vxPaQef8nWkN9fO kEHJ6ZBuQea3SBEA6KTd88+AHZboWUQWXeZe4rTFoNGsHJT4Tnw8oOAtzXKDsQ/k/I7o 2j5uC1Zv2LppR6FeLBBjAbHw9jypTT7tb7sb0t8pZUyrI8uTah9QGHWAohIsZMv3NG9w xIKzu+XhfrtJlw/fUj1oNlDGBGjZ3uEa4gccxNXzWWN4fMxgxUiN9qcO4G6qDBz6JGSh M0qfLfi2slCMaTIjM/yIcYbDh6MxKCUsOl91ucvd34Is1k8zEnIyLbuOQvzHLwmXxhHu byAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FqXblgKu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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-208594-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208594-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de294fa19dsi4366703a12.694.2024.06.10.09.49.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 09:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208594-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FqXblgKu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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-208594-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208594-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7CB872847E3 for ; Mon, 10 Jun 2024 16:48:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4F6F156C49; Mon, 10 Jun 2024 16:42:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FqXblgKu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="k6ofh+DP" 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 78E9D156898 for ; Mon, 10 Jun 2024 16:42:45 +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=1718037767; cv=none; b=EfKMhw2sDW2lPt71X7CEX7iDKKmjJIvycjDH34EjMnY4Dx941Fx/zPEtNXL9cuHC1yTZANppN7lffoQwIpthjnFg1Z9N7UWyY1DyKH/2K+Mhev8t7uRvUq3TjZHGX2WI+TbSKp/zl2AptS8WwGH4rHRhKuZW4rgAKSRzTPTVHuE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718037767; c=relaxed/simple; bh=5k+o9FSXZnXGzFOAjEfjafxS6KdlxmAI2+L7+gmWoPY=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=bYNqxUVcpNzH74bw1SmmZFWtFMxfNflq5mA5tYziCHxz+SMVUl7A0T3YSaaLOnzs8vzgPOTUb1OD/SXuKk7b504qF6668KeZhVs1v+YcYMbkAnPSMAGqF2CERdrTgWRfo7I6SUYJU8SjKWE9zFUeH2ebB1NeKZK/TzWAmBxLy20= 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=FqXblgKu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=k6ofh+DP; 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: <20240610164027.364129340@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718037762; 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=FqXblgKuRlgHyqXKr1+nkH7FnQ5sV67sE3uyszHAkKTxQWdqZ4r+eA7+RM+rAxfR6Tvqt/ 6MVO4dj4JVhS6MHEjd0DUatdXprJF9GTwDCmMdDNQFLR7vb6oAu2RR64bqZs8ax5T8Bk/h 8NY+LPTHoVC7iXIs9CqQPkmdDrnIdT14zbwhMTORnfiAX7+N5zgZ3ckXxV1/7fYtjVFH3A gmsSvW7bPonv9kGeSljHgp8YJ7S0qAYoRumw1krB20yEnR0Va/b9DuDwXxoAB6HVUU7VWc WU2KZVKSWWLkPVuPGAv5W0gQuvusOHQG+PwGA8d58fsBNTsvTGF17rdLir5K+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718037762; 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=k6ofh+DPwY9Zlac2y5feg56pVoQUDqHibfKHTWQW9rUBwLoSspOxVzMlpE1hU7nbj1ECP7 l6xUwgee4mSa0bDg== 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 V3 30/51] posix-timers: Drop signal if timer has been deleted or reprogrammed References: <20240610163452.591699700@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: Mon, 10 Jun 2024 18:42:42 +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)