[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEivzxfhLC5zSxPUk8PE6jC9s0KbAzD2YzbomY2-skpF-dKMog@mail.gmail.com>
Date: Fri, 1 Sep 2023 23:11:09 +0200
From: Aleksandr Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: hca@...ux.ibm.com, arnd@...db.de, bluca@...ian.org, brauner@...nel.org,
davem@...emloft.net, dsahern@...nel.org, edumazet@...gle.com,
keescook@...omium.org, kuba@...nel.org, ldv@...ace.io, leon@...nel.org,
linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
mzxreary@...inter.de, netdev@...r.kernel.org, pabeni@...hat.com
Subject: Re: [PATCH net-next v7 1/4] scm: add SO_PASSPIDFD and SCM_PIDFD
On Fri, Sep 1, 2023 at 10:56 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> From: Heiko Carstens <hca@...ux.ibm.com>
> Date: Fri, 1 Sep 2023 22:51:45 +0200
> > On Fri, Sep 01, 2023 at 01:33:22PM -0700, Kuniyuki Iwashima wrote:
> > > From: Heiko Carstens <hca@...ux.ibm.com>
> > > Date: Fri, 1 Sep 2023 22:05:17 +0200
> > > > On Thu, Jun 08, 2023 at 10:26:25PM +0200, Alexander Mikhalitsyn wrote:
> > > > > + if ((msg->msg_controllen <= sizeof(struct cmsghdr)) ||
> > > > > + (msg->msg_controllen - sizeof(struct cmsghdr)) < sizeof(int)) {
> > > > > + msg->msg_flags |= MSG_CTRUNC;
> > > > > + return;
> > > > > + }
> > > >
> > > > This does not work for compat tasks since the size of struct cmsghdr (aka
> > > > struct compat_cmsghdr) is differently. If the check from put_cmsg() is
> > > > open-coded here, then also a different check for compat tasks needs to be
> > > > added.
> > > >
> > > > Discovered this because I was wondering why strace compat tests fail; it
> > > > seems because of this.
> > > >
> > > > See https://github.com/strace/strace/blob/master/tests/scm_pidfd.c
> > > >
> > > > For compat tasks recvmsg() returns with msg_flags=MSG_CTRUNC since the
> > > > above code expects a larger buffer than is necessary.
> > >
> > > Can you test this ?
> >
> > Works for me.
> >
> > Tested-by: Heiko Carstens <hca@...ux.ibm.com>
Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@...onical.com>
Thanks for reporting this, Heiko!
My bad.
Kuniyuki,
Thanks for the quick fix.
Kind regards,
Alex
>
> Thanks!
> I'll post a formal patch.
Powered by blists - more mailing lists