From nobody Fri Nov 29 00:46:41 2024 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 AB73018A922 for ; Fri, 27 Sep 2024 08:49: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=1727426947; cv=none; b=c9VliCyrRl6XCZHYf4bmDmuYVn5+fq9OnmiF4HkL6oMswqTTVoo6OLg3GGBvTLouFPuC9vs2k7Ba2RX80RyvNmjTtQTazA84rIZJo19rHA23Czp2RG+tnKxeg7gFb35B6vzuPy5qCTY95VUEGWFxMNtGKtyBx91OiBIyneuA4t0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727426947; c=relaxed/simple; bh=HlE/rB9DJ2iFpW51kf3egByzflBOf5vMGbgvRd4sVBM=; h=Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type:Date; b=bqHnmKq1FYneEWonj6fo1i5DRIHvRx08zUIKnXO5JA9EeyXhQyie5UomvmqiFbLyfm+PsYpeYL82T37rlLoC9EB/h3axNqoyTYtWrrls+3ONws6OVaq4j/6PA8Kqe1fwgJPrKGvFUxgZRRGT+G1+ET+yPzHS2XA5zsnVTKrJ23Q= 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=20P5hVWc; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+SHmljH2; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="20P5hVWc"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+SHmljH2" Message-ID: <20240927084818.130965127@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1727426943; 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=WfdjifQzaEkh29PcCz6zrqcoHSPORIhLPU9iUugztoc=; b=20P5hVWcVxQwz/IrPw41/5Ib+IYJqaySxrIUlMArMipyWKmAovYdW4pZtK6Ls9srU2/mej 9UOqOk3QcMbDGyL2rP5SR7Y2wkBcQNu+jzWI6o2tgjaDpkZuiWR1Gbed0bRdbK0asIMRh/ Slmbism4G131D6s1AMOTRx+XWoAmkSCDOrxe5GnxNtpCd8c/66LcOtwLMx0tf9gmPcDyef kfIhOMa6a1M0H9c7QR9gchLRgdbALGnPH11WjqYjhdR1YuSpfAdIXFZ+/vYvRhTj+pOr0F hVrjMBehDPHDEuooOkUuUO5T8kHFOHxhaWt4mVwk5mVvq9+yZ6ZJ5YR+0FyZEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1727426943; 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=WfdjifQzaEkh29PcCz6zrqcoHSPORIhLPU9iUugztoc=; b=+SHmljH2bQaF9cWtzz8yzRpHADeUmhsQjrgWRLpgSpmeAX4xlFhIqccCmwntoRMoC/aSZx gc5H2TLxH3IiNkAQ== 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 v4 20/27] signal: Add task argument to flush_sigqueue_mask() References: <20240927083900.989915582@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Date: Fri, 27 Sep 2024 10:49:03 +0200 (CEST) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner To prepare for handling posix timer signals on sigaction(SIG_IGN) properly, add a task argument to flush_sigqueue_mask() and fixup all call sites. This argument will be used in a later step to enqueue posix timers on an ignored list, so their signal can be requeued when SIG_IGN is lifted later on. Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) --- kernel/signal.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) --- diff --git a/kernel/signal.c b/kernel/signal.c index 48bceca90a91..93c2d681309c 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -724,11 +724,10 @@ void signal_wake_up_state(struct task_struct *t, unsi= gned int state) =20 /* * Remove signals in mask from the pending set and queue. - * Returns 1 if any signals were found. * * All callers must be holding the siglock. */ -static void flush_sigqueue_mask(sigset_t *mask, struct sigpending *s) +static void flush_sigqueue_mask(sigset_t *mask, struct sigpending *s, stru= ct task_struct *ptmr_tsk) { struct sigqueue *q, *n; sigset_t m; @@ -866,18 +865,18 @@ static bool prepare_signal(int sig, struct task_struc= t *p, bool force) * This is a stop signal. Remove SIGCONT from all queues. */ siginitset(&flush, sigmask(SIGCONT)); - flush_sigqueue_mask(&flush, &signal->shared_pending); + flush_sigqueue_mask(&flush, &signal->shared_pending, NULL); for_each_thread(p, t) - flush_sigqueue_mask(&flush, &t->pending); + flush_sigqueue_mask(&flush, &t->pending, NULL); } else if (sig =3D=3D SIGCONT) { unsigned int why; /* * Remove all stop signals from all queues, wake all threads. */ siginitset(&flush, SIG_KERNEL_STOP_MASK); - flush_sigqueue_mask(&flush, &signal->shared_pending); + flush_sigqueue_mask(&flush, &signal->shared_pending, NULL); for_each_thread(p, t) { - flush_sigqueue_mask(&flush, &t->pending); + flush_sigqueue_mask(&flush, &t->pending, NULL); task_clear_jobctl_pending(t, JOBCTL_STOP_PENDING); if (likely(!(t->ptrace & PT_SEIZED))) { t->jobctl &=3D ~JOBCTL_STOPPED; @@ -4169,8 +4168,8 @@ void kernel_sigaction(int sig, __sighandler_t action) sigemptyset(&mask); sigaddset(&mask, sig); =20 - flush_sigqueue_mask(&mask, ¤t->signal->shared_pending); - flush_sigqueue_mask(&mask, ¤t->pending); + flush_sigqueue_mask(&mask, ¤t->signal->shared_pending, NULL); + flush_sigqueue_mask(&mask, ¤t->pending, NULL); recalc_sigpending(); } spin_unlock_irq(¤t->sighand->siglock); @@ -4237,9 +4236,9 @@ int do_sigaction(int sig, struct k_sigaction *act, st= ruct k_sigaction *oact) if (sig_handler_ignored(sig_handler(p, sig), sig)) { sigemptyset(&mask); sigaddset(&mask, sig); - flush_sigqueue_mask(&mask, &p->signal->shared_pending); + flush_sigqueue_mask(&mask, &p->signal->shared_pending, NULL); for_each_thread(p, t) - flush_sigqueue_mask(&mask, &t->pending); + flush_sigqueue_mask(&mask, &t->pending, NULL); } }