summaryrefslogtreecommitdiff
path: root/src/ipc/semctl.c
AgeCommit message (Collapse)AuthorLines
2019-07-01ipc: prefer SYS_ipc when it is definedSzabolcs Nagy-1/+1
Linux v5.1 introduced ipc syscalls on targets where previously only SYS_ipc was available, change the logic such that the ipc code keeps using SYS_ipc which works backward compatibly on older kernels. This changes behaviour on microblaze which had both mechanisms, now SYS_ipc will be used instead of separate syscalls.
2018-06-20work around broken kernel struct ipc_perm on some big endian archsRich Felker-2/+24
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.
2014-03-13semctl: fix UB causing crashes on powerpcrofl0r-4/+8
it's UB to fetch variadic args when none are passed, and this caused real crashes on ppc due to its calling convention, which defines that for variadic functions aggregate types be passed as pointers. the assignment caused that pointer to get dereferenced, resulting in a crash.
2014-01-08fix inadvertent use of struct in place of union for semunRich Felker-3/+3
2014-01-08fix type of semctl variadic argumentRich Felker-4/+10
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.
2012-09-22fix IPC_64 in msgctl tooRich Felker-4/+0
2012-09-22fix broken semctl on systems that don't use IPC_64 flagRich Felker-2/+6
not tested on mips and arm; they may still be broken. x86_64 should be ok now.
2011-04-13numerous fixes to sysv ipcRich Felker-1/+1
some of these definitions were just plain wrong, others based on outdated ancient "non-64" versions of the kernel interface. as much as possible has now been moved out of bits/* these changes break abi (the old abi for these functions was wrong), but since they were not working anyway it can hardly matter.
2011-04-06consistency: change all remaining syscalls to use SYS_ rather than __NR_ prefixRich Felker-1/+1
2011-03-20global cleanup to use the new syscall interfaceRich Felker-2/+2
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+18