unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Stepan Golosunov <stepan@golosunov.pp.ru>
Cc: Joseph Myers <joseph@codesourcery.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	 Thomas Gleixner <tglx@linutronix.de>
Subject: Re: Update kernel-features.h files for Linux 5.1
Date: Thu, 16 May 2019 22:56:20 +0200	[thread overview]
Message-ID: <CAK8P3a2Yp0Nv9QnRK-FgTVcFHh5jKVnNPDHy76-Lvt=HZTMjTg@mail.gmail.com> (raw)
In-Reply-To: <20190516194147.b662wrsv4jco3wt6@sghpc.golosunov.pp.ru>

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

  reply	other threads:[~2019-05-16 20:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-09 23:00 Update kernel-features.h files for Linux 5.1 Joseph Myers
2019-05-10 10:27 ` Stepan Golosunov
2019-05-10 13:19   ` Stepan Golosunov
2019-05-16  7:59     ` Arnd Bergmann
2019-05-16 19:41       ` Stepan Golosunov
2019-05-16 20:56         ` Arnd Bergmann [this message]
2019-05-10 15:07   ` Adhemerval Zanella
2019-05-10 15:11     ` Adhemerval Zanella
2019-05-10 16:15       ` Stepan Golosunov
2019-05-10 16:40         ` Adhemerval Zanella
2019-05-16  8:08     ` Arnd Bergmann
2019-05-16 11:15       ` Adhemerval Zanella
2019-05-16 11:34         ` Arnd Bergmann
2019-05-16 12:28           ` Adhemerval Zanella
2019-05-16 12:42             ` Arnd Bergmann
2019-05-13 21:33   ` Joseph Myers
2019-05-16 15:06     ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a2Yp0Nv9QnRK-FgTVcFHh5jKVnNPDHy76-Lvt=HZTMjTg@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=stepan@golosunov.pp.ru \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).