aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_socket.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC 1.62:Gleb Smirnoff2006-01-101-1/+1
| | | | | | | Add \n to log() message. Notes: svn path=/stable/6/; revision=154173
* Add missing locking to linux_connect() so that it can be marked MP safe:John Baldwin2005-07-091-8/+15
| | | | | | | | | | | | - Conditionally grab Giant around the EISCONN hack at the end based on debug.mpsafenet. - Protect access to so_emuldata via SOCK_LOCK. Reviewed by: rwatson Approved by: re (scottl) Notes: svn path=/head/; revision=147853
* Reject packets larger than IP_MAXPACKET in linux_sendto() for socketsDavid Schultz2005-03-231-2/+3
| | | | | | | | | | | | | | with the IP_HDRINCL option set. Without this change, a Linux process with access to a raw socket could cause a kernel panic. Raw sockets must be created by root, and are generally not consigned to untrusted applications; hence, the security implications of this bug are minimal. I believe this only affects 6-CURRENT on or after 2005-01-30. Found by: Coverity Prevent analysis tool Security: Local DOS Notes: svn path=/head/; revision=144012
* Add kernel-only flag MSG_NOSIGNAL to be used in emulation layers to surpressMaxim Sobolev2005-03-081-27/+4
| | | | | | | | | | | SIGPIPE signal for the duration of the sento-family syscalls. Use it to replace previously added hack in Linux layer based on temporarily setting SO_NOSIGPIPE flag. Suggested by: alfred Notes: svn path=/head/; revision=143295
* Handle MSG_NOSIGNAL flag in linux_send() by setting SO_NOSIGPIPE on socketMaxim Sobolev2005-03-071-2/+25
| | | | | | | | | | | | | | | | | for the duration of the send() call. Such approach may be less than ideal in threading environment, when several threads share the same socket and it might happen that several of them are calling linux_send() at the same time with and without SO_NOSIGPIPE set. However, such race condition is very unlikely in practice, therefore this change provides practical improvement compared to the previous behaviour. PR: kern/76426 Submitted by: Steven Hartland <killing@multiplay.co.uk> MFC after: 3 days Notes: svn path=/head/; revision=143233
* Extend kern_sendit() to take another enum uio_seg argument, which specifiesMaxim Sobolev2005-01-301-24/+20
| | | | | | | | | | where the buffer to send lies and use it to eliminate yet another stackgap in linuxlator. MFC after: 2 weeks Notes: svn path=/head/; revision=141029
* Match the LINUX32's style with existing styleDavid E. O'Brien2005-01-141-4/+4
| | | | | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic. Notes: svn path=/head/; revision=140214
* Fix the ABI wrappers to use kern_fcntl() rather than calling fcntl()John Baldwin2004-08-241-11/+4
| | | | | | | | | | | directly. This removes a few more users of the stackgap and also marks the syscalls using these wrappers MP safe where appropriate. Tested on: i386 with linux acroread5 Compiled on: i386, alpha LINT Notes: svn path=/head/; revision=134266
* Don't try to translate the control message unless we're certain it'sDag-Erling Smørgrav2004-08-231-1/+2
| | | | | | | | | | | valid; otherwise a caller could trick us into changing any 32-bit word in kernel memory to LINUX_SOL_SOCKET (0x00000001) if its previous value is SOL_SOCKET (0x0000ffff). MFC after: 3 days Notes: svn path=/head/; revision=134209
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariesTim J. Robbins2004-08-161-51/+67
| | | | | | | | | | | | | | | | | | 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
* I missed two pieces of the commit to this file. Robert has alreadyDavid Malone2004-07-181-1/+1
| | | | | | | added one, this adds the other. Notes: svn path=/head/; revision=132347
* Remove 'sg' argument to linux_sendto_hdrincl, which is what I think wasRobert Watson2004-07-181-1/+1
| | | | | | | intended. This fixes the build, but might require revision. Notes: svn path=/head/; revision=132331
* Add a kern_setsockopt and kern_getsockopt which can read the optionDavid Malone2004-07-171-65/+19
| | | | | | | | | values from either user land or from the kernel. Use them for [gs]etsockopt and to clean up some calls to [gs]etsockopt in the Linux emulation code that uses the stackgap. Notes: svn path=/head/; revision=132313
* Clean up and wash struct iovec and struct uio handling.Poul-Henning Kamp2004-07-101-20/+7
| | | | | | | | | | | | | | | Add copyiniov() which copies a struct iovec array in from userland into a malloc'ed struct iovec. Caller frees. Change uiofromiov() to malloc the uio (caller frees) and name it copyinuio() which is more appropriate. Add cloneuio() which returns a malloc'ed copy. Caller frees. Use them throughout. Notes: svn path=/head/; revision=131897
* Use a couple of regular kernel entry points, rather than COMPAT_43Poul-Henning Kamp2004-07-081-4/+12
| | | | | | | entry points. Notes: svn path=/head/; revision=131796
* Quick fix for LINT breakage caused by interface changes in accept(2), etc.Bruce Evans2003-12-251-33/+36
| | | | | | | | | | | | | | | | | | | | | | The log message for rev.1.160 of kern/uipc_syscalls.c and associated changes only claimed to add restrict qualifiers (which have no effect in the kernel so they probably shouldn't be added), but the following interface changes were also made: - caddr_t to `void *' and `struct sockaddr_t *' - `int *' to `socklen_t *'. These interface changes are not quite null, and this fix is quick (like the changes in uipc_syscalls 1.160) because it uses bogus casts instead of complete bounds-checked conversions. Things should be fixed better when the conversions can be done without using the stack gap. linux_check_hdrincl() already uses the stack gap and is fixed completely though the type mismatches in it were not fatal (there were only fatal type mismatches from unopaquing pointers to [o]sockaddr't's -- the difference between accept()'s args and oaccept()'s args is now non-opaque, but this is not reflected in their args structs). Notes: svn path=/head/; revision=123828
* Use kern_sendit rather than sendit for the Linux send* syscalls.David Malone2003-11-091-144/+105
| | | | | | | | This means we can avoid using the stack gap for most send* syscalls now (it is still used in the IP_HDRINCL case). Notes: svn path=/head/; revision=122358
* Fix some problems in linux_sendmsg() and linux_recvmsg().Mitsuru IWASAKI2003-10-111-36/+38
| | | | | | | | | | | | | | - Allocate storage for uap->msg always because it is copyin()'ed in native sendmsg(). - Convert sockopt level from Linux to FreeBSD after native recvmsg() calling. - Some cleanups. Tested with: Oracle 9i shared server connection mode. MFC after: 1 week Notes: svn path=/head/; revision=121008
* Use __FBSDID().David E. O'Brien2003-06-101-2/+3
| | | | Notes: svn path=/head/; revision=116173
* 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-2/+2
| | | | 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-4/+4
| | | | | | | Also clean up some egregious casts and incorrect use of sizeof. Notes: svn path=/head/; revision=111797
* Add M_WAITOKHajimu UMEMOTO2003-02-201-1/+1
| | | | Notes: svn path=/head/; revision=111173
* 1) Linux_sendto was trashing the BSD sockaddr it put in the stackgap,David Malone2003-02-081-14/+15
| | | | | | | | | | | | | | | | | | so be more careful about calling stackgap_init. Tested by: Fred Souza <fred@storming.org> 2) Linux_sendmsg was forgetting to fill out the bsd_args struct. Reviewed by: ume 3) The args to linux_connect have differently named types on alpha and i386, so add a cast to stop gcc complaining. Spotted by: peter Notes: svn path=/head/; revision=110538
* Avoid undefined symbol error with an IPv4 only kernel.Hajimu UMEMOTO2003-02-051-1/+9
| | | | | | | Reported by: "Sergey A. Osokin" <osa@freebsd.org.ru> Notes: svn path=/head/; revision=110376
* Add IPv6 support for Linuxlator.Hajimu UMEMOTO2003-02-031-88/+372
| | | | | | | | Reviewed by: dwmalone MFC after: 10 days Notes: svn path=/head/; revision=110295
* Back out last commit. Linux uses the old 4.3BSD sockaddr format.Jonathan Mini2002-09-241-19/+11
| | | | Notes: svn path=/head/; revision=103886
* Don't use compatability syscall wrappers in emulation code.Jonathan Mini2002-09-231-11/+19
| | | | | | | | | This is needed for the COMPAT_FREEBSD3 option split. Reviewed by: alfred, jake Notes: svn path=/head/; revision=103839
* 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
* Fix missing holdsock()->fgetsock()Matthew Dillon2001-11-171-7/+5
| | | | | | | Submitted by: Hisashi Hiramoto <hiramoto@phys.chs.nihon-u.ac.jp> Notes: svn path=/head/; revision=86504
* Force the length of the sockaddr to be correct for AF_INET and AF_INET6Bill Fenner2001-10-261-2/+23
| | | | | | | | | in bind() and connect(). Linux doesn't care if the length of the sockaddr matches its address family; FreeBSD does. This fixes the known issues with the resolver in linux_base-7. Notes: svn path=/head/; revision=85569
* KSE Milestone 2Julian Elischer2001-09-121-65/+65
| | | | | | | | | | | | | | | | | 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-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Only pick up so_error the first time through with EISCONN, as advertised.Jonathan Lemon2001-03-021-1/+1
| | | | | | | | | The sense of the test was reversed, so we were returning EISCONN, then 0. Pointed out and tested by: Martin Blapp <mb@imp.ch> Notes: svn path=/head/; revision=73353
* Correctly emulate linux_connect. For nonblocking sockets, the behaviorJonathan Lemon2001-03-011-51/+21
| | | | | | | | | | | is to return EINPROGRESS, EALREADY, (so_error ONCE), EISCONN. Certain linux applications rely on the so_error (normally 0) being returned in order to operate properly. Tested by: Thomas Moestl <tmoestl@gmx.net> Notes: svn path=/head/; revision=73288
* translate the flags in recvfrom and recvmsg from linux to bsd onesAssar Westerlund2000-12-191-2/+69
| | | | | | | Approved by: marcel Notes: svn path=/head/; revision=70178
* Don't auto-generate the syscalls.Marcel Moolenaar2000-12-031-4/+0
| | | | Notes: svn path=/head/; revision=69539
* Use the linux_connect() on alpha rather than passing directly throughAndrew Gallatin2000-11-161-1/+9
| | | | | | | | | | | | | to our native connect(). This is required to deal with the differences in the way linux handles connects on non-blocking sockets. This gets the private beta of the Compaq Linux/alpha JDK working on FreeBSD/alpha Approved by: marcel Notes: svn path=/head/; revision=68803
* 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
* The MI/MD split wasn't perfect and the MI files need hacks for theDavid E. O'Brien2000-11-011-0/+6
| | | | | | | | | AlphaLinux compat bits. This will be better cleaned up soon. Agreed to what ever was necessary by: marcel Notes: svn path=/head/; revision=68201
* Whitespace change: (near) KNFMarcel Moolenaar2000-08-261-649/+679
| | | | Notes: svn path=/head/; revision=65108
* Update include directives.Marcel Moolenaar2000-08-221-3/+3
| | | | Notes: svn path=/head/; revision=64913
* Fix accept(2) behavior in that accepted sockets don't inherit theMarcel Moolenaar2000-02-281-1/+20
| | | | | | | | | | | | | | | parents flags. Note on the PR: The PR contains another patch that's not being committed without further background information. The PR stays open for now. PR: 16946 (Victor A. Salaman <salaman@teknos.com>) Prompted by: msmith Indirect/implicit approval: jkh (shoot me if I'm wrong :-) Notes: svn path=/head/; revision=57564
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Fix linux sendmsg() emulationMike Smith1999-01-111-2/+35
| | | | | | | Submitted by: Brian Feldman <green@unixhelp.org> Notes: svn path=/head/; revision=42509
* Commit patch inSøren Schmidt1998-12-301-1/+6
| | | | | | | | PR: 9232 Submitted by: marcel@scc.nl <Marcel Moolenaar> Notes: svn path=/head/; revision=42186
* Moved some #includes from <sys/param.h> nearer to where they are actuallyBruce Evans1998-03-281-1/+2
| | | | | | | used. Notes: svn path=/head/; revision=34924
* In the words of the submitter:Mike Smith1998-02-071-2/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | ---- I've worked to enhance the connect() patches. I've just tested this with the Linux JDK appletviewer on an applet that does a lot of connects, and it works as well as during my previous tests. The connect() patch is now a merge between my older patch and the OpenBSD stuff. It ensures that any async error is returned by connect() instead of getsockopt(SOL_SOCKET, SO_ERROR) as reasonnable systems do. There are also minor patches to implement IPPROTO_TCP for get/setsocktopt(). These are also tested (with Linux Apache). ---- I would appreciate any feedback regarding these changes, as they'd be very useful in 2.2.6. Submitted by: pb@fasterix.freenix.org (Pierre Beyssac) Notes: svn path=/head/; revision=33148
* Make COMPAT_43 and COMPAT_SUNOS new-style options.Eivind Eklund1997-12-161-2/+6
| | | | Notes: svn path=/head/; revision=31778