Re: truss crashing process

2011-07-27 Thread Dan Nelson
In the last episode (Jul 27), Alexander Best said:
 hi there,
 
 i was trying to attach truss to chromium via
 
 'truss -p 18445' and got:
 
 [...]
 kevent(26,{},0,{0x1b,EVFILT_READ,0x0,0,0x1,0x44cb600 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0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,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,!
 0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,!
 0x0,0x0,
 -- UNKNOWN SYSCALL -14720592 --
 write(-14720976,0x8080808080808000,0)  = 41 (0x29)
 select(94,0x6acd,{0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 
 23 24 25 26 27 28 29 30 31 40 41 42 43 44 45 46 70 71 72 73 76 77 78 79 80 81 
 82 84 87 88 91},0x1,{0.85048848 }) = 73 (0x49)
 -- UNKNOWN SYSCALL 303120384 --
 #94(0x0,0x0,0x5e,0xb6cd600,0x83ed780,0x3dae410)= 189 (0xbd)
 truss: Cannot malloc -14740096 bytes for fd_set array: Cannot allocate memory

Invalid syscalls numbers like that usually mean that truss has attached to a
process in the middle of a syscall.  The ptrace API fires the same event for
syscall enter and exit, so if truss is expecting an enter and gets an exit,
you get a mangled syscall number and eventually truss will coredump trying
to decode incorrect data.

Try applying the patch at https://www.evoy.net/FreeBSD/truss.diff , which
amongst other things, fixes this problem.  If you just want the syscall fix,
search the diff for 50-50 chance and manually patch that if(){} block in
your source.

-- 
Dan Nelson
dnel...@allantgroup.com

___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org


Re: truss crashing process

2011-07-27 Thread Kostik Belousov
On Wed, Jul 27, 2011 at 11:35:49AM -0500, Dan Nelson wrote:
 In the last episode (Jul 27), Alexander Best said:
  hi there,
  
  i was trying to attach truss to chromium via
  
  'truss -p 18445' and got:
  
  [...]
  kevent(26,{},0,{0x1b,EVFILT_READ,0x0,0,0x1,0x44cb600 0x0,0x0,0x0,0,0x0,0x0 
  0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
  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9 10 11 12 13 14 15 16 17 18 19 20 21 
  22 23 24 25 26 27 28 29 30 31 40 41 42 43 44 45 46 70 71 72 73 76 77 78 79 
  80 81 82 84 87 88 91},0x1,{0.85048848 }) = 73 (0x49)
  -- UNKNOWN SYSCALL 303120384 --
  #94(0x0,0x0,0x5e,0xb6cd600,0x83ed780,0x3dae410)  = 189 (0xbd)
  truss: Cannot malloc -14740096 bytes for fd_set array: Cannot allocate 
  memory
 
 Invalid syscalls numbers like that usually mean that truss has attached to a
 process in the middle of a syscall.  The ptrace API fires the same event for
 syscall enter and exit, so if truss is expecting an enter and gets an exit,
 you get a mangled syscall number and eventually truss will coredump trying
 to decode incorrect data.
 
 Try applying the patch at https://www.evoy.net/FreeBSD/truss.diff , which
 amongst other things, fixes this problem.  If you just want the syscall fix,
 search the diff for 50-50 chance and manually patch that if(){} block in
 your source.

We have PL_FLAG_SCE/PL_FLAG_SCX for some time. I planned to update truss
to use the flags, as well as to take advantage of PL_FLAG_FORKED to close
the race where truss can miss the forked child.

Unfortunately, the project stalled.


pgpl5z6RehkLM.pgp
Description: PGP signature


truss crashing process

2011-07-26 Thread Alexander Best
hi there,

i was trying to attach truss to chromium via

'truss -p 18445' and got:

[...]
kevent(26,{},0,{0x1b,EVFILT_READ,0x0,0,0x1,0x44cb600 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 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x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0 0x0,0x0,0x0,0,0x0,0x0 
0x0,0x0,0x0,0,0x0,0x0},64,{9.469312000 }) = 116 (0x74)
-- UNKNOWN SYSCALL -14720592 --
write(-14720976,0x8080808080808000,0)= 41 (0x29)
select(94,0x6acd,{0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
24 25 26 27 28 29 30 31 40 41 42 43 44 45 46 70 71 72 73 76 77 78 79 80 81 82 
84 87 88 91},0x1,{0.85048848 }) = 73 (0x49)
-- UNKNOWN SYSCALL 303120384 --
#94(0x0,0x0,0x5e,0xb6cd600,0x83ed780,0x3dae410)  = 189 (0xbd)
truss: Cannot malloc -14740096 bytes for fd_set array: Cannot allocate memory

... this is 100% reproducable, if i wait long enough. this will crash truss
along with chromium.

using '-f' in addition to the flags above gives me:

[...]
truss: Cannot malloc -4220992 bytes for fd_set array: Cannot allocate memory
otaku% truss: can not attach to target process: No such process

strange thing though, when i redirect the first command via ' bla 21', truss
leaves behind a core file, because it segfaults. without redirecting the
output, no core file gets created, because truss doesn't segfault.

cheers.
alex
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to freebsd-current-unsubscr...@freebsd.org