Hi, maybe someone can help me with this fundamental question: I noticed that I can't run gcore on apache children when running gcore with the same UID as apache:
h:w$ id uid=80(webservd) gid=80(webservd) h:w$ gcore 21731 gcore: cannot grab 21731: permission denied I've followed some of the gcore/procfs code and finally narrowed down the issue to the fact that Apache children have got SNOCD set in (proc_t)->p_flag: ~# ps -ef | grep httpd| head -2 root 21731 3056 0 21:00:10 ? 0:00 /usr/apache2/2.2/bin/httpd webservd 21739 21731 0 21:00:11 ? 0:00 /usr/apache2/2.2/bin/httpd > 0t21731::pid2proc | ::print proc_t p_flag p_flag = 0x42000400 > 0t21739::pid2proc | ::print proc_t p_flag p_flag = 0x52000000 http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/sys/proc.h#SNOCD 500 #define SNOCD 0x10000000 /* new creds from VSxID, do not coredump */ This is on a plain vanilla snv_111b apache2.2 Now I wonder: Why is this the case? I haven't found anything special in apache, except for the forkx(), setgid(80), initgroups(), setiud(80) sequence. Would anyone help me understand this? P.S.: Passing by gcore, I noticed that it probably doesn't need to open /proc/<pid>/as with O_RDWR, does it? diff -r c13e2db06244 usr/src/cmd/gcore/gcore.c --- a/usr/src/cmd/gcore/gcore.c Sun Jan 03 12:47:17 2010 -0800 +++ b/usr/src/cmd/gcore/gcore.c Fri Jan 15 21:28:17 2010 +0100 @@ -152,7 +152,7 @@ char *prefix = NULL; int opt; int opt_p = 0, opt_g = 0, opt_c = 0; - int oflags = 0; + int oflags = PGRAB_RDONLY; int i; char fname[MAXPATHLEN]; char path[MAXPATHLEN];