mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: y2038@lists.linaro.org
Cc: Thorsten Glaser <tg@mirbsd.de>,
	klibc@zytor.com, libc-alpha@sourceware.org,
	linux-api@vger.kernel.org, musl@lists.openwall.com,
	linux-kernel@vger.kernel.org, Rich Felker <dalias@libc.org>,
	cferris@google.com, enh@google.com,
	"Joseph S. Myers" <joseph@codesourcery.com>
Subject: Re: [Y2038] [klibc] kernel/libc uapi changes for y2038
Date: Mon, 18 May 2015 15:32:12 +0200	[thread overview]
Message-ID: <10173485.f8yUt0lQ60@wuerfel> (raw)
In-Reply-To: <Pine.BSM.4.64L.1505181214530.8249@herc.mirbsd.org>

On Monday 18 May 2015 12:16:48 Thorsten Glaser wrote:
> Arnd Bergmann dixit:
> 
> >In the patch series I posted recently [1], I introduce new system calls to deal
> >with modified data structures, but left the question open on how these should
> >be best accessed from libc. The patches introduce a new __kernel_time64_t type
> 
> Can we please have ioctls fixed for mixed 32/64-bit systems
> such as MIPS (o32/n32/n64) and x86 (i386/x32/amd64) first,
> before even more such chance for breakage is introduced?

It's hard because we don't even know what ioctls are affected at this point,
and I was hoping to get this part merged as a stepping stone in the process
of finding out.

The problem is that there are so many different cases we have to worry
about just for time_t:

a) ioctls that pass a data structure from include/uapi/ with time_t and
   have a properly defined (using _IOW()/_IOR()/_IORW()) command number:
   these are easy enough to find and fix.

b) ioctls that have a data structure as before but define their ioctl
   commands differently (e.g. using a literal number). I don't think
   we can fix them before we introduce the __KERNEL_TIME_BITS macro
   from my patch, because user space needs to see a different command
   number here, and we have a lot of these.

c) ioctls that are defined ad-hoc, without any uapi header containing
   the structure, but using a proper _IOW()/_IOR()/_IORW() macro.
   These are much harder to find than a), but just as easy to fix

d) ioctls that are defined ad-hoc based on a time_t value and with
   a wrong command number.
   These will be broken no matter what we do, and our only hope is
   to find all applications using them so we can fix the user space
   sources.

e) ioctls that pass a time value as a 'long' or '__u32' instead of
   'time_t'. Fixing them requires adding new ioctl commands to let
   them work beyond 2038, independent of what we do here.

f) ioctls that use structures with pointers to other structures that
   are not defined in the uapi headers. (this might not be a problem,
   I haven't been able to figure out of these are real)

All of the above are currently broken for x32, but fixing them will
likely take a few years and leave x32 still broken because of other
uses of __kernel_long_t in ioctl.

MIPS on the other hand is no more broken than any of the other 32-bit
ABIs, because it does not use 64-bit __kernel_long_t in its n32 ABI.
 
> I still need to use an amd64 chroot on my x32 system to do
> things such as set up iptables, because those ioctls break,
> because they contain data structures that contain, well,
> time types. Your proposal has a non-zero chance to bring
> these issues to i386 (and other architectures).

We should indeed not start widely deploying user space with 64-bit time_t
on 32-bit architectures until we found and fixed a good part of the
ioctls. My plan at this point is to eliminate all uses of time_t in
the kernel and replace them with time64_t or other safe types.
This way, we will eventually find all code that passes 32-bit time types
to user space and can fix it. This will take care of the time_t
related problems on x32 as well.

	Arnd


  reply	other threads:[~2015-05-18 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18  9:53 Arnd Bergmann
2015-05-18 12:16 ` [klibc] " Thorsten Glaser
2015-05-18 13:32   ` Arnd Bergmann [this message]
2015-05-18 17:03     ` Thorsten Glaser
2015-05-18 20:35       ` Arnd Bergmann
2015-05-19 17:54 ` [Y2038] " John Stultz
2015-05-27 15:28 ` [klibc] " H. Peter Anvin
     [not found]   ` <5565E2AC.3070306-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>
2015-05-27 20:19     ` Arnd Bergmann

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

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

  git send-email \
    --in-reply-to=10173485.f8yUt0lQ60@wuerfel \
    --to=arnd@arndb.de \
    --cc=cferris@google.com \
    --cc=dalias@libc.org \
    --cc=enh@google.com \
    --cc=joseph@codesourcery.com \
    --cc=klibc@zytor.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=musl@lists.openwall.com \
    --cc=tg@mirbsd.de \
    --cc=y2038@lists.linaro.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).