Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Nov 1999 19:53:28 +0100
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        Warner Losh <imp@village.org>
Cc:        freebsd-current@freebsd.org, security@freebsd.org
Subject:   Re: ps on 4.0-current 
Message-ID:  <786.943556008@critter.freebsd.dk>
In-Reply-To: Your message of "Wed, 24 Nov 1999 01:01:33 MST." <199911240801.BAA19058@harmony.village.org> 

next in thread | previous in thread | raw e-mail | index | archive | help

As I've understood the conclusion of this thread, we want a 
sysctl, and we want it open as default.  This patch should
do that.

Once Warner nods in the vertical direction it will be committed.

Poul-Henning


Index: kern/kern_exec.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.103
diff -u -r1.103 kern_exec.c
--- kern_exec.c	1999/11/16 20:31:51	1.103
+++ kern_exec.c	1999/11/25 18:32:41
@@ -77,6 +77,9 @@
 SYSCTL_LONG(_kern, OID_AUTO, ps_arg_cache_limit, CTLFLAG_RW, 
     &ps_arg_cache_limit, "");
 
+int ps_argsopen = 1;
+SYSCTL_INT(_kern, OID_AUTO, ps_argsopen, CTLFLAG_RW, &ps_argsopen, 0, "");
+
 /*
  * Each of the items is a pointer to a `const struct execsw', hence the
  * double pointer here.
Index: kern/kern_proc.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_proc.c,v
retrieving revision 1.61
diff -u -r1.61 kern_proc.c
--- kern_proc.c	1999/11/21 19:03:09	1.61
+++ kern_proc.c	1999/11/25 18:31:51
@@ -633,7 +633,7 @@
 	if (!p)
 		return (0);
 
-	if (p_trespass(curproc, p))
+	if ((!ps_argsopen) && p_trespass(curproc, p))
 		return (0);
 
 	if (req->newptr && curproc != p)
Index: miscfs/procfs/procfs_status.c
===================================================================
RCS file: /home/ncvs/src/sys/miscfs/procfs/procfs_status.c,v
retrieving revision 1.18
diff -u -r1.18 procfs_status.c
--- procfs_status.c	1999/11/21 19:03:19	1.18
+++ procfs_status.c	1999/11/25 18:32:22
@@ -183,7 +183,7 @@
 	 * Linux behaviour is to return zero-length in this case.
 	 */
 
-	if (p->p_args && !p_trespass(curp, p)) {
+	if (p->p_args && (ps_argsopen || !p_trespass(curp, p))) {
 		bp = p->p_args->ar_args;
 		buflen = p->p_args->ar_length;
 		buf = 0;
Index: sys/proc.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/proc.h,v
retrieving revision 1.92
diff -u -r1.92 proc.h
--- proc.h	1999/11/21 19:03:20	1.92
+++ proc.h	1999/11/25 18:31:16
@@ -384,6 +384,7 @@
 extern int	whichidqs;	/* Bit mask summary of non-empty Q's. */
 
 extern	u_long ps_arg_cache_limit;
+extern	int ps_argsopen;
 
 struct proc *pfind __P((pid_t));	/* Find process by id. */
 struct pgrp *pgfind __P((pid_t));	/* Find process group by id. */

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."
FreeBSD -- It will take a long time before progress goes too far!


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?786.943556008>