iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.4k stars 3.86k forks source link

memleak -p PID could not determine address of symbol valloc #2947

Closed b-ripper closed 4 years ago

b-ripper commented 4 years ago

root@localhost:/# memleak -p $(pidof android.hardware.camera.provider@2.4-service_64) Attaching to pid 712, Ctrl+C to quit. Traceback (most recent call last): File "/usr/share/bcc/tools/memleak", line 437, in attach_probes("valloc") File "/usr/share/bcc/tools/memleak", line 423, in attach_probes pid=pid) File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 1012, in attach_uprobe (path, addr) = BPF._check_path_symbol(name, sym, addr, pid) File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 752, in _check_path_symbol raise Exception("could not determine address of symbol %s" % symname) Exception: could not determine address of symbol valloc

yonghong-song commented 4 years ago

Could you help check whether "valloc" is in your libc library or not? If not, could you submit a pull request like

diff --git a/tools/memleak.py b/tools/memleak.py
index 53990194..dc3883d8 100755
--- a/tools/memleak.py
+++ b/tools/memleak.py
@@ -434,7 +434,7 @@ if not kernel_trace:
         attach_probes("calloc")
         attach_probes("realloc")
         attach_probes("posix_memalign")
-        attach_probes("valloc")
+        attach_probes("valloc", can_fail=True) # comments on why
         attach_probes("memalign")
         attach_probes("pvalloc")
         attach_probes("aligned_alloc", can_fail=True)  # added in C11
devidasjadhav commented 4 years ago

Are you using Android ? guessed due to process name if yes mostly native apps symbols are stripped in android. try aarch64-linux-android-objdump --syms refer this stackoverflow answer to avoid stripping symbols. check ndk-stack for more details.

b-ripper commented 4 years ago

could you help to have a look? @michalgr @joelagnel very thanks!

michalgr commented 4 years ago

I pulled libc.so from Pixel4 and checked which allocation functions are not defined. valloc and pvalloc are both not available, we should do what @yonghong-song proposed x2. @b-ripper do you want to prepare a pull request ?

b-ripper commented 4 years ago

@michalgr @yonghong-song

2998 please help to review, very thanks!