summaryrefslogtreecommitdiffstats
path: root/sys/compat/svr4
Commit message (Collapse)AuthorAgeFilesLines
* Enforce MAC policies for the locally implemented vnode services inrwatson2002-08-122-0/+28
| | | | | | | | | | SVR4 emulation relating to readdir() and fd_revoke(). All other services appear to be implemented by simply wrapping existing FreeBSD native system call implementations, so don't require local instrumentation in the emulator module. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* - Replace v_flag with v_iflag and v_vflagjeff2002-08-041-1/+2
| | | | | | | | | | | | | | | - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS
* Infrastructure tweaks to allow having both an Elf32 and an Elf64 executablepeter2002-07-202-5/+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).
* The comment marked with XXX was right: emulate SVR4 forrobert2002-07-091-1/+1
| | | | | | ELF binaries branded with ELFOSABI_SYSV, this is reported to work and brandelf(1) puts this type into files if "SVR4" was specified.
* Part 1 of KSE-IIIjulian2002-06-291-3/+4
| | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals..
* catch up with ktrace changes, KTRPOINT takes a 'struct thread' notalfred2002-06-111-2/+2
| | | | 'struct proc' now.
* Catch up to changes in ktrace API.jhb2002-06-071-2/+2
|
* Fix typo in the BSD copyright: s/withough/without/schweikh2002-06-021-1/+1
| | | | | Spotted and suggested by: des MFC after: 3 weeks
* Back out my lats commit of locking down a socket, it conflicts with hsu's work.tanimura2002-05-312-23/+10
| | | | Requested by: hsu
* correct commented out preprocessor test for i386 to __i386__alfred2002-05-301-1/+1
|
* Fixed a printf format error. It was old and should have been detected bybde2002-05-251-1/+1
| | | | gcc-2.9x, but somehow wasn't fixed already.
* Lock down a socket, milestone 1.tanimura2002-05-202-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a socket buffer. The mutex in the receive buffer also protects the data in struct socket. o Determine the lock strategy for each members in struct socket. o Lock down the following members: - so_count - so_options - so_linger - so_state o Remove *_locked() socket APIs. Make the following socket APIs touching the members above now require a locked socket: - sodisconnect() - soisconnected() - soisconnecting() - soisdisconnected() - soisdisconnecting() - sofree() - soref() - sorele() - sorwakeup() - sotryfree() - sowakeup() - sowwakeup() Reviewed by: alfred
* - Lock proctree_lock instead of pgrpsess_lock.jhb2002-04-161-1/+1
| | | | - Exclusively lock proctree_lock while calling leavepgrp().
* Use proc lock to protect p_ucred pointer while we deference it to read ajhb2002-04-111-0/+4
| | | | few values.
* 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
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-013-4/+4
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Make the reference counting of 'struct pargs' SMP safe.alfred2002-03-271-2/+1
| | | | | | | | | There is still some locations where the PROC lock should be held in order to prevent inconsistent views from outside (like the proc->p_fd fix for kern/vfs_syscalls.c:checkdirs()) that can be fixed later. Submitted by: Jonathan Mini <mini@haikugeek.com>
* Remove references to vm_zone.h and switch over to the new uma API.jeff2002-03-201-2/+2
|
* Remove __P.alfred2002-03-2019-249/+244
|
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-273-8/+7
| | | | reference.
* Use the updated getcredhostname() function.robert2002-02-271-3/+1
|
* - Use the new getcredhostname function in the SVR4 uname system call.robert2002-02-271-2/+3
| | | | | | - Remove spurious empty line. Reviewed by: phk
* Lock struct pgrp, session and sigio.tanimura2002-02-231-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
* include sys/lock.h and sys/mutex.h to make compile.alfred2002-01-301-0/+2
| | | | Noticed by: Vincent Poy <vince@oahu.WURLDLINK.NET>
* Lock the caller process if the pid passed to getsid() or getpgid()tanimura2002-01-191-4/+6
| | | | equals to zero.
* For getsid(), return the sid stored in struct session. This preventstanimura2002-01-191-1/+1
| | | | | | panic in case where a session has no session leader. Inspired by: Solaris 8
* Make compile, remove extra fdrop() calls.alfred2002-01-191-3/+1
| | | | Change name of function to what it's supposed to be (s/sys/do)
* make compile, add missing { and variable declaration.alfred2002-01-191-2/+2
|
* Semi-backout previous fgetvp change, we need the struct file pointeralfred2002-01-191-7/+11
| | | | to perform relative offset calculations, so use fget instead.
* fix typo, there's uap, just fdalfred2002-01-161-1/+1
|
* Replace ffind_* with fget calls.alfred2002-01-144-33/+16
| | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf().
* Some of the KSE stuff was accidentally reverted by file locking,alfred2002-01-131-5/+5
| | | | | | fix it. Pointed out by: jhb
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-135-54/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap.
* Give struct socket structures a ref counting interface similar todillon2001-11-171-18/+12
| | | | | | | vnodes. This will hopefully serve as a base from which we can expand the MP code. We currently do not attempt to obtain any mutex or SX locks, but the door is open to add them when we nail down exactly how that part of it is going to work.
* Add missing includes of sys/lock.h.jhb2001-10-111-0/+1
|
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderps2001-10-102-2/+2
| | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks
* Fix typo.julian2001-09-131-1/+1
| | | | noticed by: jhb
* KSE Milestone 2julian2001-09-1222-663/+670
| | | | | | | | | | | | | | 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
* Synchronize syscalls.master(s) with recent Giant pushdown workdillon2001-09-011-8/+8
|
* get rid of some printf and pointer type warningsassar2001-07-227-15/+17
|
* o Merge contents of struct pcred into struct ucred. Specifically, add therwatson2001-05-252-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-016-34/+42
| | | | | | | | | | | 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)
* Change the pfind() and zpfind() functions to lock the process that theyjhb2001-04-241-2/+3
| | | | | | find before releasing the allproc lock and returning. Reviewed by: -smp, dfr, jake
* Add missing includes of <sys/sx.h>jhb2001-03-281-0/+1
| | | | Reported by: peter
* Convert the allproc and proctree locks from lockmgr locks to sx locks.jhb2001-03-281-9/+9
|
* Grab the process lock while calling psignal and before calling psignal.jhb2001-03-071-1/+4
|
* - Hold both an exclusive proctree lock and the proc lock when reparentingjhb2001-03-071-10/+11
| | | | | a traced process during exit. - Lock the parent process while sending it SIGCHLD.
* MFS: bring the consistent `compat_3_brand' support into -CURRENTobrien2001-02-241-0/+1
| | | | | (the work was first done in the RELENG_4 branch near a release during a MFC to make the code cleaner and more consistent)
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectrwatson2001-02-211-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project
* Change and clean the mutex lock interface.bmilekic2001-02-091-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
OpenPOWER on IntegriCloud