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 6BE89371D01 for ; Sun, 15 Mar 2026 19:29:17 +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=1773602959; cv=none; b=mfdIS/Ur4skuGiDJKzVLtmK4gx+QvyHBP34SkkmHRuMAW6BFqI08eFPn9pF4AXW/iDj+PKV5oPunYRer82PwG0drSAyTtX+V0t9G0cO5u0c+p01dZw0XgPhJchNF02A9zQg5AVOH4I+XVoWYWoOCOlk9Fm7nOYa5z8N8ItYw140= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773602959; c=relaxed/simple; bh=jxzikEexRlijc9IO5LqerZmFKa305HjMNtd60OAoC7A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BI6qhtuHvrYizzczg7u3RCDanihrmrfKd+vzYztdg/fEo1qG3Ui+6kfbrtvuvYQZbqvj4U6xE+YYDK9BZ6uukxc0gY+6CGC2iVJqcS0j9SBevUzus4baxq+e9N3YA/r1T0PxYBkoF2GefWEPjmF6AST32GuwCRVBC8JfEVZ3TP8= 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=GsisykCG; 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="GsisykCG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773602956; 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=8I6AQTWqoj/LsTiMqh3LTu/Py5JE/wmT+NfV/h8m0CE=; b=GsisykCGj60mG5QqD6M2QNDxgPu9DtHwRZsI9ZNmziuCuzP/nnoxd5XiaQVZX6cwzNfZeQ j82+n/FhsYi0YiqT7k6bkQKsCObIuToYWGJp9U25yy8SZq80VT6YUnd9FUOOA2RnYskO81 NTEqRgWyrVqYfUz3sOEpzqLI6/OxH8g= 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-624-2jIPhdYvOCemGUrPpxwzSg-1; Sun, 15 Mar 2026 15:29:13 -0400 X-MC-Unique: 2jIPhdYvOCemGUrPpxwzSg-1 X-Mimecast-MFC-AGG-ID: 2jIPhdYvOCemGUrPpxwzSg_1773602951 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 3FF0119560B5; Sun, 15 Mar 2026 19:29:11 +0000 (UTC) Received: from fedora (unknown [10.45.225.204]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 20B51300019F; Sun, 15 Mar 2026 19:29:07 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 15 Mar 2026 20:29:10 +0100 (CET) Date: Sun, 15 Mar 2026 20:29:06 +0100 From: Oleg Nesterov To: Josh Law Cc: Christian Brauner , Andrew Morton , Thomas Gleixner , Peter Zijlstra , linux-kernel@vger.kernel.org Subject: Re: [PATCH] signal: use task parameter instead of current in task_join_group_stop() Message-ID: References: <20260315151847.214634-1-objecting@objecting.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: <20260315151847.214634-1-objecting@objecting.org> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Hi Josh, Well, this is subjective, but I don't like your patch in any case... In fact I think it is wrong. See below. On 03/15, Josh Law wrote: > > task_join_group_stop() takes a task_struct parameter but reads jobctl > and signal from current instead. And in my opinion this is what it should actually do. Because task_join_group_stop(p) asks 'p' to join the current's group-stop if it is active. And to me this logic looks very clear. but may be task_join_group_stop() should be renamed to make it even more clear, I dunno. > This works today because the sole > caller (copy_process) always passes a new thread in the same thread > group as current, so task->signal == current->signal and > task->jobctl is a copy of current->jobctl from dup_task_struct(). I see it differently. Your change assumes that task->jobctl was correctly copied by dup_task_struct(). We should not rely on that. And at first glance we can't rely on that. current->jobctl can change between between dup_task_struct() and copy_process() -> spin_lock(¤t->sighand->siglock); Oleg. > Use the task parameter directly so the function is self-consistent > with its API and will not silently break if a future caller passes a > task from a different thread group. > > Signed-off-by: Josh Law > --- > kernel/signal.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/signal.c b/kernel/signal.c > index 116cf678c4a3..cb417e3674ed 100644 > --- a/kernel/signal.c > +++ b/kernel/signal.c > @@ -386,8 +386,8 @@ static bool task_participate_group_stop(struct task_struct *task) > > void task_join_group_stop(struct task_struct *task) > { > - unsigned long mask = current->jobctl & JOBCTL_STOP_SIGMASK; > - struct signal_struct *sig = current->signal; > + unsigned long mask = task->jobctl & JOBCTL_STOP_SIGMASK; > + struct signal_struct *sig = task->signal; > > if (sig->group_stop_count) { > sig->group_stop_count++; > -- > 2.34.1 >