summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_process.c
Commit message (Collapse)AuthorAgeFilesLines
* Finish fixing up Alpha to work with an MP safe ptrace():jhb2004-04-011-8/+8
| | | | | | | | | | - ptrace_single_step() is no longer called with the proc lock held, so don't try to unlock it and then relock it. - Push Giant down into proc_rwmem() instead of forcing all the consumers (including Alpha breakpoint support) to explicitly wrap calls to proc_rwmem() with Giant. Tested by: kensmith
* Use uiomove_fromphys() instead of pmap_qenter() and pmap_qremove() inalc2004-03-241-9/+1
| | | | proc_rwmem().
* Drop the proc lock around calls to the MD functions ptrace_single_step(),jhb2004-03-151-6/+11
| | | | | | | | | | ptrace_set_pc(), and cpu_ptrace() so that those functions are free to acquire Giant, sleep, etc. We already do a PHOLD/PRELE around them so that it is safe to sleep inside of these routines if necessary. This allows ptrace() to be marked MP safe again as it no longer triggers lock order reversals on Alpha. Tested by: wilko
* When reparenting a process in the PT_DETACH code, only set p_sigparenttruckman2004-02-191-1/+2
| | | | | | to SIGCHLD if the new parent process is initproc. MFC after: 2 weeks
* When reparenting a process to init, make sure that p_sigparent istruckman2004-02-111-0/+1
| | | | | | | | | set to SIGCHLD. This avoids the creation of orphaned Linux-threaded zombies that init is unable to reap. This can occur when the parent process sets its SIGCHLD to SIG_IGN. Fix a similar situation in the PT_DETACH code. Tested by: "Steven Hartland" <killing AT multiplay.co.uk>
* Implement preliminary support for the PT_SYSCALL command to ptrace(2).robert2003-10-091-1/+16
|
* Add or finish support for machine dependent ptrace requests. When wemarcel2003-08-151-22/+13
| | | | | | | | | | | | | | | | | check for permissions, do it for all requests, not the known requests. Later when we actually service the request we deal with the invalid requests we previously caught earlier. This commit changes the behaviour of the ptrace(2) interface for boundary cases such as an unknown request without proper permissions. Previously we would return EINVAL. Now we return EBUSY or EPERM. Platforms need to define __HAVE_PTRACE_MACHDEP when they have MD requests. This makes the prototype of cpu_ptrace() visible and introduces a call to this function for all requests greater or equal to PT_FIRSTMACH. Silence on: audit
* Add or correct range checking of signal numbers in system calls andnectar2003-08-101-2/+2
| | | | | | | | | ioctls. In the particular case of ptrace(), this commit more-or-less reverts revision 1.53 of sys_process.c, which appears to have been erroneous. Reviewed by: iedowse, jhb
* Background: When proc_rwmem() wired and mapped a page, it also addedalc2003-08-091-30/+5
| | | | | | | | | | | | | | | | a reference to the containing object. The purpose of the reference being to prevent the destruction of the object and an attempt to free the wired page. (Wired pages can't be freed.) Unfortunately, this approach does not work. Some operations, like fork(2) that call vm_object_split(), can move the wired page to a difference object, thereby making the reference pointless and opening the possibility of the wired page being freed. A solution is to use vm_page_hold() in place of vm_page_wire(). Held pages can be freed. They are moved to a special hold queue until the hold is released. Submitted by: tegge
* Use kmem_alloc_nofault() rather than kmem_alloc_pageable() in proc_rwmem().alc2003-08-021-1/+1
| | | | | | See revision 1.140 of kern/sys_pipe.c for a detailed rationale. Submitted by: tegge
* Add vm object locking.alc2003-06-111-12/+12
|
* Use __FBSDID().obrien2003-06-111-2/+3
|
* 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.
OpenPOWER on IntegriCloud