From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out02.mta.xmission.com (out02.mta.xmission.com [166.70.13.232]) (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 007A8273D77 for ; Fri, 3 Jul 2026 21:37:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.70.13.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783114623; cv=none; b=QZQm8wqGFMpG5ByXgBGuSkNpuy4A7/8f4RffjmTLW0loPGm54tNcXP07QRfIk+nI+RQyCwgaqMsmQ2yg0T4V2TOwysi1K+9iL53ZnfwQ+yUTJni51YDYAzBNO2xwsG/ovwTHSEzVcdkQICa73Ydt0H9N4eddx4lN6XrL+S87oGs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783114623; c=relaxed/simple; bh=5OwID6mDs1NVRPMmbliVchE1kUQXkPsZeZ/bh2/beW0=; h=From:To:Cc:In-Reply-To:References:Date:Message-ID:MIME-Version: Content-Type:Subject; b=mBcQkYtaKwbTExtfPI2yTBFM5Lxx2cx/oCFrZr74/vUap2x8+hotBj6KDU/Unu0uEXXu1QEtj9LnQTSA4SH2ptNJIH1D4Eg4q66FEXMApQ/NJD/p/850orYLrdx6ItYqkDvVt3Tuept0tAPqsZABgVVqPGERM5hNArVjv6lJjmQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com; spf=pass smtp.mailfrom=xmission.com; dkim=pass (1024-bit key) header.d=xmission.com header.i=@xmission.com header.b=Ht0pE1aI; arc=none smtp.client-ip=166.70.13.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=xmission.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=xmission.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=xmission.com header.i=@xmission.com header.b="Ht0pE1aI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=xmission.com; s=xmission; h=Subject:Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=5OwID6mDs1NVRPMmbliVchE1kUQXkPsZeZ/bh2/beW0=; b=Ht0pE1aIVTwpfRaKH89+GNNKdG ZH8cLtivW4GFbbGlH2mbR8p40plqbkc4JIb5jzKFpkieYHcv87pGRWxB3Y8/grcNugAk/8mgWyI8X 2Mi5w0u5zsJ+cvUjx1RuBST7Z3U1B54A7MboQxNX3SBeqzpLMUFaTBzFfGEsuI+uu0Xo=; Received: from in02.mta.xmission.com ([166.70.13.52]:47694) by out02.mta.xmission.com with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1wflZ9-003G4q-HH; Fri, 03 Jul 2026 15:36:55 -0600 Received: from ip72-198-198-28.om.om.cox.net ([72.198.198.28]:44572 helo=email.froward.int.ebiederm.org.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1wflZ8-000ehB-L0; Fri, 03 Jul 2026 15:36:55 -0600 From: "Eric W. Biederman" To: Oleg Nesterov Cc: Andrew Morton , Andy Lutomirski , Kees Cook , Kusaram Devineni , Peter Zijlstra , Thomas Gleixner , Will Drewry , linux-kernel@vger.kernel.org, Linus Torvalds , Christian Brauner In-Reply-To: <877bnb4uyw.fsf_-_@email.froward.int.ebiederm.org> (Eric W. Biederman's message of "Fri, 03 Jul 2026 16:35:51 -0500") References: <87o6gx9rc4.fsf@email.froward.int.ebiederm.org> <877bnh7tnf.fsf@email.froward.int.ebiederm.org> <877bnb4uyw.fsf_-_@email.froward.int.ebiederm.org> Date: Fri, 03 Jul 2026 16:36:49 -0500 Message-ID: <871pdj4uxa.fsf_-_@email.froward.int.ebiederm.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1wflZ8-000ehB-L0;;;mid=<871pdj4uxa.fsf_-_@email.froward.int.ebiederm.org>;;;hst=in02.mta.xmission.com;;;ip=72.198.198.28;;;frm=ebiederm@xmission.com;;;sPfnum=0;;;sPf=pass X-XM-AID: U2FsdGVkX18C4CrR8jFTfQ3jPwn7+K9zngv5gA7If9g= X-Spam-Level: * X-Spam-Virus: No X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.1 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4997] * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Oleg Nesterov X-Spam-Relay-Country: X-Spam-Timing: total 469 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 4.5 (1.0%), b_tie_ro: 3.2 (0.7%), parse: 1.24 (0.3%), extract_message_metadata: 11 (2.4%), get_uri_detail_list: 2.6 (0.6%), tests_pri_-2000: 11 (2.3%), tests_pri_-1000: 2.1 (0.4%), tests_pri_-950: 0.95 (0.2%), tests_pri_-900: 0.79 (0.2%), tests_pri_-90: 51 (11.0%), check_bayes: 50 (10.7%), b_tokenize: 7 (1.4%), b_tok_get_all: 7 (1.4%), b_comp_prob: 1.46 (0.3%), b_tok_touch_all: 33 (6.9%), b_finish: 0.70 (0.1%), tests_pri_0: 372 (79.2%), check_dkim_signature: 0.49 (0.1%), check_dkim_adsp: 3.2 (0.7%), poll_dns_idle: 1.84 (0.4%), tests_pri_10: 3.0 (0.6%), tests_pri_500: 9 (1.8%), rewrite_mail: 0.00 (0.0%) Subject: [PATCH 01/14] signal: Generalize posixtimer_queue_sigqueue into enqueue_signal X-SA-Exim-Connect-IP: 166.70.13.52 X-SA-Exim-Rcpt-To: brauner@kernel.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, wad@chromium.org, tglx@kernel.org, peterz@infradead.org, kusaram@devineni.in, kees@kernel.org, luto@kernel.org, akpm@linux-foundation.org, oleg@redhat.com X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on out02.mta.xmission.com); SAEximRunCond expanded to false send_signal needs to do all of the same work as posixtimer_queue_sigqueue before calling complete_signal. The only difference is that send_signal might not allocate a sigqueue. So generalize the code to handle an absent sigqueue and create enqueue_signal. Then use enqueue_signal in place of posixtimer_queue_sigqueue and complete_signal. Signed-off-by: Eric W. Biederman --- kernel/signal.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 9c2b32c4d755..6b49bae3fce7 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1032,6 +1032,21 @@ static void complete_signal(int sig, struct task_struct *p, enum pid_type type) return; } +static void enqueue_signal(struct task_struct *t, enum pid_type type, + int sig, struct sigqueue *q) +{ + struct signal_struct *signal = t->signal; + struct sigpending *pending = (type != PIDTYPE_PID) ? + &signal->shared_pending : &t->pending; + + signalfd_notify(t, sig); + if (q) { + list_add_tail(&q->list, &pending->list); + } + sigaddset(&pending->signal, sig); + complete_signal(sig, t, type); +} + static inline bool legacy_queue(struct sigpending *signals, int sig) { return (sig < SIGRTMIN) && sigismember(&signals->signal, sig); @@ -1085,7 +1100,6 @@ static int __send_signal_locked(int sig, struct kernel_siginfo *info, q = sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit); if (q) { - list_add_tail(&q->list, &pending->list); switch ((unsigned long) info) { case (unsigned long) SEND_SIG_NOINFO: clear_siginfo(&q->info); @@ -1131,9 +1145,6 @@ static int __send_signal_locked(int sig, struct kernel_siginfo *info, } out_set: - signalfd_notify(t, sig); - sigaddset(&pending->signal, sig); - /* Let multiprocess signals appear after on-going forks */ if (type > PIDTYPE_TGID) { struct multiprocess_signals *delayed; @@ -1148,7 +1159,7 @@ static int __send_signal_locked(int sig, struct kernel_siginfo *info, } } - complete_signal(sig, t, type); + enqueue_signal(t, type, sig, q); ret: trace_signal_generate(sig, info, t, type != PIDTYPE_PID, result); return ret; @@ -1939,18 +1950,6 @@ bool posixtimer_init_sigqueue(struct sigqueue *q) return true; } -static void posixtimer_queue_sigqueue(struct sigqueue *q, struct task_struct *t, enum pid_type type) -{ - struct sigpending *pending; - int sig = q->info.si_signo; - - signalfd_notify(t, sig); - pending = (type != PIDTYPE_PID) ? &t->signal->shared_pending : &t->pending; - list_add_tail(&q->list, &pending->list); - sigaddset(&pending->signal, sig); - complete_signal(sig, t, type); -} - /* * This function is used by POSIX timers to deliver a timer signal. * Where type is PIDTYPE_PID (such as for timers with SIGEV_THREAD_ID @@ -2076,7 +2075,7 @@ void posixtimer_send_sigqueue(struct k_itimer *tmr) else hlist_del_init(&tmr->ignored_list); - posixtimer_queue_sigqueue(q, t, tmr->it_pid_type); + enqueue_signal(t, tmr->it_pid_type, sig, q); result = TRACE_SIGNAL_DELIVERED; out: trace_signal_generate(sig, &q->info, t, tmr->it_pid_type != PIDTYPE_PID, result); @@ -2137,7 +2136,7 @@ static void posixtimer_sig_unignore(struct task_struct *tsk, int sig) guard(rcu)(); target = posixtimer_get_target(tmr); if (target) - posixtimer_queue_sigqueue(&tmr->sigq, target, tmr->it_pid_type); + enqueue_signal(target, tmr->it_pid_type, sig, &tmr->sigq); else posixtimer_putref(tmr); } -- 2.41.0