]> granicus.if.org Git - musl/commit
work around broken kernel struct ipc_perm on some big endian archs
authorRich Felker <dalias@aerifal.cx>
Wed, 20 Jun 2018 04:07:09 +0000 (00:07 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 20 Jun 2018 04:07:09 +0000 (00:07 -0400)
commit0cd2be231481d68d244662bde25ad9cadbd7221d
tree586cb81d3f4ffae60276626b8a9b5a1b3ef59a34
parent7ea235b1be38c57c49b164c9762cf90be02dbc05
work around broken kernel struct ipc_perm on some big endian archs

the mode member of struct ipc_perm is specified by POSIX to have type
mode_t, which is uniformly defined as unsigned int. however, Linux
defines it with type __kernel_mode_t, and defines __kernel_mode_t as
unsigned short on some archs. since there is a subsequent padding
field, treating it as a 32-bit unsigned int works on little endian
archs, but the order is backwards on big endian archs with the
erroneous definition.

since multiple archs are affected, remedy the situation with fixup
code in the affected functions (shmctl, semctl, and msgctl) rather
than repeating the same shims in syscall_arch.h for every affected
arch.
arch/arm/syscall_arch.h
arch/m68k/syscall_arch.h
arch/microblaze/syscall_arch.h
arch/sh/syscall_arch.h
src/ipc/msgctl.c
src/ipc/semctl.c
src/ipc/shmctl.c