summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_sysvec.c
Commit message (Collapse)AuthorAgeFilesLines
* Add missing includes from previous commit.jhb2003-03-271-0/+1
| | | | Reported by: des
* Add a cleanup function to destroy the osname_lock and call it on modulejhb2003-03-261-0/+1
| | | | | | | unload. Submitted by: gallatin Reported by: Martin Karlsson <mk-freebsd@bredband.net>
* Sync up linux and svr compat elf fixup functions for exec(). Thesejhb2003-03-211-4/+6
| | | | | | | | | functions are now all basically identical except that alpha linux uses Elf64 arguments and svr4 and i386 linux use Elf32. The fixups include changing the first argument to be a register_t ** to match the prototype for fixup functions, asserting that the process in the image_params struct is always curproc and removing unnecessary locking to read credentials as a result, and a few style fixes.
* Clean up whitespace and remove register keyword.des2003-03-031-27/+27
|
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.des2003-03-031-2/+2
| | | | Also clean up some egregious casts and incorrect use of sizeof.
* Correctly map SIGSYS signal to/from Linux.kan2003-02-241-2/+2
| | | | Submitted by: "Georg-W. Koltermann" <g.w.k@web.de>
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* bzero() the sigframe before we fill it. This was not done at all inmarcel2002-11-021-3/+4
| | | | linux_rt_sendsig() and only done for the fpstate in linux_sendsig().
* Style(9). Make some function declarations consistent with the rest,markm2002-10-191-16/+7
| | | | and remove some nearby extraneous {}'s.
* Tidy up some loose ends that bde pointed out. caddr_t bad, ok?peter2002-09-071-8/+7
| | | | | | | Move fill_kinfo_proc to before we copy the results instead of after the copy and too late. There is still more to do here.
* The true value of how the kernel was configured for KSTACK_PAGES was notpeter2002-09-071-6/+6
| | | | | | available at module compile time. Do not #include the bogus opt_kstack_pages.h at this point and instead refer to the variables that are also exported via sysctl.
* Diff reduction in comments for filling the siginfo structure - refer tojmallett2002-09-071-1/+1
| | | | | filling in the POSIX parts, when doing the same thing in every port of FreeBSD.
* Supposedly linux has added a 6th syscall arg register (%ebp). I am notpeter2002-09-071-0/+1
| | | | 100% sure if this is enough, but it will not harm anything.
* Give this a self contained a.out coredump routine.peter2002-09-071-1/+60
| | | | XXX freebsd-aout coredumps for a linux-aout binary is a bit pointless.
* Use the new kern_* functions to avoid the need to store argumentsiedowse2002-09-011-11/+7
| | | | | | | | in the stack gap. This converts most VFS and signal related system calls, as well as select(). Discussed on: -arch Approved by: marcel
* Added fields for VM_MIN_ADDRESS, PS_STRINGS and stack protections tojake2002-09-011-2/+18
| | | | | | sysentvec. Initialized all fields of all sysentvecs, which will allow them to be used instead of constants in more places. Provided stack fixup routines for emulations that previously used the default.
* Infrastructure tweaks to allow having both an Elf32 and an Elf64 executablepeter2002-07-201-4/+6
| | | | | | | | | | | | | | | handler in the kernel at the same time. Also, allow for the exec_new_vmspace() code to build a different sized vmspace depending on the executable environment. This is a big help for execing i386 binaries on ia64. The ELF exec code grows the ability to map partial pages when there is a page size difference, eg: emulating 4K pages on 8K or 16K hardware pages. Flesh out the i386 emulation support for ia64. At this point, the only binary that I know of that fails is cvsup, because the cvsup runtime tries to execute code in pages not marked executable. Obtained from: dfr (mostly, many tweaks from me).
* Fix typo in the BSD copyright: s/withough/without/schweikh2002-06-021-1/+1
| | | | | Spotted and suggested by: des MFC after: 3 weeks
* Moved signal handling and rescheduling from userret() to ast() so thatbde2002-04-041-0/+2
| | | | | | | | | | | they aren't in the usual path of execution for syscalls and traps. The main complication for this is that we have to set flags to control ast() everywhere that changes the signal mask. Avoid locking in userret() in most of the remaining cases. Submitted by: luoqi (first part only, long ago, reorganized by me) Reminded by: dillon
* Fixed some style bugs in the removal of __P(()). Continuation linesbde2002-03-241-5/+5
| | | | | were not outdented to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting.
* Remove __P.alfred2002-03-201-9/+9
|
* Eliminate unnecessary calls to grow_stack() and useracc() from linux_sendsig()alc2002-03-191-49/+5
| | | | and linux_rt_sendsig(). (See i386/i386/machdep.c revisions 1.503 and 1.504.)
* Pre-KSE/M3 commit.julian2002-02-071-1/+1
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* Clear the single-step flag for signal handlers. This fixes bogus tracebde2002-01-101-2/+2
| | | | | | | | | | | | | | | | traps on the first instruction of signal handlers. In trap.c:syscall(), fake a trace trap if the single-step flag was set on entry to the kernel, not if it will be set on exit from the kernel. This fixes bogus trace traps after the last instruction of signal handlers. gdb-4.18 (the version in FreeBSD) still has problems with the program in the PR. These seem to be due to bugs in gdb and not in FreeBSD, and are fixed in gdb-5.1 (the distribution version). PR: 33262 Tested by: k Macy <kip_macy@yahoo.com> MFC after: 1 day
* Convert BSD trap codes to i386.pb2001-11-201-2/+41
| | | | Submitted by: F. Gouget <fgouget@free.fr>
* Eliminate the prefix parameter to linux_emul_find(), which was alwaysdes2001-10-271-2/+2
| | | | | | | | linux_emul_path anyway. Linux_emul_find() has interesting bugs in its prefix handling (which luckily are not currently exploitable); this commit is preliminary to an attempt at cleaning it up. Approved by: marcel
* Oops, these already included sys/lock.h, they just did so afterjhb2001-10-111-1/+0
| | | | sys/mutex.h which is too late.
* Add missing includes of sys/lock.h.jhb2001-10-111-0/+1
|
* Add a lock assertion to linux_sendsig() to match other sendsig functions.jhb2001-09-171-0/+1
|
* KSE Milestone 2julian2001-09-121-14/+18
| | | | | | | | | | | | | | 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
* Fix LINT breakage caused by previous commit. The linux_rt_sendsigmarcel2001-09-101-0/+9
| | | | | | | | | | | | and linux_sendsig functions guarded their debugging output with ldebug(sigreturn). This has been mistaken for a cut-n-paste bug, and was replaced by ldebug(rt_sendsig) and ldebug(sendsig) resp. Since the sendsig functions are not syscalls, this brokei any build that defines DEBUG. The fix maps both functions to the unused syscall 0 so that they can be enabled/disabled independently from sigreturn, but not independently from each other.
* Round of cleanups and enhancements. These include (in random order):marcel2001-09-081-23/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Call sendsig() with the proc lock held and return with it held.jhb2001-09-061-2/+2
|
* Remove the MPSAFE keyword from the parser for syscalls.master.dillon2001-08-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead introduce the [M] prefix to existing keywords. e.g. MSTD is the MP SAFE version of STD. This is prepatory for a massive Giant lock pushdown. The old MPSAFE keyword made syscalls.master too messy. Begin comments MP-Safe procedures with the comment: /* * MPSAFE */ This comments means that the procedure may be called without Giant held (The procedure itself may still need to obtain Giant temporarily to do its thing). sv_prepsyscall() is now MP SAFE and assumed to be MP SAFE sv_transtrap() is now MP SAFE and assumed to be MP SAFE ktrsyscall() and ktrsysret() are now MP SAFE (Giant Pushdown) trapsignal() is now MP SAFE (Giant Pushdown) Places which used to do the if (mtx_owned(&Giant)) mtx_unlock(&Giant) test in syscall[2]() in */*/trap.c now do not. Instead they explicitly unlock Giant if they previously obtained it, and then assert that it is no longer held to catch broken system calls. Rebuild syscall tables.
* Add a new MI pointer to the process' trapframe p_frame instead of usingjhb2001-06-291-4/+4
| | | | | | various differently named pointers buried under p_md. Reviewed by: jake (in principle)
* With this commit, I hereby pronounce gensetdefs past its use-by date.peter2001-06-131-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind
* o Merge contents of struct pcred into struct ucred. Specifically, add therwatson2001-05-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | real uid, saved uid, real gid, and saved gid to ucred, as well as the pcred->pc_uidinfo, which was associated with the real uid, only rename it to cr_ruidinfo so as not to conflict with cr_uidinfo, which corresponds to the effective uid. o Remove p_cred from struct proc; add p_ucred to struct proc, replacing original macro that pointed. p->p_ucred to p->p_cred->pc_ucred. o Universally update code so that it makes use of ucred instead of pcred, p->p_ucred instead of p->p_pcred, cr_ruidinfo instead of p_uidinfo, cr_{r,sv}{u,g}id instead of p_*, etc. o Remove pcred0 and its initialization from init_main.c; initialize cr_ruidinfo there. o Restruction many credential modification chunks to always crdup while we figure out locking and optimizations; generally speaking, this means moving to a structure like this: newcred = crdup(oldcred); ... p->p_ucred = newcred; crfree(oldcred); It's not race-free, but better than nothing. There are also races in sys_process.c, all inter-process authorization, fork, exec, and exit. o Remove sigio->sio_ruid since sigio->sio_ucred now contains the ruid; remove comments indicating that the old arrangement was a problem. o Restructure exec1() a little to use newcred/oldcred arrangement, and use improved uid management primitives. o Clean up exit1() so as to do less work in credential cleanup due to pcred removal. o Clean up fork1() so as to do less work in credential cleanup and allocation. o Clean up ktrcanset() to take into account changes, and move to using suser_xxx() instead of performing a direct uid==0 comparision. o Improve commenting in various kern_prot.c credential modification calls to better document current behavior. In a couple of places, current behavior is a little questionable and we need to check POSIX.1 to make sure it's "right". More commenting work still remains to be done. o Update credential management calls, such as crfree(), to take into account new ruidinfo reference. o Modify or add the following uid and gid helper routines: change_euid() change_egid() change_ruid() change_rgid() change_svuid() change_svgid() In each case, the call now acts on a credential not a process, and as such no longer requires more complicated process locking/etc. They now assume the caller will do any necessary allocation of an exclusive credential reference. Each is commented to document its reference requirements. o CANSIGIO() is simplified to require only credentials, not processes and pcreds. o Remove lots of (p_pcred==NULL) checks. o Add an XXX to authorization code in nfs_lock.c, since it's questionable, and needs to be considered carefully. o Simplify posix4 authorization code to require only credentials, not processes and pcreds. Note that this authorization, as well as CANSIGIO(), needs to be updated to use the p_cansignal() and p_cansched() centralized authorization routines, as they currently do not take into account some desirable restrictions that are handled by the centralized routines, as well as being inconsistent with other similar authorization instances. o Update libkvm to take these changes into account. Obtained from: TrustedBSD Project Reviewed by: green, bde, jhb, freebsd-arch, freebsd-audit
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-191-0/+1
| | | | | | | | | | | | | | | | | | | vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
* Preserve the state of the %gs register when setting up the signaldeischen2001-05-121-2/+0
| | | | | | | | | | handler in Linux emulation. According to bde, this is what Linux does. Recent versions of linuxthreads use %gs for thread-specific data, while FreeBSD uses %fs (mostly because WINE uses %gs). Tested by: drew
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-4/+7
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Grab the process lock while calling psignal and before calling psignal.jhb2001-03-071-2/+4
|
* Remove the leading underscore from all symbols defined in x86 asmjake2001-02-251-2/+2
| | | | | | | | | | | and used in C or vice versa. The elf compiler uses the same names for both. Remove asnames.h with great prejudice; it has served its purpose. Note that this does not affect the ability to generate an aout kernel due to gcc's -mno-underscores option. moral support from: peter, jhb
* MFS: bring the consistent `compat_3_brand' support into -CURRENTobrien2001-02-241-0/+2
| | | | | (the work was first done in the RELENG_4 branch near a release during a MFC to make the code cleaner and more consistent)
* Allow debugging output to be controlled on a per-syscall granularity.jlemon2001-02-161-16/+20
| | | | | | Also clean up debugging output in a slightly more uniform fashion. The default behavior remains the same (all debugging output is turned on)
* Proc locking.jhb2001-01-241-0/+16
|
* The Linuxulator needs sysvipc to work.des2001-01-141-0/+3
|
* Don't use p->p_sigstk.ss_flags to keep state of whether themarcel2000-11-301-17/+12
| | | | | | | | | | | | | | | process is on the alternate stack or not. For compatibility with sigstack(2) state is being updated if such is needed. We now determine whether the process is on the alternate stack by looking at its stack pointer. This allows a process to siglongjmp from a signal handler on the alternate stack to the place of the sigsetjmp on the normal stack. When maintaining state, this would have invalidated the state information and causing a subsequent signal to be delivered on the normal stack instead of the alternate stack. PR: 22286
* Correct a misnamed argument hidden behind a #ifdef DEBUGjlemon2000-11-251-1/+1
| | | | Found by: LINT
* o Change the argument of linux_sigreturn to be a pointer to amarcel2000-11-231-56/+56
| | | | | | | | | | struct sigframe. We need more than only the signal context. o Properly convert the signal mask when setting up the signal frame in linux_sendsig and properly convert it back in linux_sigreturn. Do some cleanups and improve style while here.
OpenPOWER on IntegriCloud