Re: truss

From: Garrett Cooper <yanegomi_at_gmail.com>
Date: Fri, 9 Sep 2011 21:04:08 -0700
On Sep 9, 2011, at 3:56 PM, Xin LI <delphij_at_delphij.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 08/31/11 07:35, Anton Yuzhaninov wrote:
>> It seems to be truss(1) is broken on current
>> 
>> :~> truss /bin/echo x x truss: can not get etype: No such process
>> 
>> FreeBSD 9.0-BETA1 #0 r224884M i386
>> 
>> from ktrace of turss
>> 
>> 3162 truss    CALL
>> __sysctl(0xbfbfea00,0x4,0xbfbfe9e0,0xbfbfea10,0,0) 3162 truss
>> SCTL  "kern.proc.sv_name.3163" 3162 truss    RET   __sysctl -1
>> errno 3 No such process
> 
> Can't seem to be reproducable here, did I missed anything?  (note that
> you may need a full world/kernel build).
> 
>> truss /bin/echo x
> mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 34366255104 (0x800637000)
> issetugid(0x800638015,0x80062cd9e,0x800848810,0x8008487e0,0xb277,0x0)
> = 0 (0x0)
> open("/etc/libmap.conf",O_RDONLY,0666)         = 3 (0x3)
> fstat(3,{ mode=-rw-r--r-- ,inode=1668471,size=712,blksize=4096 }) = 0
> (0x0)
> read(3,"libpthread.so.2\tlibthr.so.2\nli"...,4096) = 712 (0x2c8)
> read(3,0x80063b000,4096)             = 0 (0x0)
> close(3)                     = 0 (0x0)
> open("/var/run/ld-elf.so.hints",O_RDONLY,0160)     = 3 (0x3)
> read(3,"Ehnt\^A\0\0\0\M^_at_\0\0\0\M-\\^A\0"...,128) = 128 (0x80)
> lseek(3,0x80,SEEK_SET)                 = 128 (0x80)
> read(3,"/lib:/usr/lib:/usr/lib/compat:/u"...,476) = 476 (0x1dc)
> close(3)                     = 0 (0x0)
> mmap(0x0,36864,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 34366287872 (0x80063f000)
> access("/lib/libc.so.7",0)             = 0 (0x0)
> open("/lib/libc.so.7",O_RDONLY,040737600)     = 3 (0x3)
> fstat(3,{ mode=-r--r--r-- ,inode=2664100,size=1310888,blksize=131072
> }) = 0 (0x0)
> pread(0x3,0x80083af60,0x1000,0x0,0x101010101010101,0x8080808080808080)
> = 4096 (0x1000)
> mmap(0x0,3432448,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) =
> 34368425984 (0x800849000)
> mmap(0x800849000,1179648,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE,3,0x0)
> = 34368425984 (0x800849000)
> mmap(0x800b69000,45056,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED,3,0x120000)
> = 34371702784 (0x800b69000)
> mprotect(0x800b74000,110592,PROT_READ|PROT_WRITE) = 0 (0x0)
> close(3)                     = 0 (0x0)
> sysarch(0x81,0x7fffffffcfc0,0x80063d6c8,0x0,0xffffffffffad0580,0x800865370)
> = 0 (0x0)
> munmap(0x800642000,24576)             = 0 (0x0)
> mmap(0x0,102400,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 34366300160 (0x800642000)
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0)
> = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0)         = 0 (0x0)
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0)
> = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0)         = 0 (0x0)
> readlink("/etc/malloc.conf","aj",1024)         = 2 (0x2)
> issetugid(0x800945ba1,0x7fffffffd220,0x6a,0x0,0x2,0x2) = 0 (0x0)
> break(0x800000)                     = 0 (0x0)
> mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) =
> 34371858432 (0x800b8f000)
> mmap(0x800f8f000,462848,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0)
> = 34376052736 (0x800f8f000)
> munmap(0x800b8f000,462848)             = 0 (0x0)
> x
> writev(0x1,0x800c07040,0x2,0x7fffffffdad0,0x600d10,0x7fffffffcd60) = 2
> (0x2)
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0)
> = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0)         = 0 (0x0)
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0)
> = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0)         = 0 (0x0)
> process exit, rval = 0

Truss isn't broken for me this way either. It just doesn't detach from processes properly if I do ctrl c, which seems like a ptrace bug to me.

It would help to know how truss was compiled (file would be helpful), and what environment it's being executed in (32bit on 64bit, a chroot/jail, etc).
Thanks,
-Garrett
Received on Sat Sep 10 2011 - 02:04:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:17 UTC