aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ipc.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix build: correct variable names on stable/10Ed Maste2018-04-041-3/+3
| | | | | | | | | r332032 merged r330356 from HEAD but did not account for a renamed variable (of a different type) between stable/10 and HEAD. Further fix to r332036. Notes: svn path=/stable/10/; revision=332039
* Fix build: use correct variable name on stable/10Ed Maste2018-04-041-1/+1
| | | | | | | | | | r332032 merged r330356 from HEAD but did not account for a renamed variable (of a different type) between stable/10 and HEAD. Reported by: lwhsu Notes: svn path=/stable/10/; revision=332036
* MFC r330356 (eadler): sys/linux: Fix a few potential infoleaks in Linux IPCEd Maste2018-04-041-0/+10
| | | | | | | | | | admbugs: 765, 812, 813, 814 Submitted by: Domagoj Stolfa <domagoj.stolfa@gmail.com> Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> Reported by: Vlad Tsyrklevich Notes: svn path=/stable/10/; revision=332032
* MFC r283416:Dmitry Chagin2016-01-091-10/+0
| | | | | | | | | x86_64 Linux do not use multiplexing on ipc system calls. Move struct ipc_perm definition to the MD path as it differs for 64 and 32 bit platform. Notes: svn path=/stable/10/; revision=293522
* Convert files to UTF-8Ulrich Spörlein2012-01-151-1/+1
| | | | Notes: svn path=/head/; revision=230132
* In order to maximize the re-usability of kernel code in user space thisKip Macy2011-09-161-6/+6
| | | | | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz) Notes: svn path=/head/; revision=225617
* Remove the 'either' from the comment as it'll be less obvious that weBjoern A. Zeeb2011-07-171-4/+4
| | | | | | | | | removed semmap in a bit of time from now. Re-wrap. Suggested by: jhb Notes: svn path=/head/; revision=224123
* Remove semaphore map entry count "semmap" field and its tuningBjoern A. Zeeb2011-07-141-1/+9
| | | | | | | | | | | | | | option that is highly recommended to be adjusted in too much documentation while doing nothing in FreeBSD since r2729 (rev 1.1). ipcs(1) needs to be recompiled as it is accessing _KERNEL private variables. Reviewed by: jhb (before comment change on linux code) Sponsored by: Sandvine Incorporated Notes: svn path=/head/; revision=224016
* Style(9) fixes. No functional changes.Dmitry Chagin2011-03-121-243/+252
| | | | | | | MFC after: 2 Week Notes: svn path=/head/; revision=219558
* Fix typo in kernel message. The fix is based upon the patch in the PR.Alexander Leidinger2009-11-051-1/+1
| | | | | | | | | PR: kern/140279 Submitted by: Alexander Best <alexbestms@math.uni-muenster.de> MFC after: 1 week Notes: svn path=/head/; revision=198945
* Change the ABI of some of the structures used by the SYSV IPC API:John Baldwin2009-06-241-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned short. - The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned short. - The mode member of struct ipc_perm is now mode_t instead of unsigned short (this is merely a style bug). - The rather dubious padding fields for ABI compat with SV/I386 have been removed from struct msqid_ds and struct semid_ds. - The shm_segsz member of struct shmid_ds is now a size_t instead of an int. This removes the need for the shm_bsegsz member in struct shmid_kernel and should allow for complete support of SYSV SHM regions >= 2GB. - The shm_nattch member of struct shmid_ds is now an int instead of a short. - The shm_internal member of struct shmid_ds is now gone. The internal VM object pointer for SHM regions has been moved into struct shmid_kernel. - The existing __semctl(), msgctl(), and shmctl() system call entries are now marked COMPAT7 and new versions of those system calls which support the new ABI are now present. - The new system calls are assigned to the FBSD-1.1 version in libc. The FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls. - A simplistic framework for tagging system calls with compatibility symbol versions has been added to libc. Version tags are added to system calls by adding an appropriate __sym_compat() entry to src/lib/libc/incldue/compat.h. [1] PR: kern/16195 kern/113218 bin/129855 Reviewed by: arch@, rwatson Discussed with: kan, kib [1] Notes: svn path=/head/; revision=194910
* Document that all the other commands are eitherRoman Divacky2008-11-261-0/+16
| | | | | | | | | | | | identical to the FreeBSD ones or rejected by kern_msgctl(). Found with: Coverity Prevent(tm) CID: 3456 Approved by: kib (mentor) Notes: svn path=/head/; revision=185337
* MFp4 (112379):Alexander Leidinger2007-01-141-2/+6
| | | | | | | | | | Implement SETALL/GETALL IPC primitives. This fixes some LTP testcases and LabView is able to proceed a little bit further. Submitted by: rdivacky Notes: svn path=/head/; revision=166008
* MFP4: 110179Jung-uk Kim2006-12-201-3/+41
| | | | | | | | | Add rudimentary IPC_INFO/MSG_INFO command support for linux_msgctl() to pacify Linux ipcs(1). While I am here, add more bound checks for linux_msgsnd() and linux_msgrcv(). Notes: svn path=/head/; revision=165407
* MFP4: (part of) 110058Jung-uk Kim2006-12-201-24/+26
| | | | | | | Use new kern_msgsnd()/kern_msgrcv() to fix linux32 emulation on amd64. Notes: svn path=/head/; revision=165404
* Don't pass unused bufsz to kern_shmctl().John Baldwin2006-10-101-7/+6
| | | | Notes: svn path=/head/; revision=163217
* Only try to copyin a msqid for the IPC_SET command to msgctl(). OtherJohn Baldwin2006-10-101-5/+6
| | | | | | | | | commands (such as IPC_RMID) were bogusly failing with EFAULT. Tested by: jkim Notes: svn path=/head/; revision=163216
* Remove unnecessary casts before PTRIN().John Baldwin2006-10-101-11/+11
| | | | Notes: svn path=/head/; revision=163215
* Rework kern_semctl a bit to always assume the UIO_SYSSPACE case. ThisJohn Baldwin2006-07-081-11/+12
| | | | | | | | | | | | | | | | | | mostly consists of pushing a few copyin's and copyout's up into __semctl() as all the other callers were already doing the UIO_SYSSPACE case. This also changes kern_semctl() to set the return value in a passed in pointer to a register_t rather than td->td_retval[0] directly so that callers can only set td->td_retval[0] if all the various copyout's succeed. As a result of these changes, kern_semctl() no longer does copyin/copyout (except for GETALL/SETALL) so simplify the locking to acquire the semakptr mutex before the MAC check and hold it all the way until the end of the big switch statement. The GETALL/SETALL cases have to temporarily drop it while they do copyin/malloc and copyout. Also, simplify the SETALL case to remove handling for a non-existent race condition. Notes: svn path=/head/; revision=160187
* - Add a kern_semctl() helper function for __semctl(). It accepts a pointerJohn Baldwin2006-06-271-38/+26
| | | | | | | | | | to a copied-in copy of the 'union semun' and a uioseg to indicate which memory space the 'buf' pointer of the union points to. This is then used in linux_semctl() and svr4_sys_semctl() to eliminate use of the stackgap. - Mark linux_ipc() and svr4_sys_semsys() MPSAFE. Notes: svn path=/head/; revision=159991
* Unbreak COMPAT_LINUX32 option support on amd64.Ruslan Ermilov2006-03-191-0/+2
| | | | | | | Broken by: netchild Notes: svn path=/head/; revision=156874
* Fixup some problems in my previous commit (COMPAT_43).Alexander Leidinger2006-03-181-2/+0
| | | | | | | Pointyhat to: netchild Notes: svn path=/head/; revision=156850
* Move MODULE_DEPEND() statements for SYSVIPC dependencies to linux_ipc.cJohn Baldwin2005-07-291-0/+4
| | | | | | | | so that they aren't duplicated 3 times and are also in the same file as the code that depends on the SYSVIPC modules. Notes: svn path=/head/; revision=148540
* Semctl with IPC_STAT command should return zero in case of success.Maxim Sobolev2005-02-111-2/+3
| | | | | | | | | PR: 73778 Submitted by: Andriy Gapon <avg@icyb.net.ua> MFC after: 2 weeks Notes: svn path=/head/; revision=141691
* - Tweak kern_msgctl() to return a copy of the requested message queue idJohn Baldwin2005-02-071-3/+2
| | | | | | | | | | | | | | | | | | | | structure in the struct pointed to by the 3rd argument for IPC_STAT and get rid of the 4th argument. The old way returned a pointer into the kernel array that the calling function would then access afterwards without holding the appropriate locks and doing non-lock-safe things like copyout() with the data anyways. This change removes that unsafeness and resulting race conditions as well as simplifying the interface. - Implement kern_foo wrappers for stat(), lstat(), fstat(), statfs(), fstatfs(), and fhstatfs(). Use these wrappers to cut out a lot of code duplication for freebsd4 and netbsd compatability system calls. - Add a new lookup function kern_alternate_path() that looks up a filename under an alternate prefix and determines which filename should be used. This is basically a more general version of linux_emul_convpath() that can be shared by all the ABIs thus allowing for further reduction of code duplication. Notes: svn path=/head/; revision=141471
* Split out kernel side of msgctl(2) into two parts: the first that pops dataMaxim Sobolev2005-01-261-17/+10
| | | | | | | | | | | from the userland and pushes results back and the second which does actual processing. Use the latter to eliminate stackgap in the linux wrapper of that syscall. MFC after: 2 weeks Notes: svn path=/head/; revision=140839
* Match the LINUX32's style with existing styleDavid E. O'Brien2005-01-141-9/+9
| | | | | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic. Notes: svn path=/head/; revision=140214
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariesTim J. Robbins2004-08-161-34/+56
| | | | | | | | | | | | | | | | | | on AMD64, and the general case where the emulated platform has different size pointers than we use natively: - declare certain structure members as l_uintptr_t and use the new PTRIN and PTROUT macros to convert to and from native pointers. - declare some structures __packed on amd64 when the layout would differ from that used on i386. - include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h> if compiling with COMPAT_LINUX32. This will need to be revisited before 32-bit and 64-bit Linux emulation support can coexist in the same kernel. - other small scattered changes. This should be a no-op on i386 and Alpha. Notes: svn path=/head/; revision=133816
* Back out the following revisions:Max Khon2003-11-051-6/+6
| | | | | | | | | | | | | | | | | | | | | 1.36 +73 -60 src/sys/compat/linux/linux_ipc.c 1.83 +102 -48 src/sys/kern/sysv_shm.c 1.8 +4 -0 src/sys/sys/syscallsubr.h That change was intended to support vmware3, but wantrem parameter is useless because vmware3 uses SYSV shared memory to talk with X server and X server is native application. The patch worked because check for wantrem was not valid (wantrem and SHMSEG_REMOVED was never checked for SHMSEG_ALLOCATED segments). Add kern.ipc.shm_allow_removed (integer, rw) sysctl (default 0) which when set to 1 allows to return removed segments in shm_find_segment_by_shmid() and shm_find_segment_by_shmidx(). MFC after: 1 week Notes: svn path=/head/; revision=122088
* Use __FBSDID().David E. O'Brien2003-06-101-2/+3
| | | | Notes: svn path=/head/; revision=116173
* Change the semantics of sysv shm emulation to take a additionalMartin Blapp2003-05-051-57/+70
| | | | | | | | | | | | | | | | | | | | argument to the functions shm{at,ctl}1 and shm_find_segment_by_shmid{x}. The BSD semantics didn't allow the usage of shared segment after being marked for removal through IPC_RMID. The patch involves the following functions: - shmat - shmctl - shm_find_segment_by_shmid - shm_find_segment_by_shmidx - linux_shmat - linux_shmctl Submitted by: Orlando Bassotto <orlando.bassotto@ieo-research.it> Reviewed by: marcel Notes: svn path=/head/; revision=114724
* Deprecate machine/limits.h in favor of new sys/limits.h.Alexander Kabaev2003-04-291-2/+1
| | | | | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com> Notes: svn path=/head/; revision=114216
* Clean up whitespace and remove register keyword.Dag-Erling Smørgrav2003-03-031-16/+16
| | | | Notes: svn path=/head/; revision=111798
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.Dag-Erling Smørgrav2003-03-031-3/+3
| | | | | | | Also clean up some egregious casts and incorrect use of sizeof. Notes: svn path=/head/; revision=111797
* Add function linux_msg() for regulating output from the linux emulationAlfred Perlstein2003-01-021-3/+2
| | | | | | | | | | | | | | code, make the emulator use it. Rename unsupported_msg() to unimplemented_syscall(). Rename some arguments for clarity Fixup grammar. Requested by: bde Notes: svn path=/head/; revision=108541
* - Add support for IPC_64 extensions into shmctl(2), semctl(2) and msgctl(2);Maxim Sobolev2002-10-111-23/+285
| | | | | | | | | | | | | | | | - add wrappers for mmap2(2) and ftruncate64(2) system calls; - don't spam console with printf's when VFAT_READDIR_BOTH ioctl(2) is invoked; - add support for SOUND_MIXER_READ_STEREODEVS ioctl(2); - make msgctl(IPC_STAT) and IPC_SET actually working by converting from BSD msqid_ds to Linux and vice versa; - properly return EINVAL if semget(2) is called with nsems being negative. Reviewed by: marcel Approved by: marcel Tested with: LSB runtime test Notes: svn path=/head/; revision=104893
* Fix typo in the BSD copyright: s/withough/without/Jens Schweikhardt2002-06-021-1/+1
| | | | | | | | Spotted and suggested by: des MFC after: 3 weeks Notes: svn path=/head/; revision=97748
* In msgrcv(), set msgtyp correctly. Hardwiring 0 as the message typeMarcel Moolenaar2002-05-181-1/+1
| | | | | | | | | | | | | yields incorrect behaviour. The hardwiring was present in the very first commit that implemented msgrcv() (revision 1.4) and hasn't been changed since. The native implementation was complete at that time, so there doesn't seem to be a reason for the hardwiring from a technical point of view. Submitted by: Reinier Bezuidenhout <rbezuide@yahoo.com> Notes: svn path=/head/; revision=96840
* Introduce [IPC|SHM]_[INFO|STAT] to shmctl to makeMichael Reifenberger2001-10-281-3/+52
| | | | | | | `/compat/linux/usr/bin/ipcs -m` happy. Notes: svn path=/head/; revision=85623
* Swap the src and dst arguments of the bcopy added in theMarcel Moolenaar2001-09-281-1/+1
| | | | | | | previous commit. It ain't memcpy... *cough* Notes: svn path=/head/; revision=84067
* The arg parameter is passed by value in Linux, but not in FreeBSD.Marcel Moolenaar2001-09-261-5/+6
| | | | | | | | | | | | We still have to account for a copyin. Make sure the copyin will succeed by passing the FreeBSD syscall a pointer to userspace, albeit one that's automagically mapped into kernel space. Reported by: mr, Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org> Tested by: Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org> Notes: svn path=/head/; revision=83955
* Implement LINUX_[SEM|IPC]_[STAT|INFO]Michael Reifenberger2001-09-151-2/+58
| | | | | | | | | | to make /compat/linux/usr/bin/ipcs -s happy. PR: kern/29698 (part) Reviewed by: audit Notes: svn path=/head/; revision=83501
* KSE Milestone 2Julian Elischer2001-09-121-28/+28
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Round of cleanups and enhancements. These include (in random order):Marcel Moolenaar2001-09-081-126/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Introduce private types for use in linux syscalls for two reasons: 1. establish type independence for ease in porting and, 2. provide a visual queue as to which syscalls have proper prototypes to further cleanup the i386/alpha split. Linuxulator types are prefixed by 'l_'. void and char have not been "virtualized". o Provide dummy functions for all syscalls and remove dummy functions or implementations of truely obsolete syscalls. o Sanitize the shm*, sem* and msg* syscalls. o Make a first attempt to implement the linux_sysctl syscall. At this time it only returns one MIB (KERN_VERSION), but most importantly, it tells us when we need to add additional sysctls :-) o Bump the kenel version up to 2.4.2 (this is not the same as the KERN_VERSION MIB, BTW). o Implement new syscalls, of which most are specific to i386. Our syscall table is now up to date with Linux 2.4.2. Some highlights: - Implement the 32-bit uid_t and gid_t bases syscalls. - Implement a couple of 64-bit file size/offset bases syscalls. o Fix or improve numerous syscalls and prototypes. o Reduce style(9) violations while I'm here. Especially indentation inconsistencies within the same file are addressed. Re-indenting did not obfuscate actual changes to the extend that it could not be combined. NOTE: I spend some time testing these changes and found that if there were regressions, they were not caused by these changes AFAICT. It was observed that installing a RH 7.1 runtime environment did make matters worse. Hangs and/or reboots have been observed with and without these changes, so when it failed to make life better in cases it doesn't look like it made it worse. Notes: svn path=/head/; revision=83221
* Don't auto-generate the syscalls.Marcel Moolenaar2000-12-031-4/+0
| | | | Notes: svn path=/head/; revision=69539
* Revert auto-generation. The Alpha port is broken.Marcel Moolenaar2000-11-101-0/+4
| | | | | | | Syncing with it is wrong. Notes: svn path=/head/; revision=68583
* Sync with Alpha:Marcel Moolenaar2000-11-091-4/+0
| | | | | | | | Do not use sysent.c, proto.h and syscall.h in source tree; use auto-generated versions. Notes: svn path=/head/; revision=68519
* Support for the linux ipc syscalls on the alpha, where each one hasAndrew Gallatin2000-11-011-13/+15
| | | | | | | | its own syscall rather than going through a demux function like linux_ipc() on i386 Notes: svn path=/head/; revision=68214
* The MI/MD split wasn't perfect and the MI files need hacks for theDavid E. O'Brien2000-11-011-0/+4
| | | | | | | | | AlphaLinux compat bits. This will be better cleaned up soon. Agreed to what ever was necessary by: marcel Notes: svn path=/head/; revision=68201
* Update include directives.Marcel Moolenaar2000-08-221-58/+15
| | | | | | | | | | Make the sem*, msg* and shm* function non-static as they are called from MD code. Move linux_ipc to MD code. Notes: svn path=/head/; revision=64906