about summary refs log tree commit diff
path: root/src/string/swab.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-01-08 16:12:47 -0500
committerRich Felker <dalias@aerifal.cx>2014-01-08 16:12:47 -0500
commit289294220f278a291452332da8f45cf756f57fe5 (patch)
tree289eae9f5bda95245159a8ce5e35fb328a0efe12 /src/string/swab.c
parent131871a3d846369fd925d3f8edb692edbad77e4d (diff)
downloadmusl-289294220f278a291452332da8f45cf756f57fe5.tar.gz
musl-289294220f278a291452332da8f45cf756f57fe5.tar.xz
musl-289294220f278a291452332da8f45cf756f57fe5.zip
fix type of semctl variadic argument
per POSIX, the variadic argument has type union semun, which may
contain a pointer or int; the type read depends on the command being
issued. this allows the userspace part of the implementation to be
type-correct without requiring special-casing for different commands.
the kernel always expects to receive the argument interpreted as
unsigned long (or equivalently, a pointer), and does its own handling
of extracting the int portion from the representation, as needed.

this change fixes two possible issues: most immediately, reading the
argument as a (signed) long and passing it to the syscall would
perform incorrect sign-extension of pointers on the upcoming x32
target. the other possible issue is that some archs may use different
(user-space) argument-passing convention for unions, preventing va_arg
from correctly obtaining the argument when the type long (or even
unsigned long or void *) is passed to it.
Diffstat (limited to 'src/string/swab.c')
0 files changed, 0 insertions, 0 deletions