This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 01/17] y2038: asm-generic: Extend sysvipc data structures
- From: Arnd Bergmann <arnd at arndb dot de>
- To: "Eric W. Biederman" <ebiederm at xmission dot com>
- Cc: y2038 Mailman List <y2038 at lists dot linaro dot org>, Linux Kernel Mailing List <linux-kernel at vger dot kernel dot org>, Linux API <linux-api at vger dot kernel dot org>, linux-arch <linux-arch at vger dot kernel dot org>, GNU C Library <libc-alpha at sourceware dot org>, Thomas Gleixner <tglx at linutronix dot de>, Deepa Dinamani <deepa dot kernel at gmail dot com>, Al Viro <viro at zeniv dot linux dot org dot uk>, Albert ARIBAUD <albert dot aribaud at 3adev dot fr>, linux-s390 <linux-s390 at vger dot kernel dot org>, Martin Schwidefsky <schwidefsky at de dot ibm dot com>, "the arch/x86 maintainers" <x86 at kernel dot org>, Catalin Marinas <catalin dot marinas at arm dot com>, Will Deacon <will dot deacon at arm dot com>, "open list:RALINK MIPS ARCHITECTURE" <linux-mips at linux-mips dot org>, James Hogan <jhogan at kernel dot org>, Ralf Baechle <ralf at linux-mips dot org>, linuxppc-dev <linuxppc-dev at lists dot ozlabs dot org>, sparclinux <sparclinux at vger dot kernel dot org>
- Date: Thu, 19 Apr 2018 17:20:26 +0200
- Subject: Re: [PATCH v3 01/17] y2038: asm-generic: Extend sysvipc data structures
- References: <20180419143737.606138-1-arnd@arndb.de> <20180419143737.606138-2-arnd@arndb.de> <87efjbnswr.fsf@xmission.com>
On Thu, Apr 19, 2018 at 4:59 PM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> Arnd Bergmann <arnd@arndb.de> writes:
>>
>> struct msqid64_ds {
>> struct ipc64_perm msg_perm;
>> +#if __BITS_PER_LONG == 64
>> __kernel_time_t msg_stime; /* last msgsnd time */
>> -#if __BITS_PER_LONG != 64
>> - unsigned long __unused1;
>> -#endif
>> __kernel_time_t msg_rtime; /* last msgrcv time */
>> -#if __BITS_PER_LONG != 64
>> - unsigned long __unused2;
>> -#endif
>> __kernel_time_t msg_ctime; /* last change time */
>> -#if __BITS_PER_LONG != 64
>> - unsigned long __unused3;
>> +#else
>> + unsigned long msg_stime; /* last msgsnd time */
>> + unsigned long msg_stime_high;
>> + unsigned long msg_rtime; /* last msgrcv time */
>> + unsigned long msg_rtime_high;
>> + unsigned long msg_ctime; /* last change time */
>> + unsigned long msg_ctime_high;
>> #endif
>
> I suspect you want to use __kernel_ulong_t here instead of a raw
> unsigned long. If nothing else it seems inconsistent to use typedefs
> in one half of the structure and no typedefs in the other half.
Good catch, there is definitely something wrong here, but I think using
__kernel_ulong_t for all members would also be wrong, as that
still changes the layout on x32, which effectively is
struct msqid64_ds {
ipc64_perm msg_perm;
u64 msg_stime;
u32 __unused1;
/* 32 bit implict padding */
u64 msg_rtime;
u32 __unused2;
/* 32 bit implict padding */
u64 msg_ctime;
u32 __unused3;
/* 32 bit implict padding */
__kernel_pid_t shm_cpid; /* pid of creator */
__kernel_pid_t shm_lpid; /* pid of last operator */
....
};
The choices here would be to either use a mix of
__kernel_ulong_t and unsigned long, or taking the x32
version back into arch/x86/include/uapi/asm/ so the
generic version at least makes some sense.
I can't use __kernel_time_t for the lower half on 32-bit
since it really should be unsigned.
Arnd