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 36C64366DAF for ; Mon, 23 Feb 2026 19:21:12 +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=1771874474; cv=none; b=AGI3i8WDTwtLgFQFcbzQIfXc9o/89xiokp9CDg+8h1Yu8wc9UOGIoKXHUyf+vSD4iajnyFgEJAVoTd6/KUSqTdCcaxRNKTHUfgQ6eyY3Cz31oNq6roosxJM0zFsftlQCmeVDbkcejRAy9uvR5zUD5oWFKzGlJbaLs6nHgmT2xVA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771874474; c=relaxed/simple; bh=mv8HWzyIGIg6MhXUteEeHEkoA7gYbLpaaLQIe4zi1EE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CTn9kwUB/yt04HChfG/9W1UU6/IXXNzfDfVIiuj9ieW16BlUtdhpImBsJP2YqaRn2GsvJpVC3EfViLpwr4TuA5Qz7+SXfrEJFV2KWHFy8qPq6Qc4Y5toCd4JMcjVHUq2RLr/yF44nVncv/UQ5Sfau+9HbYoLPrxP7uob8OJ8CCg= 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=eJ18f52m; 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="eJ18f52m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771874472; 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=uey1o7KJHXLBYmkBbcXJeg75bnZzGirLrTOQOxehJuI=; b=eJ18f52mrrx6LPeHZPgpiy/My0L1znlhiMcAFUjfUaBshWc/aBsTQ7gLTxVQ4odlkaCgGX 5rQTTzM3TiKgRY1Sq/lp+mw8i9ct0TxFvQDq96HorOr507B/tSwMcWJzvyoNnN5juKaHa1 tNVQgT2iNrva3KPE97CgOyT+Sg77Uns= Received: from mx-prod-mc-05.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-227-wZXFO1oPONaEiK_4EtbUOQ-1; Mon, 23 Feb 2026 14:21:08 -0500 X-MC-Unique: wZXFO1oPONaEiK_4EtbUOQ-1 X-Mimecast-MFC-AGG-ID: wZXFO1oPONaEiK_4EtbUOQ_1771874467 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6DFF41956088; Mon, 23 Feb 2026 19:21:07 +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 A07CE1955D71; Mon, 23 Feb 2026 19:21:04 +0000 (UTC) Received: by fedora (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Mon, 23 Feb 2026 20:21:06 +0100 (CET) Date: Mon, 23 Feb 2026 20:21:02 +0100 From: Oleg Nesterov To: Christian Brauner Cc: Jann Horn , Linus Torvalds , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: pidfd && O_RDWR Message-ID: References: <20260223-work-pidfs-autoreap-v4-0-e393c08c09d1@kernel.org> <20260223-work-pidfs-autoreap-v4-2-e393c08c09d1@kernel.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: X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 02/23, Oleg Nesterov wrote: > > pidfd_prepare() does pidfs_alloc_file(pid, flags | O_RDWR) and "| O_RDWR" > makes no sense because pidfs_alloc_file() itself does > > flags |= O_RDWR; > > I was going to send the trivial cleanup, but why a pidfs file needs > O_RDWR/FMODE_WRITE ? > > Actually the same question about some anon_inode_getfile_fmode(O_RDWR) > users, for example signalfd.c. perhaps an accidental legacy from 628ff7c1d8d8 ("anonfd: Allow making anon files read-only") ? Oleg.