[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230901205145.10640-A-hca@linux.ibm.com>
Date: Fri, 1 Sep 2023 22:51:45 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: aleksandr.mikhalitsyn@...onical.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 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>
Powered by blists - more mailing lists