This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 2/9] y2038: asm-generic: extend sysvipc data structures
- From: Geert Uytterhoeven <geert at linux-m68k dot org>
- To: Arnd Bergmann <arnd at arndb dot de>
- Cc: y2038 at lists dot linaro dot org, baolin dot wang at linaro dot org, albert dot aribaud at 3adev dot fr, John Stultz <john dot stultz at linaro dot org>, bamvor dot zhangjian at linaro dot org, ruchandani dot tina at gmail dot com, "linux-api at vger dot kernel dot org" <linux-api at vger dot kernel dot org>, "linux-kernel at vger dot kernel dot org" <linux-kernel at vger dot kernel dot org>, libc-alpha at sourceware dot org, Linux-Arch <linux-arch at vger dot kernel dot org>, Manfred Spraul <manfred at colorfullife dot com>, Michael Kerrisk <mtk dot manpages at gmail dot com>
- Date: Thu, 21 May 2015 10:56:34 +0200
- Subject: Re: [PATCH 2/9] y2038: asm-generic: extend sysvipc data structures
- Authentication-results: sourceware.org; auth=none
- References: <1432134445-804487-1-git-send-email-arnd at arndb dot de> <1432134445-804487-3-git-send-email-arnd at arndb dot de>
Hi Arnd,
On Wed, May 20, 2015 at 5:07 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> --- a/include/uapi/asm-generic/sembuf.h
> +++ b/include/uapi/asm-generic/sembuf.h
> @@ -12,23 +12,29 @@
> * everyone just ended up making identical copies without specific
> * optimizations, so we may just as well all use the same one.
> *
> - * 64 bit architectures typically define a 64 bit __kernel_time_t,
> + * 64 bit architectures use a 64-bit __kernel_time_t here, while
> + * 32 bit architectures have a pair of unsigned long values.
> * so they do not need the first two padding words.
> - * On big-endian systems, the padding is in the wrong place.
> *
> - * Pad space is left for:
> - * - 64-bit time_t to solve y2038 problem
> - * - 2 miscellaneous 32-bit values
> + * On big-endian systems, the padding is in the wrong place for
> + * historic reasons, so user space has to reconstruct a time_t
> + * value using
> + *
> + * user_semid_ds.sem_otime = kernel_semid64_ds.sem_otime +
> + * (long long)(kernel_semid64_ds.sem_otime_high << 32)
The cast to "long long" should be inside the parentheses, to promote the
(32-bit) sem_otime_high to a first 64-bit integer first.
Else it will be shifted into oblivion (oh no, C undefined behavior).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds