[systemd-devel] systemd failing to close unwanted file descriptors & FDS spawning and crashing

Mantas Mikulėnas grawity at gmail.com
Thu Mar 3 20:30:50 UTC 2022


Ah, right, I forgot – since this is done in the service child (right before
exec) and not in the main process, you probably need to add the -f option
to make strace follow forks...

On Thu, Mar 3, 2022, 22:08 Christopher Obbard <chris.obbard at collabora.com>
wrote:

> Hi Mantas,
>
> On 03/03/2022 19:18, Mantas Mikulėnas wrote:
> > On Thu, Mar 3, 2022 at 9:09 PM Christopher Obbard
> > <chris.obbard at collabora.com <mailto:chris.obbard at collabora.com>> wrote:
> >
> >     Hi systemd experts!
> >
> >     I am using systemd-247 and systemd-250 on debian system, which is
> >     running a minimal downstream 5.4 kernel for a Qualcomm board.
> >
> >     systemd 241 in debian buster works fine, but systemd 247 (debian
> >     bullseye) and systemd 250 (debian unstable) seem to get upset about
> >     file
> >     descriptors on services. These errors are consistant and the board
> >     boots
> >     just fine with init=/bin/sh
> >
> >     I've got the required kernel config from README in my kernel, I am
> >     using
> >     a heavily patched downstream kernel, but from the following log can
> you
> >     suggest anything I can do to debug this (other than throwing the
> board
> >     out of the window) ?
> >
> >
> >  From the message, it looks like the error is returned by
> > close_all_fds() in src/basic/fd-util.c, where the only major change is
> > that it has been ported to call close_range() if that's available...
> >
> > I would boot with init=/bin/sh, then run `exec strace -D -o
> > /var/log/systemd.trace /lib/systemd/systemd` to get a trace, and see if
> > the EINVAL actually comes from calling close_range() or from something
> else.
> >
> > --
> > Mantas Mikulėnas
>
> Thanks for your reply. It reproduced nicely with the command you gave.
>
> Seems like nothing related to close_range returning EINVAL, only the
> following calls returned EINVAL:
>
> cat systemd-failing.trace | grep EINVAL
> prctl(PR_CAPBSET_READ, 0x30 /* CAP_??? */) = -1 EINVAL (Invalid argument)
> prctl(PR_CAPBSET_READ, CAP_CHECKPOINT_RESTORE) = -1 EINVAL (Invalid
> argument)
> prctl(PR_CAPBSET_READ, CAP_PERFMON)     = -1 EINVAL (Invalid argument)
> read(4, 0x55675a75b0, 4095)             = -1 EINVAL (Invalid argument)
> mount("cgroup2", "/proc/self/fd/4", "cgroup2",
> MS_NOSUID|MS_NODEV|MS_NOEXEC, "nsdelegate,memory_recursiveprot") = -1
> EINVAL (Invalid argument)
>
>
> I have attached the full strace output, in case that would be useful?
>
> Thanks
> Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20220303/4b0ce697/attachment.htm>


More information about the systemd-devel mailing list