NetBSD Problem Report #56130
From www@netbsd.org Mon Apr 26 04:46:58 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 12BDC1A926D
for <gnats-bugs@gnats.NetBSD.org>; Mon, 26 Apr 2021 04:46:58 +0000 (UTC)
Message-Id: <20210426044657.47ABA1A926E@mollari.NetBSD.org>
Date: Mon, 26 Apr 2021 04:46:57 +0000 (UTC)
From: lenzi.sergio@gmail.com
Reply-To: lenzi.sergio@gmail.com
To: gnats-bugs@NetBSD.org
Subject: fdescfs create nodes with wrong major number
X-Send-Pr-Version: www-1.0
>Number: 56130
>Category: kern
>Synopsis: fdescfs create nodes with wrong major number
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: hannken
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 26 04:50:00 +0000 2021
>Closed-Date: Thu May 13 11:32:21 +0000 2021
>Last-Modified: Thu May 13 11:32:21 +0000 2021
>Originator: sergio lenzi
>Release: 9.1_STABLE
>Organization:
k1 sistemas
>Environment:
NetBSD netbsd64dev.netbsd 9.1_STABLE NetBSD 9.1_STABLE (LZT9) #0: Sun Apr 25 17:41:07 -03 2021 NetBSD@netbsd64dev.netbsd:/home/NetBSD/BUILD/9/amd64/OBJ/sys/arch/amd64/compile/GENERIC amd64
>Description:
when mount fdesc the devices /dev/fd/0 /dev/fd/1 .... have the major assign to 5 instead of 22, so the open /dev/fd/0 result in Devince not configured message\
this happens in both 9.1 and 9.99.XX also
>How-To-Repeat:
mount_fdesc -o union,rw fdesc /dev/fd
this creates: /dev/fd/0, /dev/fd/1 .....
and links /dev/stdin to /dev/fd/0 .....
but with the wrong major number so the system is unable to open /dev/stdin, /dev/stdout .....
>Fix:
>Release-Note:
>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/56130: fdescfs create nodes with wrong major number
Date: Mon, 26 Apr 2021 09:02:06 -0000 (UTC)
lenzi.sergio@gmail.com writes:
>when mount fdesc the devices /dev/fd/0 /dev/fd/1 .... have the major assign to 5 instead of 22, so the open /dev/fd/0 result in Devince not configured message\
>this happens in both 9.1 and 9.99.XX also
The problem is not the major number, it isn't used when you open a file
on the fdesc filesystem.
When you open a special file on UFS, it mogrifies the vnode to reference
specfs. That's where the major/minor numbers are used, and that's how
without the fdesc filesystem you can acess /dev/fd/* or e.g. /dev/stdin
where specfs would call the filedesc driver (major 22).
fdesc just duplicates the process filedescriptor itself, just like the
filedesc driver would do, without going through specfs. The advantage is
that you can do a ls -l and see directly the filesystem objects that
have been opened by the process.
The bug you found is that fdesc keeps the /dev/fd/* entries internally
as VNON vnodes, and 2 years ago hannken@ added a sanity check to the
kernel that forbids to open VNON vnodes with an ENXIO error.
I'm not sure if that sanity check is overreaching or whether fdesc
should just use a VREG vnode.
From: Sergio de Almeida Lenzi <lenzi.sergio@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/56130: fdescfs create nodes with wrong major number,
solved
Date: Mon, 26 Apr 2021 11:09:07 -0300
--=-IAgbO6rVLuKq8llE58V/
Content-Type: multipart/alternative; boundary="=-D/OFZbjZUfZkDNydFS8y"
--=-D/OFZbjZUfZkDNydFS8y
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Em seg, 2021-04-26 Ã s 04:50 +0000, gnats-admin@netbsd.org escreveu:
> Thank you very much for your problem report.
> It has the internal identification `kern/56130'.
> The individual assigned to look at your
> report is: kern-bug-people.
>
> > Category: kern
> > Responsible: kern-bug-people
> > Synopsis: fdescfs create nodes with wrong major number
> > Arrival-Date: Mon Apr 26 04:50:00 +0000 2021
>
This patch reverses the one from 2019 so fdescfs works again
Thank you, mlelstv@serpens.de (Michael van Elst),  for your help,
pointing me to the solution
--=-D/OFZbjZUfZkDNydFS8y
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html><head></head><body><div>Em seg, 2021-04-26 =C3=A0s 04:50 +0000, gnats=
-admin@netbsd.org escreveu:</div><blockquote type=3D"cite" style=3D"margin:=
0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>Thank you =
very much for your problem report.</pre><pre>It has the internal identifica=
tion `kern/56130'.</pre><pre>The individual assigned to look at your</pre><=
pre>report is: kern-bug-people. </pre><pre><br></pre><blockquote type=3D"ci=
te" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:=
1ex"><pre>Category: kern</pre><pre>Responsible: kern-bug-people</p=
re><pre>Synopsis: fdescfs create nodes with wrong major number</pre><=
pre>Arrival-Date: Mon Apr 26 04:50:00 +0000 2021</pre></blockquote></bloc=
kquote><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2p=
x #729fcf solid;padding-left:1ex"><pre><br></pre></blockquote><div>This pat=
ch reverses the one from 2019 so fdescfs works again</div><div>Thank you,&n=
bsp;<a href=3D"mailto:mlelstv@serpens.de" title=3D"Click to mail mlelstv@se=
rpens.de" style=3D"font-family: monospace;">mlelstv@serpens.de</a><span sty=
le=3D"font-family: monospace;"> (Michael van Elst), for your hel=
p, pointing me to the solution</span></div><div class=3D"-x-evo-signature-w=
rapper"><span class=3D"-x-evo-signature" id=3D"none"></span></div></body></=
html>
--=-D/OFZbjZUfZkDNydFS8y--
--=-IAgbO6rVLuKq8llE58V/
Content-Description:
Content-Disposition: inline; filename="patch-vfs_vnops.c"
Content-Type: text/plain; name="patch-vfs_vnops.c"; charset="UTF-8"
Content-Transfer-Encoding: 7bit
RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
retrieving revision 1.200
diff -u -r1.200 vfs_vnops.c
--- vfs_vnops.c 7 Mar 2019 11:09:48 -0000 1.200
+++ vfs_vnops.c 26 Apr 2021 13:06:31 -0000
@@ -297,7 +297,7 @@
int permbits = 0;
int error;
- if (vp->v_type == VNON || vp->v_type == VBAD)
+ if (vp->v_type == VBAD)
return ENXIO;
if ((fflags & O_DIRECTORY) != 0 && vp->v_type != VDIR)
--=-IAgbO6rVLuKq8llE58V/--
From: Sergio de Almeida Lenzi <lenzi.sergio@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/56130: fdescfs create nodes with wrong major number
Date: Mon, 26 Apr 2021 11:22:34 -0300
--=-4t4gNmpDfbj8K0mPImwN
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Em seg, 2021-04-26 Ã s 04:50 +0000, gnats-admin@netbsd.org escreveu:
> Thank you very much for your problem report.
> It has the internal identification `kern/56130'.
> The individual assigned to look at your
> report is: kern-bug-people.
>
> > Category: kern
> > Responsible: kern-bug-people
> > Synopsis: fdescfs create nodes with wrong major number
> > Arrival-Date: Mon Apr 26 04:50:00 +0000 2021
>
mount ptyfs works again
in /etc/fstab....
=====================================================
fdesc /dev fdesc ro,-o=union 0 0
ptyfs /dev/pts ptyfs rw 0 0
--=-4t4gNmpDfbj8K0mPImwN
Content-Type: text/plain; name="patch-vfs_vnops.c"; charset="UTF-8"
Content-Description:
Content-Disposition: attachment; filename="patch-vfs_vnops.c"
Content-Transfer-Encoding: base64
UkNTIGZpbGU6IC9jdnNyb290L3NyYy9zeXMva2Vybi92ZnNfdm5vcHMuYyx2CnJldHJpZXZpbmcg
cmV2aXNpb24gMS4yMDAKZGlmZiAtdSAtcjEuMjAwIHZmc192bm9wcy5jCi0tLSB2ZnNfdm5vcHMu
Ywk3IE1hciAyMDE5IDExOjA5OjQ4IC0wMDAwCTEuMjAwCisrKyB2ZnNfdm5vcHMuYwkyNiBBcHIg
MjAyMSAxMzowNjozMSAtMDAwMApAQCAtMjk3LDcgKzI5Nyw3IEBACiAJaW50IHBlcm1iaXRzID0g
MDsKIAlpbnQgZXJyb3I7CiAKLQlpZiAodnAtPnZfdHlwZSA9PSBWTk9OIHx8IHZwLT52X3R5cGUg
PT0gVkJBRCkKKwlpZiAodnAtPnZfdHlwZSA9PSBWQkFEKQogCQlyZXR1cm4gRU5YSU87CiAKIAlp
ZiAoKGZmbGFncyAmIE9fRElSRUNUT1JZKSAhPSAwICYmIHZwLT52X3R5cGUgIT0gVkRJUikK
--=-4t4gNmpDfbj8K0mPImwN--
From: "Juergen Hannken-Illjes" <hannken@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56130 CVS commit: src/sys/miscfs/fdesc
Date: Sat, 1 May 2021 15:08:15 +0000
Module Name: src
Committed By: hannken
Date: Sat May 1 15:08:14 UTC 2021
Modified Files:
src/sys/miscfs/fdesc: fdesc_vnops.c
Log Message:
Make sure fdesc_lookup() never returns VNON vnodes.
Should fix PR kern/56130 (fdescfs create nodes with wrong major number)
To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/miscfs/fdesc/fdesc_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Responsible-Changed-From-To: kern-bug-people->hannken
Responsible-Changed-By: hannken@NetBSD.org
Responsible-Changed-When: Sun, 02 May 2021 15:23:12 +0000
Responsible-Changed-Why:
Take.
State-Changed-From-To: open->feedback
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Sun, 02 May 2021 15:23:12 +0000
State-Changed-Why:
Committed a fix -- please confirm sys/miscfs/fdesc/fdesc_vnops.c rev. 1.135
fixes your problem.
From: Sergio de Almeida Lenzi <lenzi.sergio@gmail.com>
To: gnats-bugs@netbsd.org, hannken@netbsd.org, kern-bug-people@netbsd.org,
netbsd-bugs@netbsd.org, gnats-admin@netbsd.org
Cc:
Subject: Re: kern/56130 (fdescfs create nodes with wrong major number) FIXED
Date: Mon, 03 May 2021 00:26:54 -0300
--=-GJcvovt9BOUBkITM3tgF
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit
Em dom, 2021-05-02 Ã s 15:23 +0000, hannken@NetBSD.org escreveu:
> Synopsis: fdescfs create nodes with wrong major number
>
> Responsible-Changed-From-To: kern-bug-people->hannken
> Responsible-Changed-By: hannken@NetBSD.org
> Responsible-Changed-When: Sun, 02 May 2021 15:23:12 +0000
> Responsible-Changed-Why:
> Take.
>
>
> State-Changed-From-To: open->feedback
> State-Changed-By: hannken@NetBSD.org
> State-Changed-When: Sun, 02 May 2021 15:23:12 +0000
> State-Changed-Why:
> Committed a fix -- please confirm sys/miscfs/fdesc/fdesc_vnops.c rev. 1.135
> fixes your problem.
>
>
>
I can confirm it fixed the fdescfs  now /dev/fd/0  works as expected
BUT DOES not fixed the same issue on /dev/pts  when I mount ptyfs on
/dev/pts
can it be fixed?Â
--=-GJcvovt9BOUBkITM3tgF
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html><head></head><body><div>Em dom, 2021-05-02 =C3=A0s 15:23 +0000, hannk=
en@NetBSD.org escreveu:</div><blockquote type=3D"cite" style=3D"margin:0 0 =
0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><pre>Synopsis: fdes=
cfs create nodes with wrong major number</pre><pre><br></pre><pre>Responsib=
le-Changed-From-To: kern-bug-people->hannken</pre><pre>Responsible-Chang=
ed-By: <a href=3D"mailto:hannken@NetBSD.org">hannken@NetBSD.org</a></pre><p=
re>Responsible-Changed-When: Sun, 02 May 2021 15:23:12 +0000</pre><pre>Resp=
onsible-Changed-Why:</pre><pre>Take.</pre><pre><br></pre><pre><br></pre><pr=
e>State-Changed-From-To: open->feedback</pre><pre>State-Changed-By: <a h=
ref=3D"mailto:hannken@NetBSD.org">hannken@NetBSD.org</a></pre><pre>State-Ch=
anged-When: Sun, 02 May 2021 15:23:12 +0000</pre><pre>State-Changed-Why:</p=
re><pre>Committed a fix -- please confirm sys/miscfs/fdesc/fdesc_vnops.c re=
v. 1.135</pre><pre>fixes your problem.</pre><pre><br></pre><pre><br></pre><=
pre><br></pre></blockquote><div>I can confirm it fixed the fdescfs no=
w /dev/fd/0 works as expected</div><div>BUT DOES not fixed the same i=
ssue on /dev/pts when I mount ptyfs on /dev/pts</div><div><br></div><=
div>can it be fixed? </div><div class=3D"-x-evo-signature-wrapper"><sp=
an class=3D"-x-evo-signature" id=3D"none"></span></div></body></html>
--=-GJcvovt9BOUBkITM3tgF--
From: "J. Hannken-Illjes" <hannken@eis.cs.tu-bs.de>
To: NetBSD GNATS <gnats-bugs@netbsd.org>
Cc:
Subject: Re: kern/56130 (fdescfs create nodes with wrong major number) FIXED
Date: Mon, 3 May 2021 09:45:40 +0200
--Apple-Mail=_FB5DEFA8-2DEB-449E-ACB3-636B4FA636E5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=us-ascii
> On 3. May 2021, at 05:30, Sergio de Almeida Lenzi =
<lenzi.sergio@gmail.com> wrote:
>=20
> I can confirm it fixed the fdescfs now /dev/fd/0 works as expected
> BUT DOES not fixed the same issue on /dev/pts when I mount ptyfs on
> /dev/pts
Ok, will close this PR.
Could you explain your problems with ptyfs in more detail
or better open a new PR?
--
J. Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig
--Apple-Mail=_FB5DEFA8-2DEB-449E-ACB3-636B4FA636E5
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename=signature.asc
Content-Type: application/pgp-signature;
name=signature.asc
Content-Description: Message signed with OpenPGP
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEE2BL3ha7Xao4WUZVYKoaVJdNr+uEFAmCPqiQACgkQKoaVJdNr
+uFNwAgAi1Cr/G//rqwzxHzzhZ4mvoDRxZY3XD9/K4ecgYifAx39H0IVp3ev2ImT
SeEsyKQo1vYviTVSCpiRxyNBGt4nNOaWehL0MLHJROWclN8OomJcR0wPOrLkZpBA
lwZAgKLziFrkeXCS0IbE1QnKegA3NEjeie7+7vDhwDFesK9gSQmegkkRe4Bg4lHT
jxtojj4k7uroxyaYUKqE33B4wzkxcgBmtTfduuwYQBmhgYdrpJOP0Wxncjl+Bb2z
YNzEyiDzD3IMPyg5O0Rdjmm7lQp6Xx8GxL7U5f2vWa38Uvk+GJnGYMmNXMg+nmmN
pP2mJM2lvnFvHFMhQNIzl4I2IbfeFA==
=vFi/
-----END PGP SIGNATURE-----
--Apple-Mail=_FB5DEFA8-2DEB-449E-ACB3-636B4FA636E5--
From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/56130 CVS commit: [netbsd-9] src/sys/miscfs/fdesc
Date: Mon, 3 May 2021 09:03:22 +0000
Module Name: src
Committed By: martin
Date: Mon May 3 09:03:22 UTC 2021
Modified Files:
src/sys/miscfs/fdesc [netbsd-9]: fdesc_vnops.c
Log Message:
Pull up following revision(s) (requested by hannken in ticket #1267):
sys/miscfs/fdesc/fdesc_vnops.c: revision 1.135
Make sure fdesc_lookup() never returns VNON vnodes.
Should fix PR kern/56130 (fdescfs create nodes with wrong major number)
To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.130.4.1 src/sys/miscfs/fdesc/fdesc_vnops.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: feedback->closed
State-Changed-By: hannken@NetBSD.org
State-Changed-When: Thu, 13 May 2021 11:32:21 +0000
State-Changed-Why:
Confirmed fixed -- pullup done.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.