summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs
Commit message (Collapse)AuthorAgeFilesLines
...
* Change the process flags P_KSES to be P_THREADED.julian2003-02-271-1/+1
| | | | This is just a cosmetic change but I've been meaning to do it for about a year.
* Slightly change the semantics of vnode labels for MAC: rather thanrwatson2002-10-263-72/+0
| | | | | | | | | | | | | | | | | | | | | "refreshing" the label on the vnode before use, just get the label right from inception. For single-label file systems, set the label in the generic VFS getnewvnode() code; for multi-label file systems, leave the labeling up to the file system. With UFS1/2, this means reading the extended attribute during vfs_vget() as the inode is pulled off disk, rather than hitting the extended attributes frequently during operations later, improving performance. This also corrects sematics for shared vnode locks, which were not previously present in the system. This chances the cache coherrency properties WRT out-of-band access to label data, but in an acceptable form. With UFS1, there is a small race condition during automatic extended attribute start -- this is not present with UFS2, and occurs because EAs aren't available at vnode inception. We'll introduce a work around for this shortly. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Remove even more '&' from pointers to functions.phk2002-10-201-26/+26
| | | | Spotted by: FlexeLint
* Back our kernel support for reliable signal queues.jmallett2002-10-011-2/+1
| | | | Requested by: rwatson, phk, and many others
* First half of implementation of ksiginfo, signal queues, and such. Thisjmallett2002-09-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | gets signals operating based on a TailQ, and is good enough to run X11, GNOME, and do job control. There are some intricate parts which could be more refined to match the sigset_t versions, but those require further evaluation of directions in which our signal system can expand and contract to fit our needs. After this has been in the tree for a while, I will make in kernel API changes, most notably to trapsignal(9) and sendsig(9), to use ksiginfo more robustly, such that we can actually pass information with our (queued) signals to the userland. That will also result in using a struct ksiginfo pointer, rather than a signal number, in a lot of kern_sig.c, to refer to an individual pending signal queue member, but right now there is no defined behaviour for such. CODAFS is unfinished in this regard because the logic is unclear in some places. Sponsored by: New Gold Technology Reviewed by: bde, tjr, jake [an older version, logic similar]
* Use the fields in the sysentvec and in the vm map header in place of thejake2002-09-211-1/+3
| | | | | | | | constants VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK and PS_STRINGS. This is mainly so that they can be variable even for the native abi, based on different machine types. Get stack protections from the sysentvec too. This makes it trivial to map the stack non-executable for certain abis, on machines that support it.
* Completely redo thread states.julian2002-09-112-3/+2
| | | | Reviewed by: davidxu@freebsd.org
* s/SGNL/SIG/davidxu2002-09-052-3/+3
| | | | | | | | | | 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)
* Fixed 64bit big endian bugs relating to abuse of ioctl argument passing.jake2002-08-151-4/+4
| | | | This makes truss work on sparc64.
* Introduce support for Mandatory Access Control and extensiblerwatson2002-08-013-0/+72
| | | | | | | | | | | kernel access control. Modify procfs so that (when mounted multilabel) it exports process MAC labels as the vnode labels of procfs vnodes associated with processes. Approved by: des Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Create a new thread state to describe threads that would be ready to runjulian2002-07-291-0/+2
| | | | | | | | | | | except for the fact tha they are presently swapped out. Also add a process flag to indicate that the process has started the struggle to swap back in. This will be needed for the case where multiple threads start the swapin action top a collision. Also add code to stop a process fropm being swapped out if one of the threads in this process is actually off running on another CPU.. that might hurt... Submitted by: Seigo Tanimura <tanimura@r.dl.itc.u-tokyo.ac.jp>
* Part 1 of KSE-IIIjulian2002-06-295-12/+15
| | | | | | | | | | | | | 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..
* Change p_can{debug,see,sched,signal}()'s first argument to be a threadjhb2002-05-197-8/+10
| | | | | | | 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.
* Include <sys/systm.h> for (at least) the definition of atomic functionsbde2002-04-211-0/+1
| | | | | which are sometimes used by the macros in <sys/mutex.h>; don't depend on not-quite-necessary namespace pollution in <sys/mutex.h>.
* Spelling fix for comment.rwatson2002-04-201-1/+1
|
* - Change procfs_control()'s first argument to be a thread pointer insteadjhb2002-04-131-47/+32
| | | | | | | | | | | of a process pointer. - Move the p_candebug() at the start of procfs_control() a bit to make locking feasible. We still perform the access check before doing anything, we just now perform it after acquiring locks. - Don't lock the sched_lock for TRACE_WAIT_P() and when checking to see if p_stat is SSTOP. We lock the process while setting p_stat to SSTOP so locking the process is sufficient to do a read to see if p_stat is SSTOP or not.
* Lock the target process for p_candebug().jhb2002-04-131-3/+4
|
* Lock the target process in procfs_doproc*regs() for p_candebug and whilejhb2002-04-133-9/+23
| | | | reading/writing the registers.
* - p_cansee() needs the target process locked.jhb2002-04-131-18/+17
| | | | - We need the proc lock held for more of procfs_doprocstatus().
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | 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@
* Protect proc struct (p_args and p_comm) when doing procfs IO that pullsalfred2002-03-291-11/+17
| | | | | | data from it. Submitted by: Jonathan Mini <mini@haikugeek.com>
* Remove __P.alfred2002-03-191-1/+1
|
* Lock struct pgrp, session and sigio.tanimura2002-02-232-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Paranoia: if the process is setugid, set all sensitive files mode 0.des2002-02-181-1/+3
|
* FIxed the following style bugs:bde2002-02-162-10/+16
| | | | | | | | | | - clobbering of jsp's $Id$ by FreeBSD's old $Id$. - long lines in recent KSE changes (procfs_ctl.c). - other style bugs in KSE changes (most related to an shadowed variable in procfs_status.c -- the td in the outer scope is obfuscated by PFS_FILL_ARGS). Approved by: des
* FIxed the following style bugs:bde2002-02-163-11/+21
| | | | | | | - clobbering of jsp's $Id$ by FreeBSD's old $Id$. - lost Berkeley id in procfs_dbregs.c - long lines in recent KSE changes. - various gratuitous differences between procfs_*regs.c.
* Fixed missing PHOLD()/PRELE().bde2002-02-161-0/+2
| | | | | Obtained from: procfs_dbregs.c Approved by: des
* Pre-KSE/M3 commit.julian2002-02-076-14/+19
| | | | | | | | | | 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,
* Remove an obsolete prototype for procfs_kmemaccess().des2001-12-111-3/+0
| | | | Submitted by: rwatson
* Fix various bugs in the debugging code and reenable it.des2001-12-092-9/+9
|
* Fix a KSEfication brain-o in procfs_doprocfile(): return the path of the ↵des2001-12-082-3/+5
| | | | | | | | | target process, not the calling process. While we're here, also unstaticize procfs_doprocfile() and procfs_docurproc() so linprocfs can call them directly instead of duplicating them. Submitted by: Dominic Mitchell <dom@semantico.com>
* Pseudofsize procfs(5).des2001-12-0416-2035/+477
|
* o Introduce pr_mtx into struct prison, providing protection for therwatson2001-12-031-4/+7
| | | | | | | | | | | | | | | | | | mutable contents of struct prison (hostname, securelevel, refcount, pr_linux, ...) o Generally introduce mtx_lock()/mtx_unlock() calls throughout kern/ so as to enforce these protections, in particular, in kern_mib.c protection sysctl access to the hostname and securelevel, as well as kern_prot.c access to the securelevel for access control purposes. o Rewrite linux emulator abstractions for accessing per-jail linux mib entries (osname, osrelease, osversion) so that they don't return a pointer to the text in the struct linux_prison, rather, a copy to an array passed into the calls. Likewise, update linprocfs to use these primitives. o Update in_pcb.c to always use prison_getip() rather than directly accessing struct prison. Reviewed by: jhb
* Fix printf format bugs introduced in rev 1.34 for printing times.peter2001-11-071-4/+4
| | | | | | | | | quad_t cannot be printed with %lld on 64 bit systems. Dont waste cpu to round user and system times up to long long, it is highly improbable that a process will have accumulated 68 years of user or system cpu time (not wall clock time) before a reboot or process restart.
* Correctly unlock the target process if /proc/$foo/mem is open()ed bygreen2001-11-061-1/+1
| | | | | | | another process which cannot p_candebug() it. The bug was introduced in rev. 1.100. Approved by: des
* Adjust printfs to be time_t agnostic.dillon2001-10-281-4/+4
|
* No, you may not /* FALLTHROUGH */. Not only will you return an incorrectdes2001-10-221-1/+1
| | | | | | | result, but you'd corrupt the kernel malloc() arena if it weren't for a small but life-saving optimization in ioctl(). MFC after: 1 week
* Move procfs_* from procfs_machdep.c into sys_process.c, and rename them todes2001-10-214-7/+7
| | | | | | 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-075-226/+4
| | | | | | | | | | | | | | | | | 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".
* Remove some useless preprocesor paranoia.des2001-10-071-4/+0
|
* In procfs_readdir(), when the directory being read was a process directory,des2001-10-071-1/+3
| | | | | | | | | | | the target process was being held locked during the uiomove() call. If the process calling readdir() was the same as the target process (for instance 'ls /proc/curproc/'), and uiomove() caused a page fault, the result would be a proc lock recursion. I have no idea how long this has been broken - possibly ever since pfind() was changed to lock the process it returns. Also replace the one and only call to procfs_findtextvp() with a direct test of td->td_proc->p_textvp.
* A process name may contain whitespace and unprintable characters,mike2001-09-251-5/+11
| | | | | | | | so convert those characters to octal notation. Also convert backslashes to octal notation to avoid confusion. Reviewed by: des MFC after: 1 week
* o Remove redundant securelevel/pid1 check in procfs_rw() -- thisrwatson2001-09-181-2/+0
| | | | | | | protection is enforced at the invidual method layer using p_candebug(). Obtained from: TrustedBSD Project
* KSE Milestone 2julian2001-09-1211-76/+81
| | | | | | | | | | | | | | 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
* Remove dangling prototype for the now defunct procfs_kmemaccess()rwatson2001-08-031-3/+0
| | | | | | call. Obtained from: TrustedBSD Project
* Collapse a Pmem case in with the other debugging files case for procfs,rwatson2001-08-031-5/+2
| | | | | | | | as there are now "unusual" protection properties to Pmem that differ from the other files. While I'm at it, introduce proc locking for the other files, which was previously present only in the Pmem case. Obtained from: TrustedBSD Project
* Remove read permission for group on the /proc/*/mem file, since kmemrwatson2001-08-031-2/+1
| | | | | | | no longer requires access. Reviewed by: tmm Obtained from: TrustedBSD Project
* Prior to support for almost all ps activity via sysctl, ps used procfs,rwatson2001-08-033-42/+9
| | | | | | | | | | | | | | | | | | | | and so special-casing was introduced to provide extra procfs privilege to the kmem group. With the advent of non-setgid kmem ps, this code is no longer required, and in fact, can is potentially harmful as it allocates privilege to a gid that is increasingly less meaningful. Knowledge of specific gid's in kernel is also generally bad precedent, as the kernel security policy doesn't distinguish gid's specifically, only uid 0. This commit removes reference to kmem in procfs, both in terms of access control decisions, and the applying of gid kmem to the /proc/*/mem file, simplifying the associated code considerably. Processes are still permitted to access the mem file based on the debugging policy, so ps -e still works fine for normal processes and use. Reviewed by: tmm Obtained from: TrustedBSD Project
* o Replace calls to p_can(..., P_CAN_xxx) with calls to p_canxxx().rwatson2001-07-057-15/+15
| | | | | | | | | | | | | | | | | | | | | 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
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-07-042-14/+5
| | | | | | | | | (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
OpenPOWER on IntegriCloud