Date: Fri, 9 Jun 2000 08:04:19 -0700 (PDT) From: billh@europe.yahoo-inc.com To: freebsd-gnats-submit@FreeBSD.org Subject: bin/19145: ps not annotatable in 4.0 Message-ID: <20000609150419.061C237C3E1@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 19145
>Category: bin
>Synopsis: ps not annotatable in 4.0
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jun 09 08:10:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Bill Hails
>Release: 4.0
>Organization:
Yahoo! Europe
>Environment:
FreeBSD pagegen7.europe.yahoo.com 4.0-YAHOO-20000510 FreeBSD 4.0-YAHOO-20000510 #0: Thu May 11 00:39:30 PDT 2000 root@fb40.yahoo.com:/home/src/sys/compile/YAHOO i386
>Description:
the kvm_getargv function returns the original argv passed to the
process, ignoring any changes that the process may have made to
ARGV, in conflict with the manual page.
>How-To-Repeat:
create this C program, call it getargv.c, and compile with
cc -O -pipe getargv.c -lkvm -o getargv
#include <fcntl.h>
#include <kvm.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
kvm_t *kd;
kd = kvm_open(NULL, "/dev/mem", NULL, O_RDONLY, "kvm_open:");
if (kd != NULL) {
int cnt;
struct kinfo_proc *p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &cnt);
if (p != NULL) {
int c;
for (c = 0; c < cnt; ++c) {
char **res = kvm_getargv(kd, p, 0);
if (res) {
while (*res) {
printf("%s ", *res);
res++;
}
printf("\n");
}
else break;
++p;
}
} else {
return(2);
}
kvm_close(kd);
} else {
return(1);
}
return(0);
}
then compile and run the following (call it argv0.c, "make argv0")
int main(int argc, char *argv[])
{
argv[0] = "test";
sleep(500);
return(0);
}
in another window run the already compiled getargv as root.
When I do this I see that the argv0 process has not had its
ARGV[0] changed
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000609150419.061C237C3E1>
