summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_misc.c
Commit message (Collapse)AuthorAgeFilesLines
* Partial MFp4 of 114977:netchild2007-02-241-5/+4
| | | | | | Whitespace commit: Fix grammar, spelling and punctuation. Submitted by: "Scot Hetzel" <swhetzel@gmail.com>
* MFp4 (114193 (i386 part), 114194, 114195, 114200):netchild2007-02-231-3/+5
| | | | | | | | | | | | | - Dont "return" in linux_clone() after we forked the new process in a case of problems. - Move the copyout of p2->p_pid outside the emul_lock coverage in linux_clone(). - Cache the em->pdeath_signal in a local variable and move the copyout out of the emul_lock coverage. - Move the free() out of the emul_shared_lock coverage in a preparation to switch emul_lock to non-sleepable lock (mutex). Submitted by: rdivacky
* No need to lock emul_lock in exit_group() because em->sharedkib2007-02-011-3/+2
| | | | | | | | | cannot change (because its referenced by curthread). This fixes a LOR caused by acquiring emul_shared_lock while holding emul_lock. Fix typo in comment. Submitted by: rdivacky
* MFp4 (112646):netchild2007-01-071-1/+1
| | | | | | | | | Now (ok it's been a while...) that FreeBSD has RLIMIT_AS too, we can use it in the linuxolator instead of ignoring it. This fixes a LTP test. Submitted by: rdivacky
* MFp4 (112534):netchild2007-01-071-4/+2
| | | | | | | | | Dont lock em in a case of just using em->shared->group_pid because the group_pid never changes. Submitted by: rdivacky Reviewed by: kib Glanced at by: jhb
* MFp4 (112498):netchild2007-01-071-6/+6
| | | | | | Rename the locking flags to EMUL_DOLOCK and EMUL_DONTLOCK to prevent confusion. Submitted by: rdivacky
* MFp4 (111746, 108671, 108945, 112352):netchild2006-12-311-0/+32
| | | | | | | | | - add linux utimes syscall [1] - add linux rt_sigtimedwait syscall [2] Submitted by: "Scot Hetzel" <swhetzel@gmail.com> [1] Submitted by: Bruce Becker <hostmaster@whois.gts.net> [2] PR: 93199 [2]
* MFp4 (111746+):netchild2006-12-311-9/+3
| | | | | | | | | | | | | | Redo the checking for 2.6 emulation. We now cache the value of use26 and replace calls to linux_get_osrelease() + parsing with a call to linux_use26(). Typical path is lockless now. Pointed out by: kib This allows to ship RELENG_7_0 with a default osrelease of 2.4.2 and the possibility to enable 2.6.x emulation without the possible performance impact of the previous version of the check. Submitted by: rdivacky
* MFp4:netchild2006-12-311-59/+65
| | | | | | - semi-automatic style fixes - spelling fixes in comments - add some comments
* MFP4: 109653jkim2006-12-041-2/+25
| | | | | Linux mknod(2) can open any files, not just char/block or fifo files. This fixes Linux Test Project test cases mknod01, mknod07 and mknod09.
* MFP4 (108673, 110519, 110874):netchild2006-12-021-5/+30
| | | | | | | | | | | | | | - Currently LINUX_MAX_COMM_LEN is smaller than MAXCOMLEN, but in case this will change we have a buffer overflow. Apply some defensive programming to DTRT when this should happen. - Use copyinstr() instead of copyin where appropriate. * Fallback to copyin() in case of ENAMETOOLONG. [1] * Use the right source and destination (it was wrong before). - Use strlcpy instead of strcpy. - Properly lock the read case (PR_GET_NAME) like the write case. Reviewed by: rwatson (except [1]) Suggested by: rwatson [1]
* Sync struct sysinfo with real one from linux.kib2006-11-181-1/+2
| | | | Submitted by: rdivacky
* Add debuging printfs to syscalls that do not contain it yet. Inkib2006-11-181-0/+36
| | | | | | | sethostname do not print the hostname because it would require to copyin the string. Sethostname is not very frequently used. Submitted by: rdivacky
* Remove unecessary locking of process in linux_getpid.kib2006-11-181-2/+0
| | | | | Suggested by: jhb Submitted by: rdivacky
* In rev 1.188 of linux_misc.c the added check for valid options ommitedkib2006-11-151-1/+1
| | | | | | | | __WCLONE. This fixes it thus fixing skype/teamspeak to not keep zombies after exit. Submitted by: rdivacky Reported by: Bakul Shah (bakul at bitblocks com)
* Merge posix4/* into normal kernel hierarchy.trhodes2006-11-111-2/+1
| | | | | Reviewed by: glanced at by jhb Approved by: silence on -arch@ and -standards@
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-2/+4
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Fix style(9).netchild2006-10-281-29/+29
| | | | Noticed by: rwatson
* MFP4:netchild2006-10-281-0/+51
| | | | | | | Implement prctl(). Submitted by: rdivacky Tested with: LTP
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-221-1/+2
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* - Replace homegrown check for FIFO with S_ISFIFO. [1]netchild2006-10-081-1/+7
| | | | | | | | - Check the status of the options before messing with it. Inspired by: NetBSD [1] Submitted by: rdivacky Tested with: LTP
* - don't reboot() when feed with wrong parameters (and enough permissions) [1]netchild2006-09-161-4/+38
| | | | | | | | | | | - add support to power off the system [2] - check the linux magic values [3] Submitted by: Marcin Cieslak <saper@SYSTEM.PL> [1,2] Modelled after: linux man page of the reboot() syscall [3] Found by: LTP testcase "reboot02" [1] Tested with: LTP testcase "reboot02" [1,3] MFC after: 1 week
* Don't call suser_cred() directly from linux_sethostname(), as it justrwatson2006-08-251-3/+0
| | | | | | | wraps userland_sysctl(), which performs necessary privilege checks as part of its normal operation. MFC after: 1 week
* Sync the MI parts for amd64 with i386 and remove the corresponding specialnetchild2006-08-201-13/+1
| | | | | | | | | handling for amd64 in the common code. The MD parts for amd64 are still outstanding, but at least this fixes some panics on amd64. Sponsored by: Google SoC 2006 Submitted by: rdivacky Tested by: bsam
* - disable some more code when osrelease=2.4.2netchild2006-08-171-22/+46
| | | | | | | | | - protect td->td_proc->p_pid with the proc lock in linux_getpid in the amd64 (= non i386) case [1] Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: netchild [1]
* Move some stuff into headers where they belong.netchild2006-08-171-3/+0
| | | | | | Sponsored by: Google SoC 2006 Submitted by: rdivacky Noticed by: jhb, ssouhlal
* Disable some parts of the code on amd64 for now to prevent a panic. A betternetchild2006-08-151-1/+8
| | | | | | | fix will come later. Sponsored by: Google SoC 2006 Submitted by: rdivacky
* Add the linux 2.6.x stuff (not used by default!):netchild2006-08-151-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - TLS - complete - pid/tid mangling - complete - thread area - complete - futexes - complete with issues - clone() extension - complete with some possible minor issues - mq*/timer*/clock* stuff - complete but untested and the mq* stuff is disabled when not build as part of the kernel with native FreeBSD mq* support (module support for this will come later) Tested with: - linux-firefox - works, tested - linux-opera - works, tested - linux-realplay - doesnt work, issue with futexes - linux-skype - doesnt work, issue with futexes - linux-rt2-demo - works, tested - linux-acroread - doesnt work, unknown reason (coredump) and sometimes issue with futexes - various unix utilities in linux-base-gentoo3 and linux-base-fc4: everything tried worked On amd64 not everything is supported like on i386, the catchup is planned for later when the remaining bugs in the new functions are fixed. To test this new stuff, you have to run sysctl compat.linux.osrelease=2.6.16 to switch back use sysctl compat.linux.osrelease=2.4.2 Don't switch while running a linux program, strange things may or may not happen. Sponsored by: Google SoC 2006 Submitted by: rdivacky Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
* - Pass the MPSAFE flag to namei() in linux_uselib() and handle conditionaljhb2006-07-211-24/+25
| | | | | | | | | | | | | Giant VFS locking in that function. - Remove bogus code to handle the case where namei() returns success but a NULL vnode pointer. - Note that this code duplicates exec_check_permissions() and annotate where it differs. - Hold the vnode lock longer to protect the write to set VV_TEXT in v_vflag. - Mark linux_uselib() MPSAFE. Reviewed by: rwatson
* The linux times syscall can be called with a NULL pointer, so keep coolnetchild2006-06-231-11/+13
| | | | | | | | | | | | | and don't panic. This fix is different from the patch submitted as it not only prevents a NULL-pointer dereference, but also skips some work in this case. Noticed by: Dmitry Ganenko <dima@apk-inform.com> Reviewed by: rdivacky (the original version as in emulation@) MFC after: 1 week Security: This is a RELENG_x_y candidate (local DoS). Go ahead by: secteam (cperciva)
* Now that we don't have a linuxolator on alpha anymore:netchild2006-05-101-29/+4
| | | | | - unifdef __alpha__ - revert rev. 1.66 of linux_socket.c
* Unbreaking build by removing a now unused variable.avatar2006-03-271-1/+0
|
* Use td_ucred rather than p_ucred to avoid panics and general unhappiness.jhb2006-03-271-1/+1
| | | | Pointy hat to: netchild
* Unbreak COMPAT_LINUX32 option support on amd64.ru2006-03-191-0/+1
| | | | Broken by: netchild
* Fixup some problems in my previous commit (COMPAT_43).netchild2006-03-181-1/+0
| | | | Pointyhat to: netchild
* Get rid of the need of COMPAT_43 in the linuxolator.netchild2006-03-181-2/+17
| | | | | Submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Obtained from: DragonFly (some parts)
* Cast tv_sec to intmax_t and print with %jd in some ifdef'ed code.trhodes2005-12-281-8/+8
|
* 1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, mostdavidxu2005-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code. 2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread. 3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc. 4. Add td_sigqueue to thread structure to hold all signals delivered to thread. 5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed. 6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals. Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
* Fix the computation of uptime for linux_sysinfo(). Before it was returningjhb2005-07-071-15/+3
| | | | | | the uptime in seconds mod 60 which wasn't very useful. Approved by: re (scottl)
* Properly convert FreeBSD priority values into Linux values in thesobomax2005-06-081-0/+13
| | | | | | | getpriority(2) syscall. PR: kern/81951 Submitted by: Andriy Gapon <avg@icyb.net.ua>
* - Pass the ISOPEN flag to namei so filesystems will know we're about tojeff2005-04-271-1/+1
| | | | open them or otherwise access the data.
* - Change the vm_mmap() function to accept an objtype_t parameter specifyingjhb2005-04-011-3/+3
| | | | | | | | | | | | the type of object represented by the handle argument. - Allow vm_mmap() to map device memory via cdev objects in addition to vnodes and anonymous memory. Note that mmaping a cdev directly does not currently perform any MAC checks like mapping a vnode does. - Unbreak the DRM getbufs ioctl by having it call vm_mmap() directly on the cdev the ioctl is acting on rather than trying to find a suitable vnode to map from. Reviewed by: alc, arch@
* Handle unimplemented syscall by instantly returning ENOSYS instead of sendingsobomax2005-03-071-0/+9
| | | | | | | signal first and only then returning ENOSYS to match what real linux does. PR: kern/74302 Submitted by: Travis Poppe <tlp@LiquidX.org>
* Use kern_setitimer() to implement linux_alarm() instead of fondling thejhb2005-02-071-19/+7
| | | | real interval timer directly.
* Split out kernel side of {get,set}itimer(2) into two parts: the first thatsobomax2005-01-251-64/+33
| | | | | | | | pops data from the userland and pushes results back and the second which does actual processing. Use the latter to eliminate stackgap in the linux wrappers of those syscalls. MFC after: 2 weeks
* Match the LINUX32's style with existing styleobrien2005-01-141-13/+13
| | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic.
* Fix Linux compat 'uname -m' on AMD64.obrien2005-01-141-1/+7
| | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> (patch reworked by me)
* Rework how we store process times in the kernel such that we always storejhb2004-10-051-11/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the raw values including for child process statistics and only compute the system and user timevals on demand. - Fix the various kern_wait() syscall wrappers to only pass in a rusage pointer if they are going to use the result. - Add a kern_getrusage() function for the ABI syscalls to use so that they don't have to play stackgap games to call getrusage(). - Fix the svr4_sys_times() syscall to just call calcru() to calculate the times it needs rather than calling getrusage() twice with associated stackgap, etc. - Add a new rusage_ext structure to store raw time stats such as tick counts for user, system, and interrupt time as well as a bintime of the total runtime. A new p_rux field in struct proc replaces the same inline fields from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime). A new p_crux field in struct proc contains the "raw" child time usage statistics. ruadd() has been changed to handle adding the associated rusage_ext structures as well as the values in rusage. Effectively, the values in rusage_ext replace the ru_utime and ru_stime values in struct rusage. These two fields in struct rusage are no longer used in the kernel. - calcru() has been split into a static worker function calcru1() that calculates appropriate timevals for user and system time as well as updating the rux_[isu]u fields of a passed in rusage_ext structure. calcru() uses a copy of the process' p_rux structure to compute the timevals after updating the runtime appropriately if any of the threads in that process are currently executing. It also now only locks sched_lock internally while doing the rux_runtime fixup. calcru() now only requires the caller to hold the proc lock and calcru1() only requires the proc lock internally. calcru() also no longer allows callers to ask for an interrupt timeval since none of them actually did. - calcru() now correctly handles threads executing on other CPUs. - A new calccru() function computes the child system and user timevals by calling calcru1() on p_crux. Note that this means that any code that wants child times must now call this function rather than reading from p_cru directly. This function also requires the proc lock. - This finishes the locking for rusage and friends so some of the Giant locks in exit1() and kern_wait() are now gone. - The locking in ttyinfo() has been tweaked so that a shared lock of the proctree lock is used to protect the process group rather than the process group lock. By holding this lock until the end of the function we now ensure that the process/thread that we pick to dump info about will no longer vanish while we are trying to output its info to the console. Submitted by: bde (mostly) MFC after: 1 month
* Fix the 'DEBUG' argument code to unbreak the amd64 LINT build.obrien2004-08-161-2/+2
|
* Fix the 'DEBUG' argument code to unbreak the LINT build.obrien2004-08-161-2/+2
|
OpenPOWER on IntegriCloud