summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_process.c
Commit message (Collapse)AuthorAgeFilesLines
* Push down Giant around calls to proc_rwmem() in kern_ptrace. kern_ptrace()jhb2003-04-251-0/+7
| | | | should now be MP safe.
* Prefer the proc lock to sched_lock when testing PS_INMEM now that it isjhb2003-04-221-2/+1
| | | | safe to do so.
* The sched_lock is not needed while clearing two of the P_STOPPED bits injhb2003-04-171-3/+2
| | | | | p_flag. Also, the proc lock can't be recursed, so simplify an older proc lock assertion.
* Whitespace cleanup.des2003-03-191-5/+5
|
* Add a missing PROC_UNLOCK in ptrace() for the PT_IO case.jhb2002-10-161-0/+1
| | | | | PR: kern/44065 Submitted by: Mark Kettenis <kettenis@chello.nl>
* Completely redo thread states.julian2002-09-111-0/+1
| | | | Reviewed by: davidxu@freebsd.org
* Remove bogus fill_kinfo_proc() before ptrace_set_pc(). There was no needpeter2002-09-071-1/+0
| | | | | | for this. Submitted by: bde
* s/SGNL/SIG/davidxu2002-09-051-1/+1
| | | | | | | | | | s/SNGL/SINGLE/ s/SNGLE/SINGLE/ Fix abbreviation for P_STOPPED_* etc flags, in original code they were inconsistent and difficult to distinguish between them. Approved by: julian (mentor)
* Split up ptrace() into a wrapper that does the copying to and fromiedowse2002-09-051-68/+88
| | | | | | | user space and a kern_ptrace() implementation. Use the kern_*() version in the Linux emulation code to remove more stack gap uses. Approved by: des
* Replace various spelling with FALLTHROUGH which is lint()ablecharnier2002-08-251-1/+1
|
* Do preserve the error result from calling p_cansee() and use that whenrwatson2002-07-201-3/+1
| | | | | | | failing because of the error. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Lock accesses to the page queues.alc2002-07-121-0/+4
|
* Fix ptrace(PT_READ_*, ...) for non-little-endian architectures wheretmm2002-07-121-3/+5
| | | | sizeof(register_t) != sizeof(int).
* Part 1 of KSE-IIIjulian2002-06-291-2/+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..
* All signals can be sent to the inferior process when it's restarted,marcel2002-05-191-1/+1
| | | | | | | not just the legacy ones. PR: 33299 Submitted by: Alexander N. Kabaev <ak03@gte.com>
* Change p_can{debug,see,sched,signal}()'s first argument to be a threadjhb2002-05-191-2/+2
| | | | | | | pointer instead of a proc pointer and require the process pointed to by the second argument to be locked. We now use the thread ucred reference for the credential checks in p_can*() as a result. p_canfoo() should now no longer need Giant.
* Remove trace_req().mini2002-05-091-7/+0
| | | | Reviewed by: alfred, jhb, peter
* GCC 3.x WARNS: Add a break to the default case.marcel2002-04-201-0/+1
|
* Don't allow one to trace an ancestor when already traced.alfred2002-04-141-1/+14
| | | | | | | PR: kern/29741 Submitted by: Dave Zarzycki <zarzycki@FreeBSD.org> Fix from: Tim J. Robbins <tim@robbins.dropbear.id.au> MFC After: 2 weeks
* Rework ptrace(2) to be more locking friendly. We do any needed copyin()'sjhb2002-04-121-86/+114
| | | | | | and acquire the proctree_lock if needed first. Then we lock the process if necessary and fiddle with it as appropriate. Finally we drop locks and do any needed copyout's. This greatly simplifies the locking.
* - Change fill_kinfo_proc() to require that the process is locked when itjhb2002-04-091-0/+2
| | | | | | | | | | | | | | is called. - Change sysctl_out_proc() to require that the process is locked when it is called and to drop the lock before it returns. If this proves too complex we can change sysctl_out_proc() to simply acquire the lock at the very end and have the calling code drop the lock right after it returns. - Lock the process we are going to export before the p_cansee() in the loop in sysctl_kern_proc() and hold the lock until we call sysctl_out_proc(). - Don't call p_cansee() on the process about to be exported twice in the aforementioned loop.
* Convert all pmap_kenter/pmap_kremove pairs in MI code to use pmap_qenter/jake2002-03-171-2/+2
| | | | | | | | | | | | | | | pmap_qremove. pmap_kenter is not safe to use in MI code because it is not guaranteed to flush the mapping from the tlb on all cpus. If the process in question is preempted and migrates cpus between the call to pmap_kenter and pmap_kremove, the original cpu will be left with stale mappings in its tlb. This is currently not a problem for i386 because we do not use PG_G on SMP, and thus all mappings are flushed from the tlb on context switches, not just user mappings. This is not the case on all architectures, and if PG_G is to be used with SMP on i386 it will be a problem. This was committed by peter earlier as part of his fine grained tlb shootdown work for i386, which was backed out for other reasons. Reviewed by: peter
* Implement PT_IO (read / write arbitrary amounts of data or text).des2002-03-161-0/+31
| | | | | Submitted by: Artur Grabowski <art@{blahonga,openbsd}.org> Obtained from: OpenBSD
* PT_[GS]ET{,DB,FP}REGS isn't really optional any more, since we have dummydes2002-03-151-25/+1
| | | | | | | backend functions for those archs that don't support them. I meant to do this ages ago, but never got around to it. Inspired by: OpenBSD
* Back out all the pmap related stuff I've touched over the last few days.peter2002-02-271-2/+2
| | | | | | There is some unresolved badness that has been eluding me, particularly affecting uniprocessor kernels. Turning off PG_G helped (which is a bad sign) but didn't solve it entirely. Userland programs still crashed.
* Jake further reduced IPI shootdowns on sparc64 in loops by using rangedpeter2002-02-271-2/+2
| | | | | | | | shootdowns in a couple of key places. Do the same for i386. This also hides some physical addresses from higher levels and has it use the generic vm_page_t's instead. This will help for PAE down the road. Obtained from: jake (MI code, suggestions for MD part)
* Lock struct pgrp, session and sigio.tanimura2002-02-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Fixed some style bugs. Added a comment about a bug in PT_SSTEP.bde2002-02-211-25/+21
| | | | Approved by: des
* Recover bits that were lost in transition in rev.1.76:bde2002-02-211-16/+77
| | | | | | | | | | | | | | | | | - P_INMEM checks in all the functions. P_INMEM must be checked because PHOLD() is broken. The old bits had bogus locking (using sched_lock) to lock P_INMEM. After removing the P_INMEM checks, we were left with just the bogus locking. - large comments. They were too large, but better than nothing. Remove obfuscations that were gained in transition in rev.1.76: - PROC_REG_ACTION() is even more of an obfuscation than PROC_ACTION(). The change copies procfs_machdep.c rev.1.22 of i386/procfs_machdep.c verbatim except for "fixing" the old-style function headers and adjusting function names and comments. It doesn't remove the bogus locking. Approved by: des
* Bah, I managed to turn cosmetic things into real bugs. Fix shadowedpeter2002-02-081-12/+12
| | | | variable declarations. :-( Definately not my day today.
* Fix a whole bunch of long lines introduced by previous commit by usingpeter2002-02-071-11/+15
| | | | | td = FIRST_THREAD_IN_PROC(p) once, after we have identified the process that we are operating on.
* Pre-KSE/M3 commit.julian2002-02-071-10/+10
| | | | | | | | | | 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,
* Move procfs_* from procfs_machdep.c into sys_process.c, and rename them todes2001-10-211-6/+36
| | | | | | proc_* in the process; procfs_machdep.c is no longer needed. Run-tested on i386, build-tested on Alpha, untested on other platforms.
* Dissociate ptrace from procfs.des2001-10-071-186/+205
| | | | | | | | | | | | | | | | | Until now, the ptrace syscall was implemented as a wrapper that called various functions in procfs depending on which ptrace operation was requested. Most of these functions were themselves wrappers around procfs_{read,write}_{,db,fp}regs(), with only some extra error checks, which weren't necessary in the ptrace case anyway. This commit moves procfs_rwmem() from procfs_mem.c into sys_process.c (renaming it to proc_rwmem() in the process), and implements ptrace() directly in terms of procfs_{read,write}_{,db,fp}regs() instead of having it fake up a struct uio and then call procfs_do{,db,fp}regs(). It also moves the prototypes for procfs_{read,write}_{,db,fp}regs() and proc_rwmem() from proc.h to ptrace.h, and marks all procfs files except procfs_machdep.c as "optional procfs" instead of "standard".
* Final style(9) commit: placement of opening brace; a continuation indent Ides2001-10-041-5/+8
| | | | | | missed in the previous commit; a line that exceeded 80 characters. No functional changes, but the object file's md5 checksum changes because some lines have been displaced.
* More style(9) fixes: no spaces between function name and parameter list;des2001-10-041-30/+30
| | | | | | some indentation fixes (particularly continuation lines). Reviewed by: md5(1)
* This file had a mixture of "return foo;" and "return (foo);"; standardizedes2001-10-041-24/+24
| | | | | | on "return (foo);" as mandated by style(9). Reviewed by: md5(1)
* Set debug information on the process being traced, not the current (debugger)mp2001-09-181-2/+2
| | | | process. This should allow gdb to function correctly on post-KSE kernels.
* KSE Milestone 2julian2001-09-121-16/+17
| | | | | | | | | | | | | | 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
* Zap 'ptrace(PT_READ_U, ...)' and 'ptrace(PT_WRITE_U, ...)' since theypeter2001-08-081-43/+0
| | | | | | | | | | | | are a really nasty interface that should have been killed long ago when 'ptrace(PT_[SG]ETREGS' etc came along. The entity that they operate on (struct user) will not be around much longer since it is part-per-process and part-per-thread in a post-KSE world. gdb does not actually use this except for the obscure 'info udot' command which does a hexdump of as much of the child's 'struct user' as it can get. It carries its own #defines so it doesn't break compiles.
* o Replace calls to p_can(..., P_CAN_xxx) with calls to p_canxxx().rwatson2001-07-051-2/+2
| | | | | | | | | | | | | | | | | | | | | The p_can(...) construct was a premature (and, it turns out, awkward) abstraction. The individual calls to p_canxxx() better reflect differences between the inter-process authorization checks, such as differing checks based on the type of signal. This has a side effect of improving code readability. o Replace direct credential authorization checks in ktrace() with invocation of p_candebug(), while maintaining the special case check of KTR_ROOT. This allows ktrace() to "play more nicely" with new mandatory access control schemes, as well as making its authorization checks consistent with other "debugging class" checks. o Eliminate "privused" construct for p_can*() calls which allowed the caller to determine if privilege was required for successful evaluation of the access control check. This primitive is currently unused, and as such, serves only to complicate the API. Approved by: ({procfs,linprocfs} changes) des Obtained from: TrustedBSD Project
* - FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION fileru2001-05-231-1/+1
| | | | | | | | | | | | | | | systems were repo-copied from sys/miscfs to sys/fs. - Renamed the following file systems and their modules: fdesc -> fdescfs, portal -> portalfs, union -> unionfs. - Renamed corresponding kernel options: FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS. - Install header files for the above file systems. - Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland Makefiles.
* Fix a bug in the pfind() changes due to confusing the process returned byjhb2001-05-041-1/+6
| | | | | | pfind() ('pp') with the process being detached from ptrace. Reported by: bde
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-2/+4
| | | | | | | | | | | 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-10/+14
| | | | | | find before releasing the allproc lock and returning. Reviewed by: -smp, dfr, jake
* Convert the allproc and proctree locks from lockmgr locks to sx locks.jhb2001-03-281-6/+7
|
* - Proc locking.jhb2001-03-071-17/+29
| | | | - Remove some unneeded spl()'s.
* Change and clean the mutex lock interface.bmilekic2001-02-091-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* - Catch up to proc flag changes.jhb2001-01-241-4/+18
| | | | | | - Update stopevent() to assert that the proc lock is held when it is held and is not recursed. Note that the STOPEVENT() macro obtains the proc lock when calling this function.
* Backout rev 1.57 & 1.58. While the previous revisions fixedps2000-12-311-1/+0
| | | | | | attaching to running processes, it completely breaks normal debugging. A better fix is in the works, but cannot be properly tested until the problem with gdb hanging the system in -current is solved.
OpenPOWER on IntegriCloud