diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index e63a12bcbeb5..ee3380e6c021 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -183,7 +183,7 @@ procfs_docmdline(curp, p, pfs, uio) * 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; diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 900da01ac86f..d78f56299d62 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -77,6 +77,9 @@ u_long ps_arg_cache_limit = PAGE_SIZE / 16; 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. diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index e0f9ec104d27..356282eafbe1 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -633,7 +633,7 @@ sysctl_kern_proc_args SYSCTL_HANDLER_ARGS if (!p) return (0); - if (p_trespass(curproc, p)) + if ((!ps_argsopen) && p_trespass(curproc, p)) return (0); if (req->newptr && curproc != p) diff --git a/sys/miscfs/procfs/procfs_status.c b/sys/miscfs/procfs/procfs_status.c index e63a12bcbeb5..ee3380e6c021 100644 --- a/sys/miscfs/procfs/procfs_status.c +++ b/sys/miscfs/procfs/procfs_status.c @@ -183,7 +183,7 @@ procfs_docmdline(curp, p, pfs, uio) * 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; diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 6b1ae41e7b6a..bd68a739f0b8 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -384,6 +384,7 @@ extern int whichrtqs; /* Bit mask summary of non-empty Q's. */ 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. */