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 CDE35200110 for ; Mon, 22 Jun 2026 17:46:53 +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=1782150415; cv=none; b=kgM9OWLj9p9yuaKEByIhnpL1W/hC6n665+nA+iSSeSpaq/dwqPN7WUBuM8skggXpzuRqTH/PKaGusf/sLhv1hetkeSkeyTkvnf6ve6m+NezwMkjD5waxeLI4HtSUSiqNFsxWzwUeCW231EZCMBs4MVDWm0Npi59Wx/3FAKlFNLw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782150415; c=relaxed/simple; bh=5Md68ozpaBWQYx5mDCyb358QU5P+LGoDnzuxsdgoaMk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=C4vPDnvkZz7OBoQopHy2O8TTJRK7obnQt6d3FJyMGmhazv2iERDAXiuHxVO6reNRQp6GJ4dacGCIsvbZ5RJu3rcsUob7i8cFWo29iyvKxSgIpLD0xy7IhDZ/yPpW1cqJv/2lY0SquT948IB8L0a+z3QhEYt5r3KXJGMvtjbgn1k= 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=BKEF0Cei; 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="BKEF0Cei" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782150413; 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=ogkNTdRbHLKr+SfKtfZvK8CYRxW/59/l8+UnBjTN5IU=; b=BKEF0Cei4j7shwYTBu0D9ohIiKj/Hj/XdVV74doEWx9SjccIYloKD1MelBNW9MvX1Kc8ui dfUxiuOEKOpcI+Lo04CQDkIvBOLAYLD9HjLEaWSfMvZb7OzEmWaSYeYg5fY7vfIV3vw6xm eDwTnqeFBNcN3N2GAWf5jlTWD9KKWn0= Received: from mx-prod-mc-03.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-595-Y88W61W_PXqrW7GAbp0kDw-1; Mon, 22 Jun 2026 13:46:47 -0400 X-MC-Unique: Y88W61W_PXqrW7GAbp0kDw-1 X-Mimecast-MFC-AGG-ID: Y88W61W_PXqrW7GAbp0kDw_1782150405 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7407D1954B3A; Mon, 22 Jun 2026 17:46:44 +0000 (UTC) Received: from fedora (unknown [10.44.32.50]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id D746B180058D; Mon, 22 Jun 2026 17:46:39 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 22 Jun 2026 19:46:44 +0200 (CEST) Date: Mon, 22 Jun 2026 19:46:37 +0200 From: Oleg Nesterov To: Bradley Morgan Cc: Christian Brauner , ebiederm@xmission.com, Andrew Morton , Peter Zijlstra , Adrian Huang , Marco Elver , Kexin Sun , Thomas Gleixner , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] signal: avoid shared siginfo namespace rewrites Message-ID: References: <20260622164029.11474-1-include@grrlz.net> 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: <20260622164029.11474-1-include@grrlz.net> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 On 06/22, Bradley Morgan wrote: > > send_signal_locked() rewrites sender ids for the target namespace. > Group sends reuse the same siginfo, so one recipient can affect the > next. Hmm... I'll re-read this change tomorrow after sleep, but I am almost sure you are you are right anyway... I am wondering if we can conditionalize the "swap(rewritten, info)" logic with your patch, most probably this makes no sense... May I suggest another change on top of your fix? Make the "kernel_siginfo *info" arg of send_signal_locked() "const". To make it more clear. Yes, the signature of has_si_pid_and_uid() should be changed too. Up to you. Thanks, Oleg. > Copy the siginfo before changing it. > > Fixes: 7a0cf094944e ("signal: Correct namespace fixups of si_pid and si_uid") > Cc: stable@vger.kernel.org > Signed-off-by: Bradley Morgan > --- > kernel/signal.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/signal.c b/kernel/signal.c > index b9fc7be1a169..d72d9be3a992 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -1181,6 +1181,7 @@ static inline bool has_si_pid_and_uid(struct kernel_siginfo *info) > int send_signal_locked(int sig, struct kernel_siginfo *info, > struct task_struct *t, enum pid_type type) > { > + struct kernel_siginfo rewritten; > /* Should SIGKILL or SIGSTOP be received by a pid namespace init? */ > bool force = false; > > @@ -1194,6 +1195,9 @@ int send_signal_locked(int sig, struct kernel_siginfo *info, > /* SIGKILL and SIGSTOP is special or has ids */ > struct user_namespace *t_user_ns; > > + rewritten = *info; > + info = &rewritten; > + > rcu_read_lock(); > t_user_ns = task_cred_xxx(t, user_ns); > if (current_user_ns() != t_user_ns) { > -- > 2.53.0 >