Re: [PATCH net v2] scm: fix negative fds with SO_PASSPIDFD

From: Alexander Mikhalitsyn
Date: Mon Nov 18 2024 - 10:00:21 EST


Am So., 17. Nov. 2024 um 11:11 Uhr schrieb stsp <stsp2@xxxxxxxxx>:
>
> 17.11.2024 13:04, stsp пишет:
> > 17.11.2024 12:40, Alexander Mikhalitsyn пишет:
> >> Hi Stas,
> >>
> >> Actually, it's not a forgotten check. It's intended behavior to pass
> >> through errors from pidfd_prepare() to
> >> the userspace. In my first version [1] of the patch I tried to return
> >> ESRCH instead of EINVAL in your case, but
> >> then during discussions we decided to remove that.
> >>
> >> [1]
> >> https://lore.kernel.org/all/20230316131526.283569-2-aleksandr.mikhalitsyn@xxxxxxxxxxxxx/
> > Yes, the patch you referenced above,
> > only calls put_cmsg() with an error code.
> >
> > But the code I can see now in git, does
> > much more. Namely,
> > if (pidfd_file)
> > fd_install(pidfd, pidfd_file);
> Ah, I guess pidfd_file is a culprit.

Hey,

Precisely, when an error happens then pidfd_file is NULL.

Kind regards,
Alex

> Thanks.