summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs/procfs_mem.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Change p_can{debug,see,sched,signal}()'s first argument to be a threadjhb2002-05-191-1/+1
| | | | | | | 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>.
* Lock the target process for p_candebug().jhb2002-04-131-3/+4
|
* Pseudofsize procfs(5).des2001-12-041-10/+6
|
* Dissociate ptrace from procfs.des2001-10-071-217/+1
| | | | | | | | | | | | | | | | | 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".
* Prior to support for almost all ps activity via sysctl, ps used procfs,rwatson2001-08-031-34/+4
| | | | | | | | | | | | | | | | | | | | 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-051-1/+1
| | | | | | | | | | | | | | | | | | | | | 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-041-8/+3
| | | | | | | | | (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.
* - 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.
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-191-1/+11
| | | | | | | | | | | | | | | | | | | 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
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-3/+5
| | | | | | | | | | | 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)
* o Centralize inter-process access control, introducing:rwatson2000-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int p_can(p1, p2, operation, privused) which allows specification of subject process, object process, inter-process operation, and an optional call-by-reference privused flag, allowing the caller to determine if privilege was required for the call to succeed. This allows jail, kern.ps_showallprocs and regular credential-based interaction checks to occur in one block of code. Possible operations are P_CAN_SEE, P_CAN_SCHED, P_CAN_KILL, and P_CAN_DEBUG. p_can currently breaks out as a wrapper to a series of static function checks in kern_prot, which should not be invoked directly. o Commented out capabilities entries are included for some checks. o Update most inter-process authorization to make use of p_can() instead of manual checks, PRISON_CHECK(), P_TRESPASS(), and kern.ps_showallprocs. o Modify suser{,_xxx} to use const arguments, as it no longer modifies process flags due to the disabling of ASU. o Modify some checks/errors in procfs so that ENOENT is returned instead of ESRCH, further improving concealment of processes that should not be visible to other processes. Also introduce new access checks to improve hiding of processes for procfs_lookup(), procfs_getattr(), procfs_readdir(). Correct a bug reported by bp concerning not handling the CREATE case in procfs_lookup(). Remove volatile flag in procfs that caused apparently spurious qualifier warnigns (approved by bde). o Add comment noting that ktrace() has not been updated, as its access control checks are different from ptrace(), whereas they should probably be the same. Further discussion should happen on this topic. Reviewed by: bde, green, phk, freebsd-security, others Approved by: bde Obtained from: TrustedBSD Project
* Include vm/vm_extern.h to get at prototypeseivind1999-12-201-0/+1
|
* Don't simulate a pseudo address-space beyond VM_MAXUSER_ADDRESS thatpeter1999-12-111-40/+0
| | | | | | | | | | | maps onto the upages. We used to use this extensively, particularly for ps and gdb. Both of these have been "fixed". ps gets the p_stats via eproc along with all the other stats, and gdb uses the regs, fpregs etc files. Once apon a time the UPAGES were mapped here, but that changed back in January '96. This essentially kills my revisions 1.16 and 1.17. The 2-page "hole" above the stack can be reclaimed now.
* Remove unused #includes.phk1999-12-081-1/+0
| | | | Obtained from: http://bogon.freebsd.dk/include
* Introduce the new functionphk1999-11-211-1/+1
| | | | | | | | | | | | | | p_trespass(struct proc *p1, struct proc *p2) which returns zero or an errno depending on the legality of p1 trespassing on p2. Replace kern_sig.c:CANSIGNAL() with call to p_trespass() and one extra signal related check. Replace procfs.h:CHECKIO() macros with calls to p_trespass(). Only show command lines to process which can trespass on the target process.
* s/p_cred->pc_ucred/p_ucred/gphk1999-11-211-1/+1
|
* Passing "0" or "FALSE" as the fourth argument to vm_fault is wrong. Italc1999-11-091-1/+1
| | | | should be "VM_FAULT_NORMAL".
* Explain why Warner is right, and I am wrong, in the removing of thesef1999-11-081-0/+14
| | | | | | | | | | | file object. Also explain some possible directions to re-implement it -- I'm not sure it should be, given the minimal application use. (Other than having the debugger automatically access the symbols for a process, the main use I'd found was with some minor accounting ability, but _that_ depends on it being in the filesystem space; an ioctl access method would be useless in that case.) This is a code-less change; only a comment has been added.
* useracc() the prequel:phk1999-10-291-1/+0
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Change suser_xxx() to suser() where it applies.phk1999-04-271-4/+5
|
* Suser() simplification:phk1999-04-271-2/+2
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* Added a second argument, "activate" to the vm_page_unwire() call so thatdg1998-10-281-2/+2
| | | | the caller can select either inactive or active queue to put the page on.
* Cast pointers to uintptr_t/intptr_t instead of to u_long/long,bde1998-07-151-2/+2
| | | | | | | respectively. Most of the longs should probably have been u_longs, but this changes is just to prevent warnings about casts between pointers and integers of different sizes, not to fix poorly chosen types.
* This commit fixes various 64bit portability problems required fordfr1998-06-071-2/+2
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Disallow reading the current kernel stack. Only the user structure andtegge1998-05-191-7/+32
| | | | | the current registers should be accessible. Reviewed by: David Greenman <dg@root.com>
* Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.des1998-04-171-2/+2
|
* Back out DIAGNOSTIC changes.eivind1998-02-061-3/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+3
|
* VM level code cleanups.dyson1998-01-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) Start using TSM. Struct procs continue to point to upages structure, after being freed. Struct vmspace continues to point to pte object and kva space for kstack. u_map is now superfluous. 2) vm_map's don't need to be reference counted. They always exist either in the kernel or in a vmspace. The vmspaces are managed by reference counts. 3) Remove the "wired" vm_map nonsense. 4) No need to keep a cache of kernel stack kva's. 5) Get rid of strange looking ++var, and change to var++. 6) Change more data structures to use our "zone" allocator. Added struct proc, struct vmspace and struct vnode. This saves a significant amount of kva space and physical memory. Additionally, this enables TSM for the zone managed memory. 7) Keep ioopt disabled for now. 8) Remove the now bogus "single use" map concept. 9) Use generation counts or id's for data structures residing in TSM, where it allows us to avoid unneeded restart overhead during traversals, where blocking might occur. 10) Account better for memory deficits, so the pageout daemon will be able to make enough memory available (experimental.) 11) Fix some vnode locking problems. (From Tor, I think.) 12) Add a check in ufs_lookup, to avoid lots of unneeded calls to bcmp. (experimental.) 13) Significantly shrink, cleanup, and make slightly faster the vm_fault.c code. Use generation counts, get rid of unneded collpase operations, and clean up the cluster code. 14) Make vm_zone more suitable for TSM. This commit is partially as a result of discussions and contributions from other people, including DG, Tor Egge, PHK, and probably others that I have forgotten to attribute (so let me know, if I forgot.) This is not the infamous, final cleanup of the vnode stuff, but a necessary step. Vnode mgmt should be correct, but things might still change, and there is still some missing stuff (like ioopt, and physical backing of non-merged cache files, debugging of layering concepts.)
* Fix procfs security hole -- check permissions on meaningful I/Os (namely,sef1997-08-121-1/+18
| | | | | | | reading/writing of mem and regs). Also have to check for the requesting process being group KMEM -- this is a bit of a hack, but ps et al need it. Reviewed by: davidg
* Removed unused #includes.bde1997-08-021-3/+1
|
* Fix both a problem with accessing backing objects, and also releasedyson1997-04-201-1/+14
| | | | | | the process map on nonexistant pages. PR: kern/3327 Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no>
* Fix the gdb executable modify problem. Thanks to the detective workdyson1997-04-061-80/+47
| | | | | | | | | | | | by Alan Cox <alc@cs.rice.edu>, and his description of the problem. The bug was primarily in procfs_mem, but the mistake likely happened due to the lack of vm system support for the operation. I added better support for selective marking of page dirty flags so that vm_map_pageable(wiring) will not cause this problem again. The code in procfs_mem is now less bogus (but maybe still a little so.)
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-6/+4
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Fix setting breakpoints in shared regions.dyson1996-10-241-7/+4
|
* Fix a serious problem, with a window where an object lock is needed,dyson1996-07-021-57/+97
| | | | | | but not there. The extent of the object lock is expanded to be over the range that it is needed. Additionally, clean up the code so that it conforms to better coding style.
* Properly lock the vm space when accessing the memory in a process. Thisdyson1996-06-111-2/+14
| | | | | fix could solve some "interesting" problems that could happen during process rundown.
* This time, really make the procfs work when reading stuff from the UPAGES.peter1996-01-251-15/+34
| | | | | | | | | | | | This is a really ugly bandaid on the problem, but it works well enough for 'ps -u' to start working again. The problem was caused by the user address space shrinking by a little bit and the UPAGES being "cast off" to become a seperate entity rather than being at the top of the process's vmspace. That optimization was part of John's most recent VM speedups. Now, rather than decoding the VM space, it merely ensures the pages are in core and accesses them the same way the ptrace(PT_READ_U..) code does, ie: off the p->p_addr pointer.
* Major fixes for procfs..peter1996-01-241-1/+10
| | | | | | | | | | | | | | | | Implement a "variable" directory structure. Files that do not make sense for the given process do not "appear" and cannot be opened. For example, "system" processes do not have "file", "regs" or "fpregs", because they do not have a user area. "attempt" to fill in the user area of a given process when it is being accessed via /proc/pid/mem (the user struct is just after VM_MAXUSER_ADDRESS in the process address space.) Dont do IO to the U area while it's swapped, hold it in place if possible. Lock off access to the "ctl" file if it's done a setuid like the other pseudo-files in there.
* Eliminated many redundant vm_map_lookup operations for vm_mmap.dyson1996-01-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish overhead for merged cache. Efficiency improvement for vfs_cluster. It used to do alot of redundant calls to cluster_rbuild. Correct the ordering for vrele of .text and release of credentials. Use the selective tlb update for 486/586/P6. Numerous fixes to the size of objects allocated for files. Additionally, fixes in the various pagers. Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs. Fixes in the swap pager for exhausted resources. The pageout code will not as readily thrash. Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE), thereby improving efficiency of several routines. Eliminate even more unnecessary vm_page_protect operations. Significantly speed up process forks. Make vm_object_page_clean more efficient, thereby eliminating the pause that happens every 30seconds. Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the case of filesystems mounted async. Fix a panic with busy pages when write clustering is done for non-VMIO buffers.
* Fixed 1TB filesize changes. Some pindexes had bogus names and typesbde1995-12-171-5/+5
| | | | but worked because vm_pindex_t is indistinuishable from vm_offset_t.
* Changes to support 1Tb filesizes. Pages are now named by andyson1995-12-111-3/+3
| | | | (object,index) pair instead of (object,offset) pair.
* Untangled the vm.h include file spaghetti.dg1995-12-071-1/+8
|
* Added prototypes.bde1995-12-031-1/+3
| | | | Removed some unnecessary #includes.
* Removal of unnecessary usage of PG_COPYONWRITE.dyson1995-10-231-2/+2
|
OpenPOWER on IntegriCloud