[strace/strace] sysvipc handling is time64-incompatible (#116)

Dmitry V. Levin notifications at github.com
Tue Jan 14 11:29:22 UTC 2020

On Tue, Jan 14, 2020 at 02:55:08AM -0800, arndb wrote:
> > x32: I cannot reproduce it any longer where I used to, maybe something has
> > been fixed in uapi for x32.
> Ok, this is know to have been broken in uapi headers between v4.3 and v4.17.
> See commits f4b4aae18288 ("x86/headers/uapi: Fix __BITS_PER_LONG value
> for x32 builds") and 1a512c0882bd ("x86/ipc: Fix x32 version of shmid64_ds
> and msqid64_ds").


> > sparc:
> > according to struct compat_ipc64_perm defined in
> > arch/sparc/include/asm/compat.h,
> > the type of uid is __compat_uid32_t aka u32,
> > but, according to struct ipc64_perm defined in
> > arch/sparc/include/uapi/asm/ipcbuf.h,
> > the type of uid is __kernel_uid_t which is defined to unsigned short on
> > sparc.
> >
> > I suppose the regression was introduced by commit
> > 83c86984bff2d793c91eb710af7857828b9ddb49 aka v2.6.29-rc1~501^2~6
> >
> > If my guess is correct, then the only working form of IPC_STAT on sparc32
> > since that commit is sparc64 in compat mode.
> Ok, so this would be a bug with what sysvipc on sparc32 does in the kernel,
> rather than a bug of the uapi headers not describing what it does, correct?

Not really, from strace testsuite perspective it looks like tracing of
32-bit processes by 64-bit strace produces wrong results on sparc64 when
strace is built with uapi headers instead of glibc headers, and this
happens because arch/sparc/include/uapi/asm/ipcbuf.h does not describe
the same structure the sparc64 kernel works with in to_compat_ipc64_perm.

So I'd say it's a bug of arch/sparc/include/uapi/asm/ipcbuf.h not
describing what ipc/compat.c actually does.

I've never had access to a sparc32 kernel to check what's going on there,
but ...

> Adding the SPARC list and maintainer to Cc. Yes, I read it the same way.
> In particular, Sam back then wrote
> commit 83c86984bff2d793c91eb710af7857828b9ddb49
> Author: Sam Ravnborg <sam at ravnborg.org>
> Date:   Sun Jan 4 15:44:22 2009 -0800
>     sparc: unify ipcbuf.h
>     The ony difference is the size of the mode.
>     sparc has extra padding to compensate for this.
>     Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
>     Signed-off-by: David S. Miller <davem at davemloft.net>
> However, aside from mode, the other fields that were changed are
> 'uid', 'gid', 'cuid' and 'cgid'. It's been 11 years since that ABI change,
> so I wonder if anyone has started relying on the changed behavior
> in the meantime, or sparc32 users just don't use sysvipc.
> I checked glibc and uclibc-ng, and both use the pre-2009 version
> of the ABI. I also checked the leon-linux patches from
> https://www.gaisler.com/anonftp/linux/linux-2.6/kernel/ to see
> if they had already come across this, but there is no fix either.

... this definitely means users of sparc32 kernel (if any) don't use
IPC_STAT since 2009.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20200114/a26be19d/attachment.html>

More information about the Strace-devel mailing list