lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <EE928378561BF1449699C96571234A740FCE3760@SHSMSX102.ccr.corp.intel.com>
Date:	Wed, 11 Apr 2012 08:21:37 +0000
From:	"Tu, Xiaobing" <xiaobing.tu@...el.com>
To:	"'akpm@...ux-foundation.org'" <'akpm@...ux-foundation.org'>,
	"'mingo@...e.hu'" <'mingo@...e.hu'>,
	"'rusty@...tcorp.com.au'" <'rusty@...tcorp.com.au'>,
	"'a.p.zijlstra@...llo.nl'" <'a.p.zijlstra@...llo.nl'>,
	"'linux-kernel@...r.kernel.org'" <'linux-kernel@...r.kernel.org'>,
	"'yanmin_zhang@...ux.intel.com'" <'yanmin_zhang@...ux.intel.com'>,
	"'rostedt@...dmis.org'" <'rostedt@...dmis.org'>
CC:	"Zuo, Jiao" <jiao.zuo@...el.com>
Subject: [RFC 2/2] User space tool for dump user space stack

Resend as linux-kernel kicked it back.

From: Tu, Xiaobing 
Sent: Wednesday, April 11, 2012 4:07 PM
To: 'akpm@...ux-foundation.org'; 'mingo@...e.hu'; 'rusty@...tcorp.com.au'; 'a.p.zijlstra@...llo.nl'; 'linux-kernel@...r.kernel.org'; 'yanmin_zhang@...ux.intel.com'; 'rostedt@...dmis.org'
Cc: Zuo, Jiao
Subject: [RFC 2/2] User space tool for dump user space stack
Importance: High


Here is the a backtrace tool in user space which can dump all the stack for whole processes or a special process, it read kernel space and user space stack call chain from /proc/xxx/stack, and converts the hex format into symbols., we tested it on i386 and x86-64. It works well.

