From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from confino.investici.org (confino.investici.org [93.190.126.19]) (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 A577E175A69 for ; Sun, 28 Jun 2026 18:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.190.126.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782669721; cv=none; b=csIwH146NuFyksLK4bcb25oGdeulfz7TPCk2hw26je4Z9aZwaHxLdR8Zh02T0y17u/+8qM2L+s1t+KV9y/v3JgXlvHeGU9BbjnIp6v+cU325oZ06jUnnYI17icz5ce/afmT8XJtRkP/6GGgGObuGfLuR2rKUV9il/A1xYEjSMmo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782669721; c=relaxed/simple; bh=7+rECAId5HuhyWEcHUcY2Dv44jg+hzO5llNJ2Wy8sQE=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=BzoU45wmUIDOMR4m57k+LQFDBuV2A81Ff7CAv0+req7yvb1h1wC5tywGma+EzoevykYCQYD+oQ34Tb6aqGRqQ2vaPfxWpSgmgzs6UsP9pqVOsVyYSQHb2v1FCGA7JR3Y7CePakP9vhAlhZEkwqnvkIQ8h3Xf207YnPmzQ3gwBVM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=grrlz.net; spf=pass smtp.mailfrom=grrlz.net; dkim=pass (1024-bit key) header.d=grrlz.net header.i=@grrlz.net header.b=i1cE4KwX; arc=none smtp.client-ip=93.190.126.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=grrlz.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=grrlz.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=grrlz.net header.i=@grrlz.net header.b="i1cE4KwX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grrlz.net; s=stigmate; t=1782669716; bh=8Hl/YVZorpNksC2dRRehfO1zeRRfmtdCN6ZZrJZWJfI=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=i1cE4KwXLZzIrR7IhMd1AU2CgbNqC1wyCpU9JOnEDfwctXCzoFdkaSuVK9NH2QhjT 4PljhAt+vYoGRox0GBxYcVmgtlUwujAu2js+VpUUam58NLRV4MofBLDHPV47U+Xq8F 0GlCCYe+ThdaGwKOTFSKq2RIHGPBGtamwwQh9YIg= Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4gpHKw03DLz114f; Sun, 28 Jun 2026 18:01:56 +0000 (UTC) Received: by mx1.investici.org (Postfix) id 4gpHKv0lwwz114Z; Sun, 28 Jun 2026 18:01:55 +0000 (UTC) Date: Sun, 28 Jun 2026 19:01:53 +0100 From: Bradley Morgan To: Oleg Nesterov , Andrew Morton CC: "Eric W. Biederman" , linux-kernel@vger.kernel.org Subject: Re: [PATCH] signal: change sys_kill() to use SEND_SIG_NOINFO In-Reply-To: References: <20260626093603.7eb06a58684e0d02f3b9d0f8@linux-foundation.org> 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=utf-8 Content-Transfer-Encoding: 8bit On June 28, 2026 6:51:58 PM GMT+01:00, Oleg Nesterov wrote: >On 06/26, Andrew Morton wrote: >> >> On Fri, 26 Jun 2026 17:33:08 +0200 Oleg Nesterov >wrote: >> >> > 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. >> >> The above paragraphs contain no description of any flaw. What's wrong >> here? > >Ah, sorry. nothing wrong if we forget about the fix from Bradley, but we >need this fix with or without this cleanup... Ack. >> > 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. >> >> "also fixes". Again, what was the first fix? > >Agreed. This is confusing. Made me a bit confused! Heh. >> Thanks, I'll queue this for testing. > >Thanks, > >> Please send along some changelog >> edits sometime? > >Please see the new changelog below. Does it look more clear? > >Bradley, do you agree? > >Oleg. >--- > >signal: change sys_kill() to use SEND_SIG_NOINFO > >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 exists precisely for the case when si_code == SI_USER >and si_pid/si_uid are the sender's ids; this is exactly what sys_kill() >does via prepare_kill_siginfo(PIDTYPE_TGID). Change sys_kill() to use >it directly. > >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. > >This is just a cleanup and microoptimization (especially with [1]), this >skips the has_si_pid_and_uid() block in send_signal_locked() and offloads >the namespace translation logic to __send_signal_locked(SEND_SIG_NOINFO) >which uses the simpler computations. > >NOTE: As a "side effect" this also fixes the kill(pid < 0, 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 Code wise, please add my tag. Reviewed-by: Bradley Morgan I would do acked by personally but no idea if that's liked over in this subsystm Description wise, I'm sure that looks fine Andrew, could you please take my fix? > Thanks!