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 7DBF230FC2E for ; Thu, 26 Feb 2026 14:02:37 +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=1772114558; cv=none; b=Q+PdrO3e0LSqbsH1dXiiXfqbDMRGVcKSfR/2neWpsL6gycJjfZFV+i467ec+U+KBrzqR2L5SVXwFPjhEUJwadi6b565Z6dWtyX+HwveqQaV+iauaH7hZwJfbiLmsWAkfCelLIJiY202OklbWucaZs1FTzFqV8hUg9Ld+wfSNuIk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772114558; c=relaxed/simple; bh=DekqoN8crtwvAvBjpK07PIoH6I403LM9p0yetWYFDw0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LWNc0BBbpuAb2sW+UAX1IU3SI3QYSczZkXEPiYmatX0E/a741mD59IRDWFvNG8LqFrHDXZS5naBqhwyZYkx0lo6t3uponOyJPwqFYekXFzHcPOO5wjhROqegkXX5RXBtF7yMl91FnzGPU4vzf1gH+3tk8h8NOsYQmO0O5Cnpxig= 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=QgkWa03Y; 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="QgkWa03Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772114556; 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=EQ41jwqaTpbsu9nZCnt6Zy1FX5m9icmjt6wuVuOZFyg=; b=QgkWa03YVwLufjxNhwrLGQSXPiT9REoq3nszjtA4mzijTrWXeVx5v3CQSZxZx7vi3QMcU7 LVI0nNub8TS0+1UbAdIJgEzq0hiTh2iajCRgyq/KVoxkiZcZbtIhuucmpSPZXsHY9PmUJI DVccPZajD3vI00BcZpeU1bTnMBDbdeQ= Received: from mx-prod-mc-06.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-632-IjRME0-pMcq9mV5s2vUwDA-1; Thu, 26 Feb 2026 09:02:30 -0500 X-MC-Unique: IjRME0-pMcq9mV5s2vUwDA-1 X-Mimecast-MFC-AGG-ID: IjRME0-pMcq9mV5s2vUwDA_1772114547 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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id C687818003F6; Thu, 26 Feb 2026 14:02:25 +0000 (UTC) Received: from fedora (unknown [10.44.32.38]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 33EEA1956053; Thu, 26 Feb 2026 14:02:17 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Thu, 26 Feb 2026 15:02:25 +0100 (CET) Date: Thu, 26 Feb 2026 15:02:16 +0100 From: Oleg Nesterov To: Andrei Vagin Cc: Pavel Tikhomirov , Christian Brauner , Shuah Khan , Kees Cook , Andrew Morton , David Hildenbrand , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Jan Kara , Aleksa Sarai , Andrei Vagin , Kirill Tkhai , Alexander Mikhalitsyn , Adrian Reber , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 2/4] pid: check init is created first after idr alloc Message-ID: References: <20260224164852.306583-1-ptikhomirov@virtuozzo.com> <20260224164852.306583-3-ptikhomirov@virtuozzo.com> 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: X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 02/26, Oleg Nesterov wrote: > > Now that I look at this code again... Why do we bother to check > "pid_allocated & PIDNS_ADDING" at all? copy_process() does > > /* Don't start children in a dying pid namespace */ > if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) { > retval = -ENOMEM; > goto bad_fork_core_free; > } > > I am going to send the patch which removes this check from alloc_pid... > Need to recheck. No, we can't remove either of these 2 checks... This probably deserves another comment in alloc_pid(). Oleg.