From nobody Mon Feb 9 13:00:39 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E8FBC77B7A for ; Tue, 6 Jun 2023 14:40:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238293AbjFFOkd (ORCPT ); Tue, 6 Jun 2023 10:40:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238231AbjFFOjV (ORCPT ); Tue, 6 Jun 2023 10:39:21 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04A421730 for ; Tue, 6 Jun 2023 07:38:22 -0700 (PDT) Message-ID: <20230606142032.881951490@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686062291; 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=F1AIORQBsb8Q0wbN0ersqX3Q8WiAIjYPdK55avtTgbc=; b=zYwP+c1d0TKBY7umwUqJyZjwLRc75LhgtytLBn0aq2G7R+AEjzhXBYIIc0fMDCIezfOwju EfDzX3nUqEs7bEu4nFl8TNqFvnUb3gEV9jdmdsOKAiiVVWG+sjpYC0yoI5AT2EpQrAubF4 8U40jBTqyal18gawuojiioVpDPLa7G1irpHhsrUayCyedCUUitLHCjcz8nO1WV+pKkotKP oUbnNHJNKUMgrt16vS9OHNRm5n67pBjDPk1x9q6KEqWwqdCa8jIK7mMjvtPJDVxYygNgTs hVTBSjN1kruivBXxTnTLJTS7oHHj5Dy3Koz/4kh+tjAUjTPsJKTtE+HlZd2GYw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686062291; 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=F1AIORQBsb8Q0wbN0ersqX3Q8WiAIjYPdK55avtTgbc=; b=PXGS/1RDSbPqccGdfDQYlb/tXnCiLRy+k6oowj4ENqJgwDUvgVlmb55JC5BmOLQiKgKG7W PU5cWxeT8xHU+vCQ== 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 33/45] signal: Provide posixtimer_sigqueue_init() References: <20230606132949.068951363@linutronix.de> MIME-Version: 1.0 Date: Tue, 6 Jun 2023 16:38:11 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To cure the SIG_IGN handling for posix interval timers, the preallocated sigqueue needs to be embedded into struct k_itimer to prevent life time races of all sorts. Provide a new function to initialize the embedded sigqueue to prepare for that. Signed-off-by: Thomas Gleixner --- include/linux/posix-timers.h | 1 + kernel/signal.c | 11 +++++++++++ 2 files changed, 12 insertions(+) --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -168,6 +168,7 @@ static inline void posix_cputimers_rt_wa } =20 void posixtimer_rearm_itimer(struct task_struct *p); +bool posixtimer_init_sigqueue(struct sigqueue *q); bool posixtimer_deliver_signal(struct kernel_siginfo *info); void posixtimer_free_timer(struct k_itimer *timer); =20 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1901,6 +1901,17 @@ void flush_itimer_signals(void) spin_unlock_irqrestore(&tsk->sighand->siglock, flags); } =20 +bool posixtimer_init_sigqueue(struct sigqueue *q) +{ + struct ucounts *ucounts =3D sig_get_ucounts(current, -1, 0); + + if (!ucounts) + return false; + clear_siginfo(&q->info); + __sigqueue_init(q, ucounts, SIGQUEUE_PREALLOC); + return true; +} + struct sigqueue *sigqueue_alloc(void) { return __sigqueue_alloc(-1, current, GFP_KERNEL, 0, SIGQUEUE_PREALLOC);