This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Update kernel-features.h files for Linux 5.1


On Thu, May 16, 2019 at 9:41 PM Stepan Golosunov <stepan@golosunov.pp.ru> wrote:
>
> 16.05.2019 в 09:59:40 +0200 Arnd Bergmann написал:
> > On Fri, May 10, 2019 at 3:19 PM Stepan Golosunov <stepan@golosunov.pp.ru> wrote:
> > > > (I also think that ipc with IPCOP_semtimedop was accidentally made to
> > > > behave like semtimedop_time64 in 32-bit builds of linux 5.1.  But that
> > > > would be a kernel bug.)
> >
> > Can you elaborate? The code I see in mainline is
> >
> >         case SEMTIMEDOP:
> >                 if (IS_ENABLED(CONFIG_64BIT) || !IS_ENABLED(CONFIG_64BIT_TIME))
> >                         return ksys_semtimedop(first, ptr, second,
> >                                 (const struct __kernel_timespec __user *)fifth);
> >                 else if (IS_ENABLED(CONFIG_COMPAT_32BIT_TIME))
> >                         return compat_ksys_semtimedop(first, ptr, second,
> >                                 (const struct old_timespec32 __user *)fifth);
> >                 else
> >                         return -ENOSYS;
> >
> > Since both CONFIG_64BIT_TIME and CONFIG_COMPAT_32BIT_TIME
> > are always set on 32-bit architectures, SEMTIMEDOP passes
> > an old_timespec32 argument here. Am I missing something?
>
> If CONFIG_64BIT_TIME is set then there is no problem.  But I do not
> see where it is set.  (The patch to set it to y was merged only now
> and is not in 5.1.)  And if it's not set, then ipc and socketcall are
> broken.

Oh, I see it now. So the bug was actually much worse than I thought, since
we did not enable CONFIG_64BIT_TIME at all, only
CONFIG_COMPAT_32BIT_TIME. I assumed that only the nanosecond
mangling in compat mode was broken.

The problem is that in commit 00bf25d693e7 ("y2038: use time32 syscall
names on 32-bit"), I turned on CONFIG_COMPAT_32BIT_TIME
unconditionally, when I should have turned on CONFIG_64BIT_TIME
or ARCH_HAS_64BIT_TIME instead.

So indeed both ipc(SEMTIMEDOP, ...) and socketcall(SYS_RECVMMSG, ...)
are broken in linux-5.1 with 32-bit architectures. My testing failed to
catch those because I used a musl libc as a base that was already using
semtimedop() and recvmmsg() as direct syscalls, and those are not
affected.

The fix has made it into mainline now for v5.2-rc1, but not yet v5.1.y.

Greg, can you add this commit for the next v5.1.y stable kernel to
fix the regression?

f3d964673b2f ("y2038: Make CONFIG_64BIT_TIME unconditional")

      Arnd


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]