From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 39FF7233149 for ; Tue, 25 Aug 2026 16:58:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787677101; cv=none; b=abZRswhupItE77eQvsozeJ7re3QqOXtPGljLcJ2XdVYV8dOhYBsNXROcHTslUNjGuy6VIDf5SuCFdaktQdKkYCiQ4oP5CJ9C2EAnOXcV/cX9VBPQvIFXmmKyQFm9McxGAlGn55suDEZylUu6IdXszpFGGhmdMbtdyTpz9m9nCc8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787677101; c=relaxed/simple; bh=ziq1lw2GS943cFh1PLo7aeVFRQFxalnti+y8aCwNaTc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=hWdrrgcxalLlIvMYGu+qdQfRuf/0Nl0C4F8c01b4igxtydegQwq1xA1VYtcIlvq/X8Im4M/jbMNIPx2IBRlq+C1j2c5mCM1cacqgSy+4V7I/XsGGy4gENquI6am83mPYjw+kiQ9F/m77KmcLSNVx4qul6qQrBv2aJryfID9K44E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JB5ROWOt; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JB5ROWOt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38F001F000E9; Tue, 25 Aug 2026 16:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1787677099; bh=y9uG9iiyvNJLyFo0T/nzSWDXrkYuDBERegAWpOLKC+I=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=JB5ROWOt/DPf3hoTPsC3LBPoihKvC/6naH+COuFeEnYgLmlUOaVJBrWHife5yyEVo R7VTFrpiFPJbEqtM56HeVtHcgjO/eQZtjAP0UHfM3J3fWA+Jrw3R6QOcgSHbaknhF3 hGsyD9tIQ9uaVJzvDw1t9kfxt6BbB9c2FuliILcrDswaWqTO67E9nSdbUuy3pKp/uC 5a+vZIwfppUjC9kPcDSmJRCeuDTDESKxJOCEob1U5K0PfIkVGBoeZ4pq8wjb3sNVkF khgCY2W+lN07u3aGXU5tutUrfLbElmQHvSwTCZd3tkUA5fn+wkhcFKA6q0ho7jWCFz 40OzZcwIjXOXQ== From: Thomas Gleixner To: Frederic Weisbecker , Oleg Nesterov Cc: Hyunwoo Kim , brauner@kernel.org, peterz@infradead.org, anna-maria@linutronix.de, ebiederm@xmission.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] signal: Use list_del_init_careful() in flush_sigqueue() In-Reply-To: References: <875x10hrkt.ffs@fw13> <8733w3j1i1.ffs@fw13> Date: Tue, 25 Aug 2026 18:58:17 +0200 Message-ID: <87pkz6gms6.ffs@fw13> 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 Content-Transfer-Encoding: quoted-printable On Mon, Aug 24 2026 at 15:59, Frederic Weisbecker wrote: > Le Mon, Aug 24, 2026 at 01:54:26PM +0200, Oleg Nesterov a =C3=A9crit : >> > Hmm, at first glance... If we change de_thread() to do this _after_ tr= ansfer_pid's >> > (before release_task(leader)), then posixtimer_send_sigqueue() doesn't= need any >> > changes, no? >>=20 >> IOW. Unless I am totally confused, we only need to flush the >> SIGQUEUE_PREALLOC sigqueue's which were sent to the (old) leader >> before it changed its pid. So we can do this >>=20 >> diff --git a/fs/exec.c b/fs/exec.c >> index a14f28b15607..550367e7fe6c 100644 >> --- a/fs/exec.c >> +++ b/fs/exec.c >> @@ -1029,6 +1029,9 @@ static int de_thread(struct task_struct *tsk) >> write_unlock_irq(&tasklist_lock); >> cgroup_threadgroup_change_end(tsk); >>=20=20 >> + scoped_guard(spinlock_irq, lock) >> + flush_sigqueue(&leader->pending); >> + > > Is there something to prevent the timer from firing on another CPU, > racing with this tiny window and queue the signal to the old leader? After > all exchange_tids() is just some RCU pointers changed but there is nothing > to synchronize the readers before the flush_sigqueue(). So pid_task() may > still return the old leader after it? You beat me to it. That's what I initialy thought when I added that exiting check into posixtimer_send_queue(), but then the trivial variant lured me away. :) Let me go and polish up that initial variant and write a change log. Thanks, tglx