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 2E10A2F5A22 for ; Tue, 11 Nov 2025 14:09:59 +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=1762870201; cv=none; b=JPY+p08rdxUVG+s6H5KRng3f3C/DI1HFskOB70r/ch1M65USACH62Q70VYJNDic+EJ3xM+AI7dqxpcQW3to+Kw2KNVimjEl4SQ7B85q2WXaTTNmvNp2WapeUho/f/419F0Pz7IUcvoc55oMs3tuYfJ5X7YvXTAGmaqZIrBWecEM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762870201; c=relaxed/simple; bh=L8iD7ISPG2fGHbO2n2GzUqN8VPD4vbOEio6K+3ptYII=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gdTaNUD5Ly1WEDNp2YO4oQmlVhYLpyDefsG3OiBZ5lNfDa6F5l25zIG3wbxaPn07TIHSAaAX6/13J+KCnXX0C7/DW8cO88mxMJJVCKHqJE77woOMdGx/BQE+gl+bp7AEtOOZYIQe8ntUt23FFE+XXQj2NaJPDauHIJyPzwR+oYE= 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=Vxe2Nkse; 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="Vxe2Nkse" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762870199; 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=Z0jAePqN6TOEf6jTJjCEwq53g6vGvq/lRpJXMiEpVl8=; b=Vxe2NksecVIYaKSVqROG2Ehyvt7X+lS6i8Iae+gfZAdcO0zvQ2ti4AsbjTT6oEd/ReGfv+ 97oc0/E/9NwSEut+WqH9WXjBhIX/Onn7//ZdwQA4qBm4I7lYqVGyZttElDxoan/PbWwES+ pRG619APxaYuqsdfP/1JoefA8egyg0c= Received: from mx-prod-mc-01.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-650-vw-lvJJNOaevRjFJJf1SIA-1; Tue, 11 Nov 2025 09:09:55 -0500 X-MC-Unique: vw-lvJJNOaevRjFJJf1SIA-1 X-Mimecast-MFC-AGG-ID: vw-lvJJNOaevRjFJJf1SIA_1762870193 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8E8DA195607F; Tue, 11 Nov 2025 14:09:53 +0000 (UTC) Received: from fedora (unknown [10.44.33.247]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 19CF31800576; Tue, 11 Nov 2025 14:09:50 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 11 Nov 2025 15:09:53 +0100 (CET) Date: Tue, 11 Nov 2025 15:09:49 +0100 From: Oleg Nesterov To: Cyrill Gorcunov Cc: "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org Subject: Re: [RFC PATCH 2/3] exec: don't wait for zombie threads with cred_guard_mutex held Message-ID: References: Precedence: bulk X-Mailing-List: linux-security-module@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: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 On 11/11, Cyrill Gorcunov wrote: > > Anyway while looking into patch I got wonder why > > +static int wait_for_notify_count(struct task_struct *tsk) > +{ > + for (;;) { > + return -EINTR; > + set_current_state(TASK_KILLABLE); > + if (!tsk->signal->notify_count) > + break; > > We have no any barrier here in fetching @notify_count? I mean updating > this value is done under locks (spin or read/write) in turn condition > test is a raw one. Not a big deal since set_current_state() and schedule() Yes, so I think that, correctness-wise, this doesn't need additional barriers. > but I've > been a bit confused that we don't use some read_once here or something. Yes, this needs READ_ONCE() to avoid the warnings from KCSAN. And in fact this code was written with READ_ONCE() but I removed it before sending this RFC. I was going to do this later. I always forget how KCSAN works, IIUC I also need to add WRITE_ONCE() into exit_notify() and __exit_signal() to make KCSAN happy, even if ->notify_count is always updated under the lock. Same for the "if (me->signal->group_exec_task == me)" check in begin_new_exec(). Right now I would like to know if this RFC (approach) makes any sense, especially because 3/3 adds a user-visible change. Oleg.