🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16326

Re: [PATCH RFC v2 17/42] securityfs: use fc_init_pseudo()

#16326
From: bot+bpf-ci
Date: Sat, 14 Nov 2026 13:54
68 lines
10728 bytes
--===============1687560790659556623==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit

> securityfs: use fc_init_pseudo()

TL;DR: Setting SB_I_NODEV on securityfs may make reopening AppArmor's
inherited .null fd (e.g. open("/dev/stderr")) fail with -EACCES, which used to
work; the commit message may also be inaccurate about device nodes.

> diff --git a/security/inode.c b/security/inode.c
> --- a/security/inode.c
> +++ b/security/inode.c

[ ... ]

> @@ -64,6 +65,7 @@ static const struct fs_context_operations securityfs_context_ops = {
>
>  static int securityfs_init_fs_context(struct fs_context *fc)
>  {
> +	fc_init_pseudo(fc);
>  	fc->ops = &securityfs_context_ops;
>  	return 0;
>  }

The commit message says "AppArmor puts a .null device node into securityfs
but only ever opens it via dentry_open() which doesn't care about
SB_I_NODEV."  Is that the whole picture?

aa_inherit_files() installs that dentry_open()ed file into the task's fd
table:

    devnull = dentry_open(&aa_null, O_RDWR, cred);
    ...
    replace_fd(n - 1, devnull, 0);

The fd is not O_CLOEXEC, and its f_path.mnt is the internal mount from
simple_pin_fs() in aa_mk_null_file(), which never has MNT_NODEV.

Opening /proc/<pid>/fd/N, or /dev/stdout or /dev/stderr, resolves to that
same path and goes through the normal open path:

    do_open() -> may_open()
        case S_IFCHR:
            if (!may_open_dev(path))
                return -EACCES;

may_open_dev() checks path->mnt->mnt_sb->s_iflags & SB_I_NODEV.  That bit
was clear on the securityfs superblock before this patch and is set now.

Can this make open("/dev/stderr") fail with -EACCES for an unconfined task
that inherited the .null fd, for example a helper exec'd through a ux/Ux
transition from a confined task?  That open used to succeed.

Should the commit message say that this reopen path is intended to fail, or
does .null need separate handling?  The statement that "securityfs never
holds ... device nodes" also seems to conflict with the .null node described
in the next paragraph.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/43599461726
--===============1687560790659556623==--
Technical Details
Message-ID: <df03e637354be695652a787563af21ac77b4c61f813ae4491a3397a91df7688e@mail.kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363294-linux-kernel-netdev=dewy.ru
References: <20261114-work-loop-pseudo-v2-17-98639a2286fb@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363294-linux-kernel-netdev=dewy.ru
From: bot+bpf-ci@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH RFC v2 17/42] securityfs: use fc_init_pseudo()
Date: Sat, 14 Nov 2026 13:54:57 +0000 (UTC)
Organization: Usenet Network
Message-ID: <df03e637354be695652a787563af21ac77b4c61f813ae4491a3397a91df7688e@mail.kernel.org>
References: <20261114-work-loop-pseudo-v2-17-98639a2286fb@kernel.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============1687560790659556623=="
Injection-Info: usenet.network;
	logging-data="1582753"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:LjTDIbMT1JDRmWAivEzeZHgwHh8= sha256:zs9ipXO2KZmjQkN9OS++t1Sben2VzuM52xBkIU4S5Xo=
	sha1:Kx86oqlZSao/H2n4q5cP4OdEOQk= sha256:lTOj11BfKnqpY3MAzpRNbSWzVnJW9yIDr7h34oHV2Q0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0E0B3114816; Sat, 14 Nov 2026 16:55:54 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id YEi2_djU1nho;
	Sat, 14 Nov 2026 16:55:46 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-363294-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 4849E11481D; Sat, 14 Nov 2026 16:55:37 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 667E4611D3E; Sat, 14 Nov 2026 13:55:31 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794664502;
	b=miHN5bbthYILwZq85rqbywFu0TU5zj5L17yevIuWXLh+KFE9A/Ifrb/g4cdbBGT+kMLy
	 S61S3Rz38vjBpUK0ptvdZgxrzI7XzBax4ZBatsz3dWJe3/T/na+R91LZOiJQiBGoEyH2z
	 qJXTjF3Z52Wf10hEulJRAFTDK9X3ISYcqYj2TeujM4/BQ91lelxnq/MPbcbNZwb+c8rSb
	 8W3qYpGG7T2aYiG7D5GCklEDaZRZCGioJz3xqsf7P2MSVK0cbYeoQclU/4Kiu5Viz3l2G
	 hwxWUtYa2d63L+2FvYolllWM8g9hZ2oaXSwitQSdhrsnFFh1891Z/AxIHdIcv0dtkEw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794664502;
	h=X-Original-To:Received:Received:DKIM-Signature:Content-Type:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=Xi+Jp34UVw8n6rWUcn3QcZPlSKYiPMqX7yCNJrzL8oU=;
	b=tqhuI2LXIPpCjfbq7iyRXTqDrI8aiZSyTgonq5wskOOM+G2USXuy69Q5JTK9gg9xb4le
	 QOe0Iqf9+lOH8i4hJcsiMjW11rugr3qoM/AuX+VCN0t0GenMYIsD47jfujWTKGtsqdQsu
	 fOJdGA8yJI0iBZYw1DCl8NUErct1T0hGmBfMzTSC06b/crrJAXoK/S6OZjZshQ3QUOZFw
	 c8dTRqsZ29TjuNcfSU7O9ZVFFOyXe/apsR8avAbNCemTspMBI1Ud9ghaHGwIccdo9w5C2
	 osSxRpCfkSP+9/tYvjuza2NnSXCwbXMExoNzvx7AKjg8VBBYlJNNZ+L8lteYqOqeP3g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bfkXAKnv;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A4B660A261C;
	Sat, 14 Nov 2026 13:55:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bfkXAKnv
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794664501;
	b=cLGcvge92KiX02qJXq7uxyR91ydJhYBePS75pKy/BcgvyWG0Mvc8dn9ki/8lU6dNV/qt
	 Fo55TModoHknaWL6aiBzxaKXfhTq0pt3GBnPWfQI9x91xFRdjGc04GqatfDKKD42DUqJw
	 m5pkkpjj6qb+kKEtrqzP5unnEkHArMzJvH9jIymZsJHRk73uq9mlS5JrX41JCkdThkP9y
	 C1GU/S5jMfYS0BoTp6D7A8AQFrtc+6wvALCiPc3s2tOarcy1NaMTjKqPLLigVBzG7eoC/
	 8DYaV52B19AxPBJFNGhfcVDf4h5htYV4sf8FFaUJe67Zxp85D+RfQ8L1QvQS+nxe9jQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794664501;
	h=Received:DKIM-Signature:Content-Type:MIME-Version:Message-Id:
	 In-Reply-To:References:Subject:From:To:Cc:Date;
	bh=Xi+Jp34UVw8n6rWUcn3QcZPlSKYiPMqX7yCNJrzL8oU=;
	b=V5R/exzs30werKTVaB6ZQc3TTKRigA6AvPUuUBGkEjUzmYfhFLBhm7eo+ZDi9HLGCmqj
	 2NKSL3pWWn6Yw+wKvZEWD6ofmstErSLauaEeMF88x0YZblQnbV8zVEnH2ou6Oe25aOuuS
	 OoewL4srl9D025D5TkE+J0RCBrRp4y7MVfhRXoerGAtL6NVj/rSIaPBI32Vbj0KB0RtpA
	 ekG2pMVTSe4lVtDE98jviAgy9LbNQ6XA/2eE3oHNdCqXN5lIYK47C6Fc0JsWHRhNi2thF
	 R0+ALYwgRdX8JcW23gHIYtu0K65Hrp8tfE2eHDChoyoVeP+6DjW9QsMMZfcCS6lnW8g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bfkXAKnv;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 918CF606A330;
	Sat, 14 Nov 2026 13:55:01 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E36F01F000C6;
	Sat, 14 Nov 2026 13:54:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794664501;
	bh=Xi+Jp34UVw8n6rWUcn3QcZPlSKYiPMqX7yCNJrzL8oU=;
	h=In-Reply-To:References:Subject:From:To:Cc:Date;
	b=bfkXAKnvyN3NrzfYhrVigeGIKvr/8evEe0tQ8KwSyEafhDf3+AXVoqojleCZ7/Qdh
	 2b013ZilynaxVntPTxgtS9Fyq3b+7yXhPeXkFfQ9ONM2J9MEOM/JQ3B/znTjkCUpqc
	 r0tlhXctgE98kfAt1ITbmi9H0tApXPCL2XTcrVOM5qnz/NrX0rxwji+SmXMUOe8YHy
	 kRbhgqC/kLnhpgS61Qu7Lfu7BuXDWJsHjF+zOY5u5KKN5rR5uvcX/zOV7QTiz8dq9Z
	 GTd5PKapaf6tpFoOvo6qdgngRWS5W1FIZVvnJWAJ8F5DAYQTkJUN/Wbu5kFv6IHajV
	 XPu1vrQEYpCgg==
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261114-work-loop-pseudo-v2-17-98639a2286fb@kernel.org>
X-Cc: jannh@google.com,mason@kernel.org,josef@toxicpanda.com,hch@lst.de,linux-block@vger.kernel.org,linux-kernel@vger.kernel.org,linux-nvme@lists.infradead.org,viro@zeniv.linux.org.uk,jack@suse.cz,linux-scsi@vger.kernel.org,target-devel@vger.kernel.org,driver-core@lists.linux.dev,linux-mm@kvack.org,bpf@vger.kernel.org,linux-security-module@vger.kernel.org,selinux@vger.kernel.org,apparmor@lists.ubuntu.com,linux-nfs@vger.kernel.org,netdev@vger.kernel.org,fuse-devel@lists.linux.dev,linux-efi@vger.kernel.org,xen-devel@lists.xenproject.org,ocfs2-devel@lists.linux.dev,linux-s390@vger.kernel.org,linuxppc-dev@lists.ozlabs.org,linux-usb@vger.kernel.org,amir73il@gmail.com,linux-erofs@lists.ozlabs.org,linux-kselftest@vger.kernel.org,brauner@kernel.org,alex@amutable.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,mason@kernel.org,ihor.solodrai@linux.dev