Re: [PATCH 08/10] Use __kernel_ulong_t in struct msqid64_ds

From: H. Peter Anvin
Date: Thu May 17 2012 - 19:51:37 EST


On 05/17/2012 03:13 PM, H.J. Lu wrote:
> From: "H.J. Lu" <hjl.tools@xxxxxxxxx>
>
> Replace unsigned long with __kernel_ulong_t in struct msqid64_ds for
> user space. Don't change unsigned long when __BITS_PER_LONG != 64
> since __kernel_ulong_t == unsigned long in this case.
>
> Signed-off-by: H.J. Lu <hjl.tools@xxxxxxxxx>

This patch and the one before it seems to have another problem: we
currently define __BITS_PER_LONG as:

#ifdef __x86_64__
# define __BITS_PER_LONG 64
#else
# define __BITS_PER_LONG 32
#endif

... which means __BITS_PER_LONG == 64 on x86-64. This seems wrong. The
result would seem to be that the padding members around __kernel_time_t
in struct shmid64_ds (not visible in patch 07/10 but existing in the
same structure) work by accident (I also wonder how the heck they're
currently supposed to work on bigendian architectures!!)

However, whereas struct shmid64_ds seems to work okay, this patch would
now seem to be wrong.

The sane thing would seem to be to change __BITS_PER_LONG to 32 on x32
and fix the padding hacks in struct shmid64_ds; H.J., would you agree?

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/