Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 May 2021 14:48:00 +1000
From:      Peter Jeremy <peter@rulingia.com>
To:        monochrome <monochrome@twcny.rr.com>
Cc:        freebsd-stable@freebsd.org
Subject:   fileargs_init(3) doesn't work without CAPABILITIES (was: Re: tail(1) broken in 13-stable)
Message-ID:  <YJTGgEqKC2OpQRmU@server.rulingia.com>
In-Reply-To: <dcf37b27-aa2a-c320-1e39-72cda2038044@twcny.rr.com>
References:  <YJPBUOKKv4cDHhmq@server.rulingia.com> <CAGOYWV_8_MXvTfCGix8jzZeuysiUpXkVQErnpSyB2V=63%2B1-nA@mail.gmail.com> <YJPXvFzBRSDH74in@server.rulingia.com> <dcf37b27-aa2a-c320-1e39-72cda2038044@twcny.rr.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--ApwmoHD7ukuZUtXS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2021-May-06 19:07:23 -0400, monochrome <monochrome@twcny.rr.com> wrote:
=2E..
>On 5/6/21 7:49 AM, Peter Jeremy via freebsd-stable wrote:
=2E..
>> server% tail /COPYRIGHT <&-
>> Assertion failed: (procfd > STDERR_FILENO), function service_clean, file=
 /usr/src/lib/libcasper/libcasper/service.c, line 394.
>> tail: unable to init casper: Socket is not connected

>I get a different error on a 13.0-RELEASE machine I converted from 12 to=
=20
>current about a year ago (bash and sh):
>
>$ tail /COPYRIGHT <&-
>tail: can't limit stdio rights: Bad file descriptor

I've done some more testing across a number of systems and narrowed the
difference in behaviour down to the presence of the CAPABILITIES option in
the kernel (it looks like I never added it to my kernel config on that
system):

If CAPABILITIES is present then the cap_rights_limit(2) call for the closed
FD fails, generating the "can't limit stdio rights" error.  (Whether this
behaviour is reasonable is a different issue - it was introduced in r348708,
based on https://reviews.freebsd.org/D20393 and the issue of closed file
descriptors doesn't seem to have been considered).

If CAPABILITIES is not present then the cap_rights_limit() failure is
(correctly) ignored but the subsequent fileargs_init(3) call gets upset at
opening a FD <=3D 2.  This behaviour seems wrong - if CAPABILITIES aren't
present in the kernel then the userland behaviour should be the same as if
WITHOUT_CASPER is specified.

IMO, this is a bug in fileargs_init(3).

--=20
Peter Jeremy

--ApwmoHD7ukuZUtXS
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAmCUxnNfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF
QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi
CzQucQ//dIKgwdPp3VbIZFFposFSDzam/5Sv9jFVXKpurBozlQnlHevQczxIbgt9
8jDrJk/N1SgGJOAvFYklnDgyxOF33NDlNcIltnpsvPqa82cLwTdIONKY446rrh33
ZaIYxhmgYt5Lape0iLWuRA1AX6dCJ/5K+z6eFcgB0+EWVMALvonSYfVmTTRb/hqk
YxhaEZayh5ugKgs+9d1cmh3wEpBEqm7sTdM5N9ivO2KJK/1T0jrkiyG2vDN3vjYj
5tRqYN4gaWjz46Bt5sPeW9tbMXf9GlyERuWxDcl692QLwbBw2Dm3FTPCBzyL9XlQ
mHVx09rF+8Tayw2kKNZkUSLc42EVVCxJnwBzruVkGgBccnlUp9bBUZbTWdQFDgAJ
kns1nsCS8+R5p6AVLVtDni8gnyszHPUUzNwetcKERfPVrWtjsN3hsb4ud03BLIRl
uCaFEdv4mdewZmi5JMpeatb+T/wx6cVov1p8rOX0mk74d/0lIOD51HFcMTxICMzH
o4K6wIlaU7Q2dvzDwSdAoe5l+SGrR2ReVGiIy45i84XLrvvEx23MPzg+tS4tVEfM
PT3a9g8L17CEA0/k9j0mTEqTmJMHFQxxWfL+ZDRfpfQOoyELMwMfUj0ApfjP/kl6
QglE+H9e58+XCG2UgE0VMvbhVS7avOgPVgiOEp15/nwrZR6Lldw=
=LRic
-----END PGP SIGNATURE-----

--ApwmoHD7ukuZUtXS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YJTGgEqKC2OpQRmU>