fileargs_init(3) doesn't work without CAPABILITIES (was: Re: tail(1) broken in 13-stable)

2021-05-06 Thread Peter Jeremy via freebsd-stable
On 2021-May-06 19:07:23 -0400, monochrome  wrote:
...
>On 5/6/21 7:49 AM, Peter Jeremy via freebsd-stable wrote:
...
>> 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 
>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 <= 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).

-- 
Peter Jeremy


signature.asc
Description: PGP signature


Re: tail(1) broken in 13-stable

2021-05-06 Thread monochrome




On 5/6/21 7:49 AM, Peter Jeremy via freebsd-stable wrote:

On 2021-May-06 12:59:54 +0200, Mariusz Zaborski  wrote:

Could you provide details how to reproduce this?

On Thu, 6 May 2021 at 12:13, Peter Jeremy via freebsd-stable
 wrote:


Since updating from 12-stable to 13-stable, I've found that tail(1)
crashes, reporting:
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
unless all three of stdin, stdout and stderr are open.  Whilst it
probably doesn't make sense to call tail without stdout open. there's
no obvious reason to require that stdin or stderr must be open.


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



(fixed quote with some additional tests)

I get a different error on a 13.0-RELEASE machine I converted from 12 to 
current about a year ago (bash and sh):


$ tail /COPYRIGHT <&-
tail: can't limit stdio rights: Bad file descriptor

works with sudo:

$ sudo tail /COPYRIGHT <&-
  *California, Berkeley and its contributors."
etc etc...

but not as root, with a different error in sh:

# tail /COPYRIGHT <&-
Missing name for redirect.

as root in bash:

# tail /COPYRIGHT <&-
tail: can't limit stdio rights: Bad file descriptor

works as both user and root in ksh
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: tail(1) broken in 13-stable

2021-05-06 Thread monochrome




On 5/6/21 7:49 AM, Peter Jeremy via freebsd-stable wrote:

tail /COPYRIGHT <&-



I get a different error on a 13.0-RELEASE machine I converted from 12 to 
current about a year ago:


$ tail /COPYRIGHT <&-
tail: can't limit stdio rights: Bad file descriptor
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Fresh releng/13.0 release/13.0.0 install: "newsyslog: malformed 'at' value" messages

2021-05-06 Thread Mark Millard via freebsd-stable
Having used bsdinstall to make a USB3 SSD on a RPi4B
(zfs-on-root, GPT parition, RPi4B materials copied
copied to msdos file system), booting gets error notices:

newsyslog: malformed 'at' value:
/var/log/all.log600  7 *@T00  J

newsyslog: malformed 'at' value:
/var/log/auth.log   600  7 1000 @0101T JC

newsyslog: malformed 'at' value:
/var/log/daily.log  640  7 *@T00  JN

newsyslog: malformed 'at' value:
/var/log/maillog640  7 *@T00  JC

newsyslog: malformed 'at' value:
/var/log/messages   644  5 1000 @0101T JC

newsyslog: malformed 'at' value:
/var/log/utx.log644  3 *@01T05 B

newsyslog: malformed 'at' value:
/var/log/daemon.log 644  5 1000 @0101T JC

It is apparently complaining about some of the
content in:

# more /etc/newsyslog.conf
# configuration file for newsyslog
# $FreeBSD$
#
# Entries which do not specify the '/pid_file' field will cause the
# syslogd process to be signalled when that log file is rotated.  This
# action is only appropriate for log files which are written to by the
# syslogd process (ie, files listed in /etc/syslog.conf).  If there
# is no process which needs to be signalled when a given log file is
# rotated, then the entry for that file should include the 'N' flag.
#
# Note: some sites will want to select more restrictive protections than the
# defaults.  In particular, it may be desirable to switch many of the 644
# entries to 640 or 600.  For example, some sites will consider the
# contents of maillog, messages, and lpd-errs to be confidential.  In the
# future, these defaults may change to more conservative ones.
#
# logfilename  [owner:group]mode count size when  flags [/pid_file] 
[sig_num]
/var/log/all.log600  7 *@T00  J
/var/log/auth.log   600  7 1000 @0101T JC
/var/log/console.log600  5 1000 * J
/var/log/cron   600  3 1000 * JC
/var/log/daily.log  640  7 *@T00  JN
/var/log/debug.log  600  7 1000 * JC
/var/log/init.log   644  3 1000 * J
/var/log/kerberos.log   600  7 1000 * J
/var/log/maillog640  7 *@T00  JC
/var/log/messages   644  5 1000 @0101T JC
/var/log/monthly.log640  12*$M1D0 JN
/var/log/devd.log   644  3 1000 * JC
/var/log/security   600  101000 * JC
/var/log/utx.log644  3 *@01T05 B
/var/log/weekly.log 640  5 *$W6D0 JN
/var/log/daemon.log 644  5 1000 @0101T JC

 /etc/newsyslog.conf.d/[!.]*.conf
 /usr/local/etc/newsyslog.conf.d/[!.]*.conf


Specifically, the 7 lines with "@" involved under "when" get the
complaints.


===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


Re: tail(1) broken in 13-stable

2021-05-06 Thread Peter Jeremy via freebsd-stable
On 2021-May-06 12:59:54 +0200, Mariusz Zaborski  wrote:
>Could you provide details how to reproduce this?
>
>On Thu, 6 May 2021 at 12:13, Peter Jeremy via freebsd-stable
> wrote:
>>
>> Since updating from 12-stable to 13-stable, I've found that tail(1)
>> crashes, reporting:
>> 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
>> unless all three of stdin, stdout and stderr are open.  Whilst it
>> probably doesn't make sense to call tail without stdout open. there's
>> no obvious reason to require that stdin or stderr must be open.

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

-- 
Peter Jeremy


signature.asc
Description: PGP signature


Re: tail(1) broken in 13-stable

2021-05-06 Thread Mariusz Zaborski
Could you provide details how to reproduce this?

On Thu, 6 May 2021 at 12:13, Peter Jeremy via freebsd-stable
 wrote:
>
> Since updating from 12-stable to 13-stable, I've found that tail(1)
> crashes, reporting:
> 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
> unless all three of stdin, stdout and stderr are open.  Whilst it
> probably doesn't make sense to call tail without stdout open. there's
> no obvious reason to require that stdin or stderr must be open.
>
> --
> Peter Jeremy
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


tail(1) broken in 13-stable

2021-05-06 Thread Peter Jeremy via freebsd-stable
Since updating from 12-stable to 13-stable, I've found that tail(1)
crashes, reporting:
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
unless all three of stdin, stdout and stderr are open.  Whilst it
probably doesn't make sense to call tail without stdout open. there's
no obvious reason to require that stdin or stderr must be open.

-- 
Peter Jeremy


signature.asc
Description: PGP signature