Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp7216132rwd; Tue, 6 Jun 2023 07:49:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ624OF099/kTnTYkHF5Se9VUeIznjBboSqZxNLh9PkNdl2IcU32teawANQ+VhjjJJQFuAQ7 X-Received: by 2002:a05:6a20:840b:b0:10c:6dbc:2810 with SMTP id c11-20020a056a20840b00b0010c6dbc2810mr3476903pzd.62.1686062996954; Tue, 06 Jun 2023 07:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686062996; cv=none; d=google.com; s=arc-20160816; b=Agc2OjBK++K3BGauzxs/O9IKV8B0TedG0DIrUHuSjhFtfixYP0yjsmMmj9chLerbQI COi/J/t7oF8u/GHa/PnyECJtQsCVAjoxNchnZ1AglmDuo00DdkzBmkhXZm3WCAnCUDTz ijRKsSHqFhEBEstBBfN1+hJYUX0wcrJ3K6J8oOuZn+3nljH7xbalTr2d+VNv+j5aTHmZ tqQNjNnCklqkmWq0eoK7jzXl4Kc5yvI+YO/Us+e/ln+HAxKrMjR2Mq/RJWMTj2mX7Kvi lL2tn4mns/31K82sVqCmOavBtCT9fMqA9D6ZTxnoRMYhaBTMraKUxOcS5FbP6pCpCs+h VqnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:mime-version:references:subject:cc:to:from :dkim-signature:dkim-signature:message-id; bh=PVNa4KLijTQ7CcOYu3CDLgD0Q8pt6GmBRvk3JFfaO1Y=; b=Al3ftaQxo9SdDDh6f+pxh0goLYtGsJwSi5tBTCI+mpb5q+1PIttMaqv7gZNLnUluON uKZeVVkuqjEiYRi9Lo8zK1OkIpEeeWKgGAbfVWAMqyJ0shid0WYp9Gr5QWSI6TQGRitL 3Dq2pXhYgIXpiJjhu1yzScirSqd1eUQEY+SZ1tcZyCtI7a2kcEjykIctCSVMOSAZH8CA aQaSkCDCZJ2lmvZMDTmHoxszeUd5are5Pd/7igchKjyRtdkCxJAA0dmUylMae8QysEhB JP0dOyME6HgDfLgTAu6jE2T/K3pnc1J/lBNqbhd4P5UI1nX0fSp/r0Szn5FwU3BP6hnF C/BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3tnlpwZR; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r142-20020a632b94000000b00543ae6f9574si3599477pgr.681.2023.06.06.07.49.44; Tue, 06 Jun 2023 07:49:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3tnlpwZR; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238204AbjFFOj3 (ORCPT + 99 others); Tue, 6 Jun 2023 10:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238183AbjFFOit (ORCPT ); Tue, 6 Jun 2023 10:38:49 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E231BE4 for ; Tue, 6 Jun 2023 07:38:01 -0700 (PDT) Message-ID: <20230606142032.433429880@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686062278; 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=3tnlpwZR7AOO7Yh1fmxAmC8HLkEI6QD76zGVnsBJknf8UMe5AeHLON600517dH6ZfYHN1t EsBV1RT/DYKL87zBhaT5vrA6XEstqCzGt65cKoBch1fUhqGgkU0qJFAAFHmZG+cuw8mxxM vTIynumi25/W/Ey+lLIyrp8rJAj3Otsm1xnxe/uPFsybfThD3/Jl3yakh/8aC+J1+oQ21b sCxb0iDMYure57654loi6WY4SlZSuiJ//iQ7wp0Xz94G/FiHDrYQq8FwolQVk48G2kPCjd JuVT+hfISI+Am4uRRb4esCZptkkEH5WdA2cnn263pWvRwpz9Pkk51VmspWig5w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686062278; 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=zuo3CLae5BOp6gIZnvW7WN6SahTzqoMNx2aNczVT7msm1Y6lFSCoT8iMQb3JZiQXA9Wm/F ZFr6Z0bcwUN/2uBg== From: Thomas Gleixner To: LKML Cc: Frederic Weisbecker , Anna-Maria Behnsen , John Stultz , Peter Zijlstra , Ingo Molnar , Stephen Boyd , Eric Biederman , Oleg Nesterov Subject: [patch 25/45] posix-timers: Drop signal if timer has been deleted or reprogrammed References: <20230606132949.068951363@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Date: Tue, 6 Jun 2023 16:37:58 +0200 (CEST) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)