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.129.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 8F6C12E8B81 for ; Fri, 19 Jun 2026 13:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781875644; cv=none; b=mud8lHdjZXxXSG0qqd74okcHO6b4IWoQaSy+Ghis6L/V8ob6Hxq6mFV7bOUfVIdeFgjq92s+KfEQg/aUaG79f6PFOCI4gHqb5XkqMAIlqIm7aFEIJff9yiF0J0KHjnb3/Ib36SbpZcAz/XnAwpthnws+z6zOCRtqERL+aAKRCm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781875644; c=relaxed/simple; bh=RaN9yl2H+Wj8MXStKuj8tTd+OduFDNOlthBduJzXeUk=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=tJN9LC2/o+iP+zdByRgWg4gUmwi95dln2uyNVs6XRtqJpykAkXjMC2E2f7buSLu/doQBJ5QYgKdn1W3PhK2qE2gcwiW1yrNDFHQ2mmvP5TzjmcuDpJdYHC//jHelg8PPXY5V0xroKMVB3jtNCdHiA8QoQJn3uKLqtUHzWl4cchs= 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=X4WwvvQA; arc=none smtp.client-ip=170.10.129.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="X4WwvvQA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781875642; 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; bh=uubCXZaMGZSUnlPAA2RbyvaWZhGB6US4OEnTnbB/mlc=; b=X4WwvvQA8kyiJrtJpeH0+EDG3m4yb35zjIGEG5zJuNb3tqsvbLmDRKaJHTB8KGtv68+BKK Hrq6Adv7soOhsEN3Z58eZqplZDpFAQYSaC1gtRpkj9U9+pmIdy78kenwJ8B3o9QE8BLKGw aRfeBsnqS5arDLpwhGSHBZXebmic5Mk= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-673-ufVfmGetOiSD-XZR7iGaYg-1; Fri, 19 Jun 2026 09:27:17 -0400 X-MC-Unique: ufVfmGetOiSD-XZR7iGaYg-1 X-Mimecast-MFC-AGG-ID: ufVfmGetOiSD-XZR7iGaYg_1781875635 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 3F60F185FBF7; Fri, 19 Jun 2026 13:27:15 +0000 (UTC) Received: from fedora (unknown [10.44.34.12]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 17C9B1800348; Fri, 19 Jun 2026 13:27:11 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 19 Jun 2026 15:27:14 +0200 (CEST) Date: Fri, 19 Jun 2026 15:27:10 +0200 From: Oleg Nesterov To: Andrew Morton Cc: Andy Lutomirski , "Eric W. Biederman" , Kees Cook , Kusaram Devineni , Peter Zijlstra , Thomas Gleixner , Will Drewry , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] signal: change force_sig_info_to_task() to call __send_signal_locked() Message-ID: 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 force_sig_info_to_task() calls send_signal_locked() which does two things on top of __send_signal_locked(): 1. The namespace translation of si_pid/si_uid. However, forced signals carry fault info (si_addr, si_call_addr, si_syscall), not pid/uid. The force_sig*() API should never be used to send signals with meaningful si_pid/si_uid, the forced signals are always "from kernel". There are few users of force_sig(SIGKILL), and in this case send_signal_locked() -> has_si_pid_and_uid() returns true. However, __send_signal_locked() simply ignores kernel_siginfo if sig == SIGKILL. (and in fact force_sig(SIGKILL) makes little sense, they should use send_sig(SIGKILL, p, 1) instead) 2. The "force" computation. However, for the forced signals, the unconditional force == true works just fine. If the target is ptraced, the "force" arg has no effect unless sig == SIGKILL. Otherwise, this check in sig_task_ignored() if (unlikely(t->signal->flags & SIGNAL_UNKILLABLE) && handler == SIG_DFL && !(force && sig_kernel_only(sig))) return true; has no effect, force_sig_info_to_task() clears SIGNAL_UNKILLABLE if handler == SIG_DFL. The only behavioral difference is another check in sig_task_ignored: if (unlikely((t->flags & PF_KTHREAD) && (handler == SIG_KTHREAD_KERNEL) && !force)) So with this patch a kthread that called allow_kernel_signal() for a fault signal would now receive the forced signal instead of silently ignoring it. And this is arguably more correct, even if I don't think that the force_sig*() API should be used in this case. Signed-off-by: Oleg Nesterov --- kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/signal.c b/kernel/signal.c index 9c2b32c4d755..68af503ed43c 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1315,7 +1315,7 @@ force_sig_info_to_task(struct kernel_siginfo *info, struct task_struct *t, if (action->sa.sa_handler == SIG_DFL && (!t->ptrace || (handler == HANDLER_EXIT))) t->signal->flags &= ~SIGNAL_UNKILLABLE; - ret = send_signal_locked(sig, info, t, PIDTYPE_PID); + ret = __send_signal_locked(sig, info, t, PIDTYPE_PID, true); /* This can happen if the signal was already pending and blocked */ if (!task_sigpending(t)) signal_wake_up(t, 0); -- 2.52.0