summaryrefslogtreecommitdiffstats
path: root/sys/fs/procfs/procfs_vnops.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2001-08-03 17:13:23 +0000
committerrwatson <rwatson@FreeBSD.org>2001-08-03 17:13:23 +0000
commit306deb3ae64a7b3bda52edfb1a7f2a7e07bcaf64 (patch)
tree1abd51215e71878e79072bda55872ad61797243b /sys/fs/procfs/procfs_vnops.c
parentd1c0c6ac55e9d99774df06abe975b12fa1ee5b84 (diff)
downloadFreeBSD-src-306deb3ae64a7b3bda52edfb1a7f2a7e07bcaf64.zip
FreeBSD-src-306deb3ae64a7b3bda52edfb1a7f2a7e07bcaf64.tar.gz
Prior to support for almost all ps activity via sysctl, ps used procfs,
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
Diffstat (limited to 'sys/fs/procfs/procfs_vnops.c')
-rw-r--r--sys/fs/procfs/procfs_vnops.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c
index bc280c78..9efe6d66 100644
--- a/sys/fs/procfs/procfs_vnops.c
+++ b/sys/fs/procfs/procfs_vnops.c
@@ -157,10 +157,9 @@ procfs_open(ap)
}
p1 = ap->a_p;
- if (p_candebug(p1, p2) &&
- !procfs_kmemaccess(p1)) {
- error = EPERM;
- }
+ error = p_candebug(p1, p2);
+ if (error)
+ return (error);
if (ap->a_mode & FWRITE)
pfs->pfs_flags = ap->a_mode & (FWRITE|O_EXCL);
@@ -456,7 +455,6 @@ procfs_getattr(ap)
((VREAD|VWRITE)>>6));
break;
case Pmem:
- /* Retain group kmem readablity. */
PROC_LOCK(procp);
if (procp->p_flag & P_SUGID)
vap->va_mode &= ~(VREAD|VWRITE);
@@ -528,6 +526,8 @@ procfs_getattr(ap)
* If we denied owner access earlier, then we have to
* change the owner to root - otherwise 'ps' and friends
* will break even though they are setgid kmem. *SIGH*
+ * XXX: ps and friends are no longer setgid kmem, why
+ * is this needed?
*/
PROC_LOCK(procp);
if (procp->p_flag & P_SUGID)
@@ -535,7 +535,6 @@ procfs_getattr(ap)
else
vap->va_uid = procp->p_ucred->cr_uid;
PROC_UNLOCK(procp);
- vap->va_gid = KMEM_GROUP;
break;
case Pregs:
OpenPOWER on IntegriCloud