diff options
Diffstat (limited to 'sys/miscfs')
| -rw-r--r-- | sys/miscfs/procfs/procfs_subr.c | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 9a874d5b9e8..49dd6c1a817 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: procfs_subr.c,v 1.58 2003/09/27 13:29:02 darcy Exp $ */ +/* $NetBSD: procfs_subr.c,v 1.59 2004/05/14 16:35:24 christos Exp $ */ /* * Copyright (c) 1993 @@ -73,7 +73,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.58 2003/09/27 13:29:02 darcy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.59 2004/05/14 16:35:24 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -299,9 +299,17 @@ procfs_rw(v) struct lwp *l; struct proc *p; + if (uio->uio_offset < 0) + return EINVAL; p = PFIND(pfs->pfs_pid); if (p == 0) - return (EINVAL); + return ESRCH; + /* + * Do not allow init to be modified while in secure mode; it + * could be duped into changing the security level. + */ + if (uio->uio_rw == UIO_WRITE && p == initproc && securelevel > -1) + return EPERM; /* XXX NJWLWP * The entire procfs interface needs work to be useful to @@ -311,26 +319,6 @@ procfs_rw(v) l = proc_representative_lwp(p); switch (pfs->pfs_type) { - case PFSregs: - case PFSfpregs: - case PFSmem: -#if defined(__HAVE_PROCFS_MACHDEP) && defined(PROCFS_MACHDEP_PROTECT_CASES) - PROCFS_MACHDEP_PROTECT_CASES -#endif - /* - * Do not allow init to be modified while in secure mode; it - * could be duped into changing the security level. - */ - if (uio->uio_rw == UIO_WRITE && - p == initproc && securelevel > -1) - return (EPERM); - break; - - default: - break; - } - - switch (pfs->pfs_type) { case PFSnote: case PFSnotepg: return (procfs_donote(curp, p, pfs, uio)); |
