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 78C0D37C113 for ; Fri, 26 Jun 2026 15:33:21 +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=1782488002; cv=none; b=PSXw12IaXfcUEShIutt3Nvxe0pNmRjuPXoG8CcR+5lBv+0pXqwBTK1vTcrMPTpNIDjga8nuIHDzM04aadqBl6OPfSLmBGtwTkz8NOOhySSthboSSLF0Y8MUfGNLehbnxPSWk/DkYrXvO4yro+lEG9MbvGyg3i3MoTent9bu2dRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782488002; c=relaxed/simple; bh=UvNEpbOeeq6aB8HKY6RT9Fw29etKPnMrhdr4JT2dA3o=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=QvUYVCIbb5zS+bHqItsyUAaQJ/Qq6skdUxzvHMjN+46HwMR7+oWSSy9UUqoMFWBea6doSAUxy2dkLTaQokTZRgzuRzXLlYDHal9LKJPEPmzwBkzxULWDtBjz3X/iS0CW9KJPg+Ebj+oiV9Gdkr5DsQmYORZugczsE6kB8iLMawc= 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=NVQVxFRx; 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="NVQVxFRx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782488000; 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=tt/QSgmhyS6XsO/kwgv9yDGgieA31+odqsy0PUpoA8w=; b=NVQVxFRx5Dvb68+aGzB4omhyoyZm8gc6GOhc++SeMpGFQs0RXwGguFRBA5ZUbD9t5qrdmU tODzTXnB3pSgWeCCed/Y1AO/U/JzciSX0Udru77QqlA47gSOC9lgDZlGgBLMX2fPnYZZt4 fM86hZ8AuUD3yGLLtlGaUB3YzWAMQFo= Received: from mx-prod-mc-08.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-687--H3KAmMHOVelLKoCg_RYng-1; Fri, 26 Jun 2026 11:33:14 -0400 X-MC-Unique: -H3KAmMHOVelLKoCg_RYng-1 X-Mimecast-MFC-AGG-ID: -H3KAmMHOVelLKoCg_RYng_1782487993 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9DBF5180AE0D; Fri, 26 Jun 2026 15:33:13 +0000 (UTC) Received: from fedora (unknown [10.44.33.126]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id F2D50195604E; Fri, 26 Jun 2026 15:33:10 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 26 Jun 2026 17:33:13 +0200 (CEST) Date: Fri, 26 Jun 2026 17:33:08 +0200 From: Oleg Nesterov To: Andrew Morton Cc: Bradley Morgan , "Eric W. Biederman" , linux-kernel@vger.kernel.org Subject: [PATCH] signal: change sys_kill() to use SEND_SIG_NOINFO 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.0 on 10.30.177.17 prepare_kill_siginfo(PIDTYPE_TGID) fills si_code = SI_USER and sets si_pid/si_uid in the sender's namespace. Then send_signal_locked() translates si_pid/si_uid to the target's namespace. SEND_SIG_NOINFO produces the same result: si_code = SI_USER, and __send_signal_locked() computes si_pid/si_uid directly in the target's namespace. The force computation is also the same: both check if the sender is visible in the target's pid namespace. Note: this also fixes the kill(-1, sig) case where send_signal_locked() rewrites si_pid/si_uid in the shared siginfo, corrupting it for subsequent recipients. But for other group senders like __kill_pgrp_info() we still need the fix from Bradley Morgan [1] who found this problem. TODO: kill prepare_kill_siginfo() and change other users to use SEND_SIG_NOINFO too. This needs trivial changes in __send_signal_locked() and TP_STORE_SIGINFO(). Link: https://lore.kernel.org/all/20260622164029.11474-1-include@grrlz.net/ [1] Signed-off-by: Oleg Nesterov --- kernel/signal.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index 077effd21582..12edbf43d678 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3966,11 +3966,7 @@ static void prepare_kill_siginfo(int sig, struct kernel_siginfo *info, */ SYSCALL_DEFINE2(kill, pid_t, pid, int, sig) { - struct kernel_siginfo info; - - prepare_kill_siginfo(sig, &info, PIDTYPE_TGID); - - return kill_something_info(sig, &info, pid); + return kill_something_info(sig, SEND_SIG_NOINFO, pid); } /* -- 2.52.0