From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 D67413E7BCF for ; Tue, 7 Jul 2026 11:13:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783422822; cv=none; b=o+wdp9ISNY2SAhGbQJg1dBQdiLB8QC2pc4whFIkpssMJYt05Qk83ymY8yvRBvVqik0k+b38lLhORyphp6cSAPFfaCHMmcM+o6bj8F+y+acINeX0XpZySxT/VTIL9p91jfxo8JRpiid3EpyN9jHKuVITTwbwkxhnj9xIJM90lXrE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783422822; c=relaxed/simple; bh=5BgWZai3+TUL66iqYhZOLaaNWMOetJHQnpfN9gOGaeg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n2NAQaYhUYGehRQslziQehbinEKV6efY1EYjP/Y0cwLR3VWySVo5CeJu0GflB3WLqMU5kWeFmX3tEO681NuXw1QNjLsy69o3Df+/z0JeM+tDSUl9GYn0JPfdmS1ZWnfrF48dd0yAofagxX3x0qltwsCZKX/fVjvY1UAiL31s3ts= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YtCG+UcB; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YtCG+UcB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783422819; 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: in-reply-to:in-reply-to:references:references; bh=ffIyxty3VZskUYKXEnWDxPMv+lkgdUMvyZDZmnrUrlY=; b=YtCG+UcBK0czuH9ycKOhxuR9uRdEfvy8v+3Sqr0PxGTsb1QvLrplk47kXKoX/cbuRLKXw9 Oi5rtJ3pDA9bE/gbtxV9ZFhGNyFEEz5uGBDjUZy8ETLdsv0r+X19smgwS6q0RxWabmpwgP /dlxYWwQ1UfixotUWF4ipeypza9GgeE= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-FTg10FlAMv2NINChdzSb2Q-1; Tue, 07 Jul 2026 07:13:36 -0400 X-MC-Unique: FTg10FlAMv2NINChdzSb2Q-1 X-Mimecast-MFC-AGG-ID: FTg10FlAMv2NINChdzSb2Q_1783422814 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C54B119540D4; Tue, 7 Jul 2026 11:13:33 +0000 (UTC) Received: from fedora (unknown [10.44.33.83]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id D6C531955F75; Tue, 7 Jul 2026 11:13:28 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 7 Jul 2026 13:13:33 +0200 (CEST) Date: Tue, 7 Jul 2026 13:13:27 +0200 From: Oleg Nesterov To: "Eric W. Biederman" Cc: Andrew Morton , Andy Lutomirski , Kees Cook , Kusaram Devineni , Peter Zijlstra , Thomas Gleixner , Will Drewry , linux-kernel@vger.kernel.org, Linus Torvalds , Christian Brauner Subject: Re: [PATCH v2 00/14] Short circuit delivery for coredump signals Message-ID: References: <87o6gx9rc4.fsf@email.froward.int.ebiederm.org> <877bnh7tnf.fsf@email.froward.int.ebiederm.org> <877bnb4uyw.fsf_-_@email.froward.int.ebiederm.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <877bnb4uyw.fsf_-_@email.froward.int.ebiederm.org> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Eric, so far I applied the whole series, and I don't see how it can solve one of the problems I tried to fix in my series. Again. A task T has a pending and blocked SIGSYS. si_code = SI_USER. (although the latter is not strictly necessary) force_sig_seccomp(force_coredump => true) sent to T unblocks SIGSYS and sets SA_IMMUTABLE. However, __send_signal_locked() will bypass enqueue_signal() (so it won't set SIGNAL_GROUP_EXIT) because legacy_queue() is true. T calls get_signal(). Now. it can dequeue another synchronous signal. If that signal has a handler and its sa_mask includes SIGSYS, the task can return to userspace and survive. No? Oh... And SIGKILL still can be lost, and I still think this is not good. Oleg. On 07/03, Eric W. Biederman wrote: > > Oleg's recent patchset tweaking how force_sig_info works has inspired me > to finally push through and update the signal handling to have proper > short circuit deliver for coredump signals. Everything is just simpler > when coredumps are not such a large special case. > > What makes this tricky is coredumps have had their own process > shoot-down logic similar to but separate and different from everything > else in the kernel. The bulk of this set of changes is merging the > process shoot-down logic that is used for signals and the logic for > coredumps. So the same process shoot-down logic can be shared. > > With the shoot-down logic sorted the rest is quite straight forward. > > Oleg when reviewing the first version of this set of changes noticed > that dequeue_exit_signal did not properly handle thread local signal > that trigger a coredump. To resolve this I have added a few more > cleanups so that I can detect a fatal signal as it is being enqueued > and place it in the shared signal queue. > > One of those cleanups is a rewrite of detecting if a signal can be > delivered immediately when sent aka short circuit delivery. The > processing of signals that will be ignored and signals that will cause a > process to exit without returning to userspace (such as SIGKILL) are > both enhanced. > > This set of changes is against v7.2-rc1 > > fs/coredump.c | 161 +++++++++++++++++---------------- > include/linux/coredump.h | 4 + > include/linux/sched/signal.h | 2 + > include/linux/sched/task.h | 1 - > include/linux/signal_types.h | 3 - > include/uapi/asm-generic/signal-defs.h | 1 - > kernel/exit.c | 41 ++------- > kernel/signal.c | 119 +++++++++++++++--------- > mm/oom_kill.c | 2 +- > 9 files changed, 171 insertions(+), 163 deletions(-) > > Eric W. Biederman (14): > signal: Generalize posixtimer_queue_sigqueue into enqueue_signal > signal: Factor out sig_blocked from sig_ignored > signal: More accurate ignoring of signals based on sig_can_short_circuit > signal: Use sig_can_short_circuit to improve fatal signal delivery > signal: Compute the exit_code in get_signal > signal: In get_signal call do_exit when it is unnecessary to shoot down threads > signal: Bring down all threads when handling a non-coredump fatal signal > signal: Move stopping for the coredump from do_exit into get_signal > signal: Move audit_core_dumps from do_coredump into get_signal > coredump: In zap_threads complete startup if there is no need to wait > signal: Use the thread killing in get_signal for coredumps > exit: Make do_group_exit static > signal: Dequeue fatal signals > signal: Short circuit deliver coredump signals > > fs/coredump.c | 153 ++++++++++++++------------- > include/linux/coredump.h | 4 + > include/linux/sched/signal.h | 2 + > include/linux/sched/task.h | 1 - > kernel/exit.c | 41 ++------ > kernel/signal.c | 246 +++++++++++++++++++++++++++++-------------- > mm/oom_kill.c | 2 +- > 7 files changed, 260 insertions(+), 189 deletions(-) >