From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,1169003c82980a7 X-Google-Attributes: gidfee84,public From: Jeff Denham Subject: Re: [Q] trace of set-uid program Date: 1999/08/11 Message-ID: <37B18973.39D285D9@allaire.com>#1/1 X-Deja-AN: 511458403 Content-Transfer-Encoding: 7bit References: X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@digex.net X-Trace: dca1-nnrp1.news.digex.net 934382009 207.86.119.34 (Wed, 11 Aug 1999 10:33:29 EDT) Organization: Allaire Corporation MIME-Version: 1.0 NNTP-Posting-Date: Wed, 11 Aug 1999 10:33:29 EDT Newsgroups: comp.unix.osf.osf1 "Kim, Hyunchul" wrote: > I'm writing an application which traces system calls of target processes. > > My problem is that when a target process do 'execve' to execute a set-uid > program > (with uid 0), the process comes to stop. > > Then, neither getting the status of the process with > 'ioctl(procfd, PIOCSTATUS, &prstatus)' > or making it running with > 'ioctl(procfd, PIOCRUN, NULL) > succeeds. > The 'errno' is EWOULDBLOCK(EAGAIN). > > Can I trace a root-set-uid program? > If I can, how can i do? You should get an error return from the PIOCWSTOP ioctl (the EAGAIN you're seeing -- same as EWOULDBLOCK). When this happens, you need to reopen the process again to get a new file descriptor and only then close the current and now invalid tracing fd. The process is actually stopped waiting for you to do this. If you just close in invalid fd, the setuid process will continue running detached from your trace. Hope I remember this correctly -- it's been a long time. It should have been in the man page for proc, which admittedly is pretty much a disaster. -- Jeff __________________________________________________ Jeff Denham (jdenham@allaire.com) Allaire Corp: Resource-management software for building and managing fast, reliable web sites See us at http://www.allaire.com and http://www.brighttiger.com 125 Nagog Park Acton, MA 01720 Phone: (978) 263-5455 x177 Fax: (978) 263-5547