Commit Graph

44 Commits

Author SHA1 Message Date
jdolecek b1fc5ffac3 procfs_allocvp():
* do not set *vpp unless successful, otherwise we'd trigger
    DIAGNOSTIC panic in lookup(9) on error return
  * on error, make sure to free malloc'ed memory and ungetnewvnode() the
    previously acquired vnode

this fixes panic on 'tail -f <file> &; ls -l /proc/$!/fd' reported by
Andrew Brown

fix reviewed by Christos Zoulas
2003-02-03 22:27:42 +00:00
thorpej b78f59b443 Merge the nathanw_sa branch. 2003-01-18 08:51:40 +00:00
christos dbe6c38bc2 Implement /proc/<pid>/fd/<n>. This is work in progress. Questionable things:
- Is it ok to convert DTYPE_PIPE to VFIFO and DTYPE_SOCKET to VSOCK?
    - XXX: Avoid locking issue in ls -Rl /proc by avoiding curproc
    - Does I/O to pipes work?
    - XXX: Are there security implications?
2003-01-03 13:21:17 +00:00
thorpej ec2b09dc84 Fix a signed/unsigned comparison warning. 2002-11-07 08:21:36 +00:00
thorpej 03efee5585 * Allow machine-dependent code to specify hooks for ptrace(2)
(__HAVE_PTRACE_MACHDEP) and procfs (__HAVE_PROCFS_MACHDEP).
  These changes will allow platforms like x86 (XMM) and PowerPC
  (AltiVec) to export extended register sets in a sane manner.

* Use __HAVE_PTRACE_MACHDEP to export x86 XMM registers (standard
  FP + SSE/SSE2) using PT_{GET,SET}XMMREGS (in the machdep
  ptrace request space).
* Use __HAVE_PROCFS_MACHDEP to export x86 XMM registers via
  /proc/N/xmmregs in procfs.
2001-12-05 00:58:05 +00:00
lukem e4b00f433c add RCSIDs 2001-11-10 13:33:40 +00:00
chs adf5d360a7 add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl.  file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value.  the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
2001-09-15 16:12:54 +00:00
fvdl 2e64bebd3b For -o linux mounts, add some code to emulate /proc/#/maps.
Needs NAMECACHE_ENTER_REVERSE to include filenames.
2001-03-29 22:41:52 +00:00
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +00:00
fvdl 4e000b75b2 Add a few linux-style files, only enabled when -o linux is specified
for the mount. Currently these are /proc/cpuinfo and /proc/meminfo.
The former only does something on i386 right now.
2001-01-17 00:09:07 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
chs b0ec16cc38 remove dead code and other misc cleanup. 2000-11-24 18:58:37 +00:00
ad 642267bcc7 Update for hashinit() change. 2000-11-08 14:28:12 +00:00
jdolecek 89015c4648 Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.
2000-03-16 18:08:17 +00:00
fvdl bb4e324508 Fix pasto: some lines of the procfs hash code were copied from the
UFS code, and I forgot to rename the "ihash" variable, causing
weird effects, because 3/4th of the UFS hash table would become
unreachable after procfs was loaded as an LKM.
2000-02-25 22:33:43 +00:00
fvdl 15bb1bd145 At mount/unmount time, add an exec hook to revoke all vnodes iff the
process is about to exec a sugid binary.

To speed up things, use hashing for vnode allocation, like other filesystems
do. This avoids walking the whole procfs node list in the revoke case too.
2000-01-25 21:52:04 +00:00
thorpej 8772062270 Make /proc/self a symlink to /proc/curproc. I've observed Linux programs
that expect /proc/self/cmdline to exist.
1999-09-02 23:33:45 +00:00
wrstuden 9fc36d6807 Bump osrelease to 1.4E. Add layerfs files, remove null_subr.c.
Update coda to new struct lock in struct vnode.

make fdescfs, kernfs, portalfs, and procfs actually lock their vnodes.
It's not that hard.

Make unionfs set v_vnlock = NULL so any overlayed fs will call its
VOP_LOCK.
1999-07-08 01:26:21 +00:00
christos 8aa2fc5ab8 PR/7143: Jaromir Docelek: Add procfs/cmdline from Linux emulation 1999-03-12 18:45:40 +00:00
msaitoh ea669760d6 Add /proc/#/map. From FreeBSD. 1999-01-25 02:20:08 +00:00
perry 4522c799a1 bzero->memset, bcopy->memcpy, bcmp->memcmp 1998-08-09 20:51:08 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
mycroft d24c4d31e1 Make the curproc link executable. 1997-10-30 09:14:07 +00:00
explorer 945beb8d63 Move procfs_checkioperm() from procvs_subr.c to procfs_mem.c, since _subr is
not included in a kernel without procfs, and it seems wrong to pull
all of procfs_subr.c in for just that one function.  Perhaps this
should go into a new file instead?
1997-08-13 04:01:22 +00:00
thorpej f9777e4a1c Fix the procfs hole described on current-users, similar to a fix for
FreeBSD by Sean Eric Fagan, but a bit different.  This makes the checks
in the same places as sef's FreeBSD patch, but does not hardcode the
"kmem" group into the kernel, and also does a check identical to the
(3) and (4) checks in the NetBSD ptrace(2):

	(1) it's not owned by you, or is set-id on exec (unless
	    you're root), or

	(2) it's init, which controls the security level of the
	    entire system, and the system was not compiled with
	    permanently insecure mode turned on.
1997-08-12 22:47:18 +00:00
mycroft 2ee8bc2b79 Don't allow writes to init's memory or registers while in secure mode. 1997-06-25 11:32:15 +00:00
mycroft 4d213ec5e7 Need stat.h. 1997-05-05 07:34:09 +00:00
mycroft 1e3c14a909 Eliminate bogus uses of V{READ,WRITE,EXEC}. Use S_I[RWX]{USR,GRP,OTH} where
appropriate.
1997-05-05 07:13:57 +00:00
cgd eaa37ec87a remove bogus cast of second arg to bcmp(). (nm_name is a const char*,
and was being unnecessarily cast to 'char *'; -Wcast-qual.)
1996-10-25 21:52:02 +00:00
christos 19dc07be15 close PR/2063: procfs_rw prototyped twice with different prototypes 1996-02-12 15:01:41 +00:00
christos 631ccba638 miscfs prototype changes 1996-02-09 22:39:56 +00:00
cgd cf92afd66e New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:29:24 +00:00
mycroft 117527f322 Minor update from JSP after merging my changes. 1994-06-15 22:54:38 +00:00
mycroft cde1d47595 Update to 4.4-Lite fs code, with local changes. 1994-06-08 11:33:09 +00:00
cgd d071d1cf05 some prototype cleanup, eliminate/replace bogus types (e.g. quad and
u_quad) -> use better types (e.g. quad_t & u_quad_t in inodes),
some cleanup.
1994-04-25 03:49:27 +00:00
cgd 89a86e618e make a fpregs file. 1994-01-28 07:03:16 +00:00
ws 2cee3e073f Make procfs really work for debugging.
Implement not & notepg files in procfs.
1994-01-20 21:22:47 +00:00
mycroft c4f31d72f8 Add a missing break so my machine doesn't panic. 1994-01-10 04:58:14 +00:00
ws 6202bab2db Bug fixes and enhancements:
Make NFS serving work (BUT DON'T USE "attach" TO /proc/*/ctl FOR NOW!!!)
Make `curproc' a symbolic link
Add `.' and `..' entries to the directories.
Return better guesses on the size of the files.
1994-01-09 19:44:03 +00:00
cgd 699e3be9e9 add new procfs code, from Jan-Simon Pendry, jsp@sequent.com.
This is pretty-much "virgin", so that diffs can be done later.
1994-01-05 07:51:08 +00:00
mycroft 0560892d34 Canonicalize all #includes. 1993-12-18 03:48:27 +00:00
pk 834a44f21f copyright update. 1993-08-24 16:47:23 +00:00
pk 0cbe77737a Rcs Id added. 1993-08-24 16:25:07 +00:00
pk 498189f379 Initial version of a proc filesystem. 1993-08-24 12:59:09 +00:00