Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Sep 2025 10:35:41 +0300
From:      Gleb Popov <arrowd@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        kib@freebsd.org, dev-commits-src-all@freebsd.org,  dev-commits-src-main@freebsd.org
Subject:   Re: git: fd9e09cb2ab0 - main - kern: replace several EBADF with EINVAL
Message-ID:  <CALH631nneSwOva235ioVakjod46HnkB_UfV_Va0aQYh-viwT4w@mail.gmail.com>
In-Reply-To: <aMXFnO8lG-YuB9Hs@kib.kiev.ua>
References:  <CALH631=Z15%2Bhd=Q1Ev=PH2LiEi%2B58Q_FbJPerj5z8ZnuPTCtAw@mail.gmail.com> <aMXFnO8lG-YuB9Hs@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Sep 13, 2025 at 10:27=E2=80=AFPM Konstantin Belousov
<kostikbel@gmail.com> wrote:
>
> On Sat, Sep 13, 2025 at 09:55:52PM +0300, Gleb Popov wrote:
> > This change affects following code inside the Qt library:
> > https://github.com/qt/qtbase/blob/d6cc7562689d8a07bc933178ea367706ca38e=
4ac/src/3rdparty/forkfd/forkfd.c#L902
> >
> > The code in question expects to receive EBADF when being fed a wrong
> > type of the descriptor. Returning EINVAL makes sense to me, so maybe
> > we should patch Qt rather than revert this change?
>
> It is really weird code, calling pdgetpid(2) on random fds.  Anyway, plea=
se
> confirm that the following revert makes the problem go away.

It does!

> BTW, would it be useful to implement something like waitid(P_PROCDESC)
> to eliminate the ugly code you pointed to?

>From what I gather, yes. The pdgetpid() call there is only used to
obtain a PID to pass to wait4. Having  waitid(P_PROCDESC) would save
us from calling pdgetpid()

> commit 4b47521ce2bc4ede52611c268d00ceb1608d959e
> Author: Konstantin Belousov <kib@FreeBSD.org>
> Date:   Sat Sep 13 22:23:27 2025 +0300
>
>     pdgetpid(2): switch back returning EBADF for non-procdesc fd
>
>     This partially reverts fd9e09cb2ab0, since apparently QT depends on t=
his
>     specific error code.  It seems that it applies pdgetpid() to random f=
ds
>     and filters non-procdescs by checking errno for EBADF.
>
>     Reported by:    gleb

That's a different Gleb, my freefall handle is arrowd. But anyways,
the original report came from "Kenneth Raplee
<kenrap@kennethraplee.com>".



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