ipc.h struct layout fix

Bernd Schmidt bernds at codesourcery.com
Sat Jul 9 22:38:54 UTC 2011


On 07/09/11 21:14, Mike Frysinger wrote:
> On Thursday, July 07, 2011 08:04:37 Bernd Schmidt wrote:
>> This fixes a problem identified by Mark Salter on C6X big-endian
>> systems. We should not use "unsigned short int mode"; the proper type is
>> in theory mode_t, but here we need to use kernel_mode_t since this
>> structure is used for communication with the kernel, and some targets
>> have a 16-bit kernel_mode_t and 32-bit mode_t.
> 
> my concern here would be for big endian arches where kernel_mode_t is not a 
> short.  i think that would break the ABI for them if they're using the common 
> ipc.h ?

I think they wouldn't work correctly at the moment due to the same type
mismatch problem. So an ABI change isn't really the problem since it's a
bug fix. Besides, I don't think there are such targets (other than C6X).
See below.

>> Please also compare linux-2.6/include/asm-generic/ipcbuf.h, which uses
>> the same definition for mode/pad1 as the one introduced by the patch.
> 
> right, but many of the ports predate the asm-generic code :).

Are they then likely to use linux/common/bits/ipc.h?

Here's a list of ports which define mode_t as something that isn't
unsigned short:

libc/sysdeps/linux/mips/bits/kernel_types.h:13:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/alpha/bits/kernel_types.h:12:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/x86_64/bits/kernel_types.h:21:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/ia64/bits/kernel_types.h:22:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/sparc/bits/kernel_types.h:24:typedef unsigned int
       __kernel_mode_t;
libc/sysdeps/linux/c6x/bits/kernel_types.h:12:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/powerpc/bits/kernel_types.h:17:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/v850/bits/kernel_types.h:20:typedef unsigned int
__kernel_mode_t;
libc/sysdeps/linux/xtensa/bits/kernel_types.h:11:typedef unsigned int
__kernel_mode_t;

And a list of ports that have a bits/ipc.h file:

-rw-r--r-- 1 bernds users 2130 Mar  9 15:40
libc/sysdeps/linux/alpha/bits/ipc.h
-rw-r--r-- 1 bernds users 2305 Mar  9 15:40
libc/sysdeps/linux/hppa/bits/ipc.h
-rw-r--r-- 1 bernds users 2107 Mar  9 15:40
libc/sysdeps/linux/ia64/bits/ipc.h
-rw-r--r-- 1 bernds users 2123 Mar  9 15:40
libc/sysdeps/linux/mips/bits/ipc.h
-rw-r--r-- 1 bernds users 2225 Mar  9 15:40
libc/sysdeps/linux/powerpc/bits/ipc.h
-rw-r--r-- 1 bernds users 2280 Mar  9 15:40
libc/sysdeps/linux/sparc/bits/ipc.h
-rw-r--r-- 1 bernds users 2050 Mar  9 15:40
libc/sysdeps/linux/vax/bits/ipc.h
-rw-r--r-- 1 bernds users 2074 Mar  9 15:40
libc/sysdeps/linux/xtensa/bits/ipc.h

So, the list of those that have an int kernel_mode_t and use
common/bits/ipc.h is x86_64 and v850. v850 has "select
ARCH_LITTLE_ENDIAN" and x86_64 is known to be LE as well.

So, how to proceed?


Bernd


More information about the uClibc mailing list