There are two function in this tool:
1. Parse special process we want, using “parse_stack –p 22740”
  pid : 22740, name: droid.apps.maps
  ppid: 0, name:  
  child count is 22
  
  Kernel Stack:
  [<c136e3df>] sys_epoll_wait+0x2bf/0x360
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ebb7]  /system/lib/libc.so
  [00000000b770cc98]  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv)
  [00000000b75e6f8f]  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEi)
  [00000000b75e6fc5]  /system/lib/libandroid_runtime.so (_ZN7androidL38android_os_MessageQueue_nativePollOnceEP7_JNIEnvP8_jobjectii)
  [00000000b632fc40]  /system/lib/libdvm.so (dvmPlatformInvoke)
  [00000000b637cf59]  /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aa9ca]  /system/lib/libdvm.so (_Z15dvmInvokeMethodP6ObjectPK6MethodP11ArrayObjectS5_P11ClassObjectb)
  [00000000b63bb46a]  /system/lib/libdvm.so (_ZL44Dalvik_java_lang_reflect_Method_invokeNativePKjP6JValue)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b637ee7a]  /system/lib/libdvm.so (_ZL21CallStaticVoidMethodVP7_JNIEnvP7_jclassP10_jmethodIDPc)
  [00000000b75b19da]  /system/lib/libandroid_runtime.so (_ZN7_JNIEnv20CallStaticVoidMethodEP7_jclassP10_jmethodIDz)
  [00000000b75b3004]  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcS2_)
  [00000000080491d7]  /system/bin/app_process (main)
  [00000000b778cc0e]  /system/lib/libc.so (__libc_init)
  [0000000008048c0a]  /system/bin/app_process
  
  
  
  =========
  tid : 22741, name: GC
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c1290d29>] futex_wait+0x5e9/0x8c0
  [<c1292dee>] do_futex+0xee/0xc60
  [<c12939fa>] sys_futex+0x9a/0x120
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ed1d]  /system/lib/libc.so
  [00000000b7786b49]  /system/lib/libc.so (__pthread_cond_timedwait_relative)
  [00000000b7786c94]  /system/lib/libc.so (__pthread_cond_timedwait)
  [00000000b7786d83]  /system/lib/libc.so (pthread_cond_timedwait)
  [00000000b7786dbc]  /system/lib/libc.so (pthread_cond_wait)
  [00000000b63cd3e0]  /system/lib/libdvm.so (_ZL14gcDaemonThreadPv)
  [00000000b6392bbf]  /system/lib/libdvm.so (_ZL19internalThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b773f2d0]   (__thread_entry)
  [00000000b7731f92]  /system/lib/libcutils.so (mspace_malloc)
  
  
  
  =========
  tid : 22744, name: Signal Catcher
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c126ad66>] sys_rt_sigtimedwait+0x106/0x430
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778e45f]  /system/lib/libc.so
  [00000000b638d0d4]  /system/lib/libdvm.so (_ZL24signalCatcherThreadStartPv)
  [00000000b6392bbf]  /system/lib/libdvm.so (_ZL19internalThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [0000000000000009]   (__thread_entry)
  
  
  
  =========
  tid : 22746, name: JDWP
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c184c65e>] unix_stream_recvmsg+0x39e/0x500
  [<c179d600>] sock_recvmsg+0xe0/0x110
  [<c179f086>] __sys_recvmsg+0xf6/0x1d0
  [<c179ff1c>] sys_socketcall+0x14c/0x4f0
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778e71b]  /system/lib/libc.so
  [00000000b63b313b]  /system/lib/libdvm.so (_ZL15jdwpThreadStartPv)
  [00000000b6392bbf]  /system/lib/libdvm.so (_ZL19internalThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b773f2d0]   (__thread_entry)
  [00000000b7731f92]  /system/lib/libcutils.so (mspace_malloc)
  
  
  
  =========
  tid : 22747, name: Compiler
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c1290d29>] futex_wait+0x5e9/0x8c0
  [<c1292dee>] do_futex+0xee/0xc60
  [<c12939fa>] sys_futex+0x9a/0x120
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ed1d]  /system/lib/libc.so
  [00000000b7786b49]  /system/lib/libc.so (__pthread_cond_timedwait_relative)
  [00000000b7786c94]  /system/lib/libc.so (__pthread_cond_timedwait)
  [00000000b7786d83]  /system/lib/libc.so (pthread_cond_timedwait)
  [00000000b7786dbc]  /system/lib/libc.so (pthread_cond_wait)
  [00000000b63cf079]  /system/lib/libdvm.so (_ZL19compilerThreadStartPv)
  [00000000b6392bbf]  /system/lib/libdvm.so (_ZL19internalThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b77326ee]  /system/lib/libcutils.so (mspace_calloc)
  [00000000b63cccc4]  /system/lib/libdvm.so (_Z18dvmHeapSourceAllocj)
  [00000000b2915440]   (_Z18dvmHeapSourceAllocj)
  
  
  
  =========
  tid : 22748, name: ReferenceQueueD
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c1290d29>] futex_wait+0x5e9/0x8c0
  [<c1292dee>] do_futex+0xee/0xc60
  [<c12939fa>] sys_futex+0x9a/0x120
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ed1d]  /system/lib/libc.so
  [00000000b7786b49]  /system/lib/libc.so (__pthread_cond_timedwait_relative)
  [00000000b7786c94]  /system/lib/libc.so (__pthread_cond_timedwait)
  [00000000b7786d83]  /system/lib/libc.so (pthread_cond_timedwait)
  [00000000b7786dbc]  /system/lib/libc.so (pthread_cond_wait)
  [00000000b638eb48]  /system/lib/libdvm.so (_ZL11waitMonitorP6ThreadP7Monitorxib)
  [00000000b63b8eb4]  /system/lib/libdvm.so (_ZL28Dalvik_java_lang_Object_waitPKjP6JValuePK6MethodP6Thread)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b63aaef2]  /system/lib/libdvm.so (_Z13dvmCallMethodP6ThreadPK6MethodP6ObjectP6JValuez)
  [00000000b639242a]  /system/lib/libdvm.so (_ZL17interpThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b633dc12]  /system/lib/libdvm.so (_Z9dvmMallocji)
  [00000000b63bb46a]  /system/lib/libdvm.so (_ZL44Dalvik_java_lang_reflect_Method_invokeNativePKjP6JValue)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b637ee7a]  /system/lib/libdvm.so (_ZL21CallStaticVoidMethodVP7_JNIEnvP7_jclassP10_jmethodIDPc)
  [00000000b75b19da]  /system/lib/libandroid_runtime.so (_ZN7_JNIEnv20CallStaticVoidMethodEP7_jclassP10_jmethodIDz)
  [00000000b75b3004]  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcS2_)
  [00000000080491d7]  /system/bin/app_process (main)
  [00000000b778cc0e]  /system/lib/libc.so (__libc_init)
  [0000000008048c0a]  /system/bin/app_process
  
  
  
  =========
  tid : 22750, name: FinalizerDaemon
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c1290d29>] futex_wait+0x5e9/0x8c0
  [<c1292dee>] do_futex+0xee/0xc60
  [<c12939fa>] sys_futex+0x9a/0x120
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ed1d]  /system/lib/libc.so
  [00000000b7786b49]  /system/lib/libc.so (__pthread_cond_timedwait_relative)
  [00000000b7786c94]  /system/lib/libc.so (__pthread_cond_timedwait)
  [00000000b7786d83]  /system/lib/libc.so (pthread_cond_timedwait)
  [00000000b7786dbc]  /system/lib/libc.so (pthread_cond_wait)
  [00000000b638eb48]  /system/lib/libdvm.so (_ZL11waitMonitorP6ThreadP7Monitorxib)
  [00000000b63b8eb4]  /system/lib/libdvm.so (_ZL28Dalvik_java_lang_Object_waitPKjP6JValuePK6MethodP6Thread)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b63aaef2]  /system/lib/libdvm.so (_Z13dvmCallMethodP6ThreadPK6MethodP6ObjectP6JValuez)
  [00000000b639242a]  /system/lib/libdvm.so (_ZL17interpThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b633dc12]  /system/lib/libdvm.so (_Z9dvmMallocji)
  [00000000b63bb46a]  /system/lib/libdvm.so (_ZL44Dalvik_java_lang_reflect_Method_invokeNativePKjP6JValue)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b637ee7a]  /system/lib/libdvm.so (_ZL21CallStaticVoidMethodVP7_JNIEnvP7_jclassP10_jmethodIDPc)
  [00000000b75b19da]  /system/lib/libandroid_runtime.so (_ZN7_JNIEnv20CallStaticVoidMethodEP7_jclassP10_jmethodIDz)
  [00000000b75b3004]  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcS2_)
  [00000000080491d7]  /system/bin/app_process (main)
  [00000000b778cc0e]  /system/lib/libc.so (__libc_init)
  [0000000008048c0a]  /system/bin/app_process
  
  
  
  =========
  tid : 22751, name: FinalizerWatchd
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c1290d29>] futex_wait+0x5e9/0x8c0
  [<c1292dee>] do_futex+0xee/0xc60
  [<c12939fa>] sys_futex+0x9a/0x120
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ed1d]  /system/lib/libc.so
  [00000000b7786b49]  /system/lib/libc.so (__pthread_cond_timedwait_relative)
  [00000000b7786c94]  /system/lib/libc.so (__pthread_cond_timedwait)
  [00000000b7786d43]  /system/lib/libc.so (pthread_cond_timedwait_monotonic)
  [00000000b638eacb]  /system/lib/libdvm.so (_ZL11waitMonitorP6ThreadP7Monitorxib)
  [00000000b638ec1f]  /system/lib/libdvm.so (_Z14dvmThreadSleepyj)
  [00000000b63b9d7e]  /system/lib/libdvm.so (_ZL31Dalvik_java_lang_VMThread_sleepPKjP6JValue)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b63aaef2]  /system/lib/libdvm.so (_Z13dvmCallMethodP6ThreadPK6MethodP6ObjectP6JValuez)
  [00000000b639242a]  /system/lib/libdvm.so (_ZL17interpThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b633dc12]  /system/lib/libdvm.so (_Z9dvmMallocji)
  [00000000b63bb46a]  /system/lib/libdvm.so (_ZL44Dalvik_java_lang_reflect_Method_invokeNativePKjP6JValue)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b637ee7a]  /system/lib/libdvm.so (_ZL21CallStaticVoidMethodVP7_JNIEnvP7_jclassP10_jmethodIDPc)
  [00000000b75b19da]  /system/lib/libandroid_runtime.so (_ZN7_JNIEnv20CallStaticVoidMethodEP7_jclassP10_jmethodIDz)
  [00000000b75b3004]  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcS2_)
  [00000000080491d7]  /system/bin/app_process (main)
  [00000000b778cc0e]  /system/lib/libc.so (__libc_init)
  [0000000008048c0a]  /system/bin/app_process
  
  
  
  =========
  tid : 22752, name: Binder Thread #
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c16afcf8>] binder_thread_read+0x9b8/0xc60
  [<c16b43c1>] binder_ioctl+0x331/0x6b0
  [<c133f966>] do_vfs_ioctl+0x86/0x660
  [<c133ff7e>] sys_ioctl+0x3e/0x70
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778d776]  /system/lib/libc.so
  [00000000b7698d60]  /system/lib/libbinder.so (_ZN7android14IPCThreadState14talkWithDriverEb)
  [00000000b7699e3c]  /system/lib/libbinder.so (_ZN7android14IPCThreadState14joinThreadPoolEb)
  [00000000b76a4dd0]  /system/lib/libbinder.so (_ZN7android10PoolThread10threadLoopEv)
  [00000000b76ff954]  /system/lib/libutils.so (_ZN7android6Thread11_threadLoopEPv)
  [00000000b75b1870]  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime15javaThreadShellEPv)
  [00000000b770044e]  /system/lib/libutils.so (_ZN13thread_data_t10trampolineEPKS_)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [00000000b2915590]   (__thread_entry)
  
  
  =========
  tid : 22759, name: its
  ppid: 22740, name: droid.apps.maps
  Kernel Stack:
  [<c136e3df>] sys_epoll_wait+0x2bf/0x360
  [<c18d6ad1>] syscall_call+0x7/0xb
  [<ffffffff>] 0xffffffff
  User Stack:
  [00000000b778ebb7]  /system/lib/libc.so
  [00000000b770cc98]  /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv)
  [00000000b75e6f8f]  /system/lib/libandroid_runtime.so (_ZN7android18NativeMessageQueue8pollOnceEi)
  [00000000b75e6fc5]  /system/lib/libandroid_runtime.so (_ZN7androidL38android_os_MessageQueue_nativePollOnceEP7_JNIEnvP8_jobjectii)
  [00000000b632fc40]  /system/lib/libdvm.so (dvmPlatformInvoke)
  [00000000b637cf59]  /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)
  [00000000b6424214]  /system/lib/libdvm.so
  [00000000b6341f86]  /system/lib/libdvm.so (_Z11dvmMterpStdP6Thread)
  [00000000b633e626]  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
  [00000000b63aad32]  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValuePc)
  [00000000b63aaef2]  /system/lib/libdvm.so (_Z13dvmCallMethodP6ThreadPK6MethodP6ObjectP6JValuez)
  [00000000b639242a]  /system/lib/libdvm.so (_ZL17interpThreadStartPv)
  [00000000b77875a2]  /system/lib/libc.so (__thread_entry)
  [0000000000001d49]   (__thread_entry)
  
  

2. Parse stack for all the processes, using “parse_stack”
Attachment is the file store the stack info.

Br
XiaoBing Tu
PSI@...tem Integration Shanghai



Download attachment "parse_stack_upstream.tar.gz" of type "application/x-gzip" (7889 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