From owner-freebsd-current Thu Nov 25 11:42:50 1999 Delivered-To: freebsd-current@freebsd.org Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.40.131]) by hub.freebsd.org (Postfix) with ESMTP id B515114C86; Thu, 25 Nov 1999 11:42:40 -0800 (PST) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.9.3/8.9.2) with ESMTP id TAA00788; Thu, 25 Nov 1999 19:53:28 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Warner Losh Cc: freebsd-current@freebsd.org, security@freebsd.org Subject: Re: ps on 4.0-current In-reply-to: Your message of "Wed, 24 Nov 1999 01:01:33 MST." <199911240801.BAA19058@harmony.village.org> Date: Thu, 25 Nov 1999 19:53:28 +0100 Message-ID: <786.943556008@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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-current" in the body of the message