joelagnel / adeb Goto Github PK
View Code? Open in Web Editor NEWA debian-based shell environment designed for Android and adb
License: Apache License 2.0
A debian-based shell environment designed for Android and adb
License: Apache License 2.0
I'm trying adeb on a Pixel4, Android 10. There's a root directory named /apex
. It's not mounted. Indeed this code isn't mounting it: https://github.com/joelagnel/adeb/blob/master/addons/run.common . I made a naive attempt at copying what's done for the other directories with mount --bind
. That gave me a /apex with the right sub-directories inside it, but these subdirectories were all empty.
Hi there, a little error I got when I tried to upgrade from debian buster (now superseded by bullseye).
$ git clone https://github.com/joelagnel/adeb.git
$ cd adeb
$ ./adeb prepare
> ./adeb
15:09:33 - INFO : USAGE:
15:09:33 - INFO : adeb
15:09:33 - INFO : shell Enter the androdeb shell environment and get to work!
15:09:33 - INFO : remove Remove androdeb from the device
15:09:33 - INFO : git-pull Git pull androdeb to update it on your host
15:09:33 - INFO : pull Copy files from the androdeb filesystem in the device
15:09:33 - INFO : push Copy files to the androdeb filesystem in the device
15:09:33 - INFO :
15:09:33 - INFO : prepare Prepare the device (when running for the first time)
15:09:33 - INFO : By default, this will download and install a base image.
15:09:33 - INFO : ** Folowing are the prepare options **
15:09:33 - INFO : --full Pass this to prepare to download and install the full image which
15:09:33 - INFO : contains compilers, editors, tracers etc.
15:09:33 - INFO :
15:09:33 - INFO : --build Instead of download, build and install the image onto the device
15:09:33 - INFO :
15:09:33 - INFO : --archive Use archive for root fs (overrides all other prepare options)
15:09:33 - INFO :
15:09:33 - INFO : --buildtar While preparing, also build a tar.gz.zip file of the filesystem,
15:09:33 - INFO : this is how images that are downloaded by prepare are built
15:09:33 - INFO :
15:09:33 - INFO : --build-image Build an ext4 .img with the base image and BCC (useful for Qemu)
15:09:33 - INFO :
15:09:33 - INFO : ** Folowing are misc build options **
15:09:33 - INFO : --tempdir Use a specific temporary directory for build operation
15:09:33 - INFO : --arch Specify an ARCH to build for (default arm64)
15:09:33 - INFO : --distro Debian distro to base on (default is buster)
[snip]
$ ./adeb prepare --distro bullseye
15:09:06 - ERROR : Unknown option (--distro)
This was in order to get the latest version of bpftrace
which should contain a fix for bpftrace/bpftrace#515.
Hi,
I am trying to get adeb-BCC working on a Hikey970 android platform. This has 4.9 kernel flashed. I got the BCC compiled in adeb environment.
I built the kernel with required configurations enabled in kernel as per the page https://github.com/joelagnel/adeb/blob/master/BCC.md. I made sure CONFIG_BPF_SYSCALL is enabled by putting a kernel print.
But, any BCC tool I use including hello_world.py complains that CONFIG_BPF_SYSCALL is not enabled. Below is detailed log. Any pointers would be of great help !
root@localhost:/# /usr/share/bcc/examples/hello_world.py
In file included from :3:
/virtual/include/bcc/helpers.h:26:2: error: "CONFIG_BPF_SYSCALL is undefined, please check your .config or ask your Linux distro to enable this feature"
#error "CONFIG_BPF_SYSCALL is undefined, please check your .config or ask your Linux distro to enable this feature"
^
1 error generated.
Traceback (most recent call last):
File "/usr/share/bcc/examples/hello_world.py", line 12, in
BPF(text='int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\n"); return 0; }').trace_print()
File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 318, in init
raise Exception("Failed to compile BPF text")
Exception: Failed to compile BPF text
root@localhost:/#
I have support adeb on my arm64 android device,i just run " adeb prepare --full",and then
the adeb runs perfect on the arm64 android device.Adeb is so powerful for debugging.
And then I want to support adeb on my arm32 platform,so i try to "adeb prepare --arch armel --build --bcc --kernelsrc /path/to/kernel-source/", but i got failed when build bcc,the the error message as follow:
"""
[ 90%] Building CXX object tests/cc/CMakeFiles/test_libbcc.dir/test_shared_table.cc.o
In file included from /bcc-master/tests/cc/test_shared_table.cc:17:
In file included from /bcc-master/src/cc/api/BPF.h:25:
In file included from /bcc-master/src/cc/api/BPFTable.h:30:
In file included from /bcc-master/src/cc/bcc_syms.h:24:
/bcc-master/src/cc/libbpf/include/uapi/linux/bpf.h:3405:1: warning: struct has size 0 in C, size 1 in C++ [-Wextern-c-compat]
struct bpf_raw_tracepoint_args {
^
1 warning generated.
[ 90%] Building CXX object tests/cc/CMakeFiles/test_libbcc.dir/test_usdt_args.cc.o
/usr/bin/ld: ../../src/cc/frontends/clang/libclang_frontend.a(loader.cc.o): in function ebpf::ClangLoader::do_compile(std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >*, ebpf::TableStorage&, bool, std::vector<char const*, std::allocator<char const*> > const&, std::vector<char const*, std::allocator<char const*> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ebpf::FuncSource&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<int, std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, int, int>, std::less<int>, std::allocator<std::pair<int const, std::tuple<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int, int, int, int> > > >&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > >&)': loader.cc:(.text+0x2688): undefined reference to
__atomic_fetch_sub_4'
/usr/bin/ld: loader.cc:(.text+0x2cf4): undefined reference to __atomic_fetch_add_4' /usr/bin/ld: loader.cc:(.text+0x2d44): undefined reference to
__atomic_fetch_add_4'
/usr/bin/ld: loader.cc:(.text+0x316c): undefined reference to __atomic_fetch_add_4' /usr/bin/ld: loader.cc:(.text+0x31bc): undefined reference to
__atomic_fetch_add_4'
/usr/bin/ld: loader.cc:(.text+0x3618): undefined reference to `__atomic_fetch_add_4'
"""
And then i tried to build arm64 bcc by myself, runs "adeb prepare --arch arm64 --build --bcc --kernelsrc /path/to/kernel-source/" on the arm64 device, and the bcc built successful and the adeb works well.
So, i guess the bcc maybe not support arm architecture.
Ask for your help that the adeb support arm architeture,and i could get adeb for arm32 device by running "adeb prepare --full --arch armel".
Waiting for your good news
Can we support to access the remote Android device via ip address?
Currently there is "adb connect <ip_addr>".
I want to use adeb on my phone, but I got the above error.
root@localhost:/# filetop
sh: modprobe: command not found
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module)
chdir(/lib/modules/4.14.117-perf-g63f048d/build): No such file or directory
Traceback (most recent call last):
File "/usr/share/bcc/tools/filetop", line 161, in <module>
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/__init__.py", line 343, in __init__
raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>
From the git log, we can see the '--kernelsrc' option was removed, so I can't specify the header path.
Can you tell me why this option was removed? And is there an alternative option? Thanks.
bpftrace has a lot of one-line command, it's easy to use.
I managed to use adeb image to create an environment on which I can run eBPF on non android system (buildroot initramfs with no desk mounted). It would be nice to extend adeb to streamline the process for non android system.
The steps I had to do to get this working:
adeb prepare --kernelsrc /path/to/kernel --build-image deb.img --bcc
mount deb.img ./tmp && chroot tmp
cd bcc-master && ./build-bcc.sh
I am happy to send patches to get this work done. But it would be nice to know first if the concept is OK and if there's any preference on methodology.
What I think needs doing is:
I'm not sure how you manage step 4 at the moment. It would be nice to do this offline at the host too.
These are my quick thoughts. I'll try to get some patches ready meanwhile ;-)
Hello
I want to use adeb in my android target but stuck here.
I spent a day to solve this issue. Can't understand that isssue.
after prepare adeb in my target,
and run adeb shell
.
pino@pino-virtual-machine:~$ adeb shell
/system/bin/sh: /data/androdeb/run: No such file or directory
But that file is exist in my target.
So please give me some any idea?
thanks, pino.
I installed 'adeb' tool in Android R platform, I've enabled the below kernel config:
CONFIG_IKHEADERS=m
CONFIG_BPF_JIT=y
CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
CONFIG_BPF_JIT_ALWAYS_ON=y
CONFIG_HAVE_EBPF_JIT=y
CONFIG_BPF_EVENTS=y
CONFIG_KPROBES=y
CONFIG_KPROBE_EVENTS=y
CONFIG_UPROBES=y
CONFIG_UPROBE_EVENTS=y
CONFIG_TRACEPOINTS=y
CONFIG_PREEMPTIRQ_EVENTS=y
But while I running the below command to catch the kernel & user space call stack, I found most of the user space call stack was marked with [unknown]. Are there any way to fix this issue? Thanks in advance.
Part of the abnormal call stack info(I've attached the trace.txt):
17:51:04 1093 2027 InputReader do_sys_open /dev/pmsg0
do_sys_open+0x0 [kernel]
el0_svc_common+0xa0 [kernel]
el0_svc_handler+0x78 [kernel]
el0_svc+0x8 [kernel]
__openat+0x8 [libc.so]
[unknown] [liblog.so]
__android_log_bwrite+0x88 [liblog.so]
[unknown] [libandroid_runtime.so]
[unknown] [boot-framework.oat]
......
17:51:05 1093 24670 Binder:1093_1D do_sys_open /dev/pmsg0
do_sys_open+0x0 [kernel]
el0_svc_common+0xa0 [kernel]
el0_svc_handler+0x78 [kernel]
el0_svc+0x8 [kernel]
__openat+0x8 [libc.so]
[unknown] [liblog.so]
[unknown] [liblog.so]
__android_log_logd_logger+0x7c [liblog.so]
[unknown] [libbase.so]
[unknown] [libbase.so]
std::__1::__function::__func<art::InitLogging(char**, void (&)(char const*))::LogdLoggerLocked, std::__1::allocator<art::InitLogging(char**, void (&)(char const*))::LogdLoggerLocked>, void (android::base::LogId, android::base::LogSeverity, char const*, char const*, unsigned int, char const*)>::operator()(android::base::LogId&&, android::base::LogSeverity&&, char const*&&, char const*&&, unsigned int&&, char const*&&)+0x74 [libartbase.so]
[unknown] [libbase.so]
__android_log_buf_write+0xbc [liblog.so]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
......
17:51:12 3749 4577 AsyncTask #2 do_sys_open /dev/pmsg0
do_sys_open+0x0 [kernel]
el0_svc_common+0xa0 [kernel]
el0_svc_handler+0x78 [kernel]
el0_svc+0x8 [kernel]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
[unknown]
Enviroment:
Host Ubuntu: 18.04
Client Android: Android P + 4.9 kernel with root
Reproduce:
- Terminal shows up:
:adeb$ adeb prepare --build --bcc --kernelsrc ./kernel-headers |
---|
adeb: v0.99g |
-------------- |
15:01:39 - INFO : Looking for device.. |
15:01:39 - INFO : Preparing device... |
15:01:39 - INFO : Doing a full install. |
15:01:39 - INFO : |
15:01:39 - INFO : Building and updating kernel headers from kernel source dir (/home/cuiyingyun/code/4tb_disk/adeb/versace-stuff/kernel-headers) |
15:01:43 - INFO : Using temporary directory: /tmp/tmp.THkf5av3D6 |
15:01:43 - INFO : The next stage runs as sudo, please enter password if asked. |
I: Running command: debootstrap --arch arm64 --foreign --include=llvm-6.0-dev,libclang-6.0-dev,libelf-dev,libfl-dev,libunwind-dev,libdw-dev,git,gcc,libtool,autoconf,make,cmake,iperf,arping,ethtool,flex,bison,python,clang-6.0,python-netaddr,python- |
pyroute2,bash,ca-certificates,apt,net-tools,iputils-ping,procps,vim --variant=minbase buster /tmp/tmp.THkf5av3D6/debian http://deb.debian.org/debian/ |
W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg |
I: Retrieving Release |
I: Retrieving Packages |
I: Validating Packages |
I: Found packages in base already in required: apt bash |
I: Resolving dependencies of required packages... |
I: Resolving dependencies of base packages... |
I: Found additional required dependencies: adduser debian-archive-keyring fdisk gcc-8-base gpgv libacl1 libapt-pkg5.0 libattr1 libaudit-common libaudit1 libblkid1 libbz2-1.0 libc6 libcap-ng0 libcom-err2 libdb5.3 libdebconfclient0 libext2fs2 libfdi |
sk1 libffi6 libgcc1 libgcrypt20 libgmp10 libgnutls30 libgpg-error0 libhogweed4 libidn2-0 liblz4-1 liblzma5 libmount1 libncursesw6 libnettle6 libp11-kit0 libpam0g libpcre3 libseccomp2 libselinux1 libsemanage-common libsemanage1 libsepol1 libsmartco |
ls1 libss2 libstdc++6 libsystemd0 libtasn1-6 libtinfo6 libudev1 libunistring2 libuuid1 libzstd1 zlib1g |
I: Found additional base dependencies: autotools-dev binfmt-support binutils binutils-aarch64-linux-gnu binutils-common cmake-data cpp cpp-8 file gcc-8 git-man ieee-data libarchive13 libasan5 libatomic1 libbinutils libbison-dev libbsd0 libc-dev-bi |
n libc6-dev libcap2 libcc1-0 libclang-common-6.0-dev libclang1-6.0 libcurl3-gnutls libcurl4 libdw1 libedit2 libelf1 liberror-perl libexpat1 libffi-dev libfl2 libgcc-8-dev libgdbm-compat4 libgdbm6 libgomp1 libgpm2 libgssapi-krb5-2 libicu63 libisl19 |
libitm1 libjsoncpp1 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libldap-2.4-2 libldap-common libllvm6.0 liblsan0 liblzma-dev libmagic-mgc libmagic1 libmpc3 libmpfr6 libncurses-dev libncurses6 libnet1 libnghttp2-14 libobjc-8-dev libobjc4 l |
ibpcap0.8 libpcre2-8-0 libperl5.28 libpipeline1 libprocps7 libpsl5 libpython-stdlib libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libreadline7 librhash0 librtmp1 libsasl2-2 libsasl2-modules-db libsigsegv2 libsqlite3-0 libssh2-1 libssl |
1.1 libstdc++-8-dev libtinfo-dev libtsan0 libubsan1 libunwind8 libuv1 libxml2 linux-libc-dev llvm-6.0 llvm-6.0-runtime lsb-base m4 mime-support openssl perl perl-modules-5.28 python-minimal python2 python2-minimal python2.7 python2.7-minimal readl |
ine-common vim-common vim-runtime wget xxd zlib1g-dev |
I: Checking component main on http://deb.debian.org/debian... |
I: Retrieving libacl1 2.2.52-3+b1 |
I: Validating libacl1 2.2.52-3+b1 |
I: Retrieving adduser 3.118 |
A lot of logs for updating package
I: Chosen extractor for .deb packages: dpkg-deb
I: Extracting libacl1...
I: Extracting adduser...
real 8m3.377s
user 0m29.522s
sys 0m11.618s
umount: /tmp/tmp.THkf5av3D6/debian/proc/sys/fs/binfmt_misc: not found
umount: /tmp/tmp.THkf5av3D6/debian/proc: not found
chroot: failed to run command ‘rm’: No such file or directory
chroot: failed to run command ‘ln’: No such file or directory
16:01:47 - WARNING : _apt user cannot be added to AID_INET group
/home/cuiyingyun/code/4tb_disk/adeb/buildstrap: line 60: /tmp/tmp.THkf5av3D6/debian/etc/resolv.conf: No such file or directory
Cloning into '/tmp/tmp.THkf5av3D6/debian/bcc-master'...
remote: Enumerating objects: 52, done.
remote: Counting objects: 100% (52/52), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 17061 (delta 15), reused 28 (delta 12), pack-reused 17009
Receiving objects: 100% (17061/17061), 8.19 MiB | 1.76 MiB/s, done.
Resolving deltas: 100% (11050/11050), done.
Checking connectivity... done.
16:01:56 - INFO : Compressing new filesystem to prepare to push to Android /data/androdeb/
/tmp/tmp.THkf5av3D6/deb.tar.gz: 1 file pu...hed. 23.5 MB/s (23319243 bytes in 0.945s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (652 bytes in 0.021s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...e pushed. 0.1 MB/s (1162 bytes in 0.021s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...ile pushed. 0.0 MB/s (93 bytes in 0.017s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (573 bytes in 0.014s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (242 bytes in 0.014s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (762 bytes in 0.015s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (311 bytes in 0.014s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (113 bytes in 0.014s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...le pushed. 0.0 MB/s (229 bytes in 0.013s)
/home/cuiyingyun/code/4tb_disk/adeb/addon...e pushed. 0.1 MB/s (1157 bytes in 0.015s)
10 files pushed. 0.0 MB/s (5294 bytes in 0.179s)
Unpack of rootfs successful!
mount: '/proc'->'debian/proc/': No such file or directory
mount: '/dev'->'debian/dev/': No such file or directory
mount: '/dev/pts'->'debian/dev/pts': No such file or directory
mount: '/sys'->'debian/sys/': No such file or directory
mount: '/sys/fs/bpf/'->'debian/sys/fs/bpf/': No such file or directory
mount: '/sys/kernel/debug/'->'debian/sys/kernel/debug/': No such file or directory
mount: '/sys/kernel/debug/tracing/'->'debian/sys/kernel/debug/tracing/': No such file or directory
chmod: debian/sys/kernel/debug: No such file or directory
chmod: debian/sys/kernel/debug/tracing: No such file or directory
chroot: exec /bin/bash: No such file or directory
adeb$ adeb shell
chroot: exec /bin/bash: No such file or directory
Other infomation:
adeb shell
readlink: illegal option -- f
usage: readlink [-n] [file ...]
readlink: illegal option -- f
usage: readlink [-n] [file ...]
/system/bin/sh: /data/androdeb/run: can't execute: Permission denied
adeb is awesome in that I now have my usual zsh shell with vim working on my device (much like Termux on my phone), my original hope though was that I would get tools like ldd
and be able to execute AOSP binaries via the adeb shell (and vice versa execute adeb binaries via the adb shell)
Using readelf
I see that a different linker/interpreter is used (/lib/ld-linux-aarch64.so.1
vs /apex/com.android.runtime/bin/linker64
(not mounted in the adeb shell)). Is there however a way to execute AOSP binaries?
In one AOSP training exercise I did before finding adeb, we setup a rootfs system, manually built binaries with a gcc toolchain, installed all the deps in /lib
and /lib64
, and I was able to execute these from the adb shell.
Thanks
I met an issue of cannot use strcmp(strcmp(key.comm, "xxx");), eBPF verify show below error, I traced strcmp realized in strcmp.S.
After I rewrite the strcmp function with C language, it works well, but I think this is inconvenient, so I want ask whether you have good idea, thank you.
========================error log============================
root@localhost:/# ./submit_bio.py
bpf: Failed to load program: Invalid argument
0: (79) r6 = *(u64 *)(r1 +0)
1: (b7) r1 = 0
2: (7b) *(u64 *)(r10 -8) = r1
3: (7b) *(u64 *)(r10 -16) = r1
4: (7b) *(u64 *)(r10 -24) = r1
5: (7b) *(u64 *)(r10 -32) = r1
6: (7b) *(u64 *)(r10 -40) = r1
7: (7b) *(u64 *)(r10 -48) = r1
8: (7b) *(u64 *)(r10 -56) = r1
9: (7b) *(u64 *)(r10 -64) = r1
10: (7b) *(u64 *)(r10 -72) = r1
11: (bf) r7 = r10
12: (07) r7 += -68
13: (bf) r1 = r7
14: (b7) r2 = 16
15: (85) call bpf_get_current_comm#16
16: (85) call bpf_get_current_pid_tgid#14
17: (63) *(u32 *)(r10 -52) = r0
18: (bf) r1 = r7
19: BUG_ld_00
invalid BPF_LD_IMM insn
Traceback (most recent call last):
File "./submit_bio.py", line 92, in
b.attach_kprobe(event="submit_bio", fn_name="print_submit_bio")
File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 592, in attach_kprobe
fn = self.load_func(fn_name, BPF.KPROBE)
File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 377, in load_func
(func_name, errstr))
Exception: Failed to load BPF program print_submit_bio: Invalid argument
When I run trace 'p:c:write (arg1 == 1) "writing %d bytes to STDOUT"
I see traces of any writes to stdout
happening inside the chroot but nothing outside of it is traced. For example, if I have an adb shell
open and I do a echo hello
there it is not traced but anything happening on the stdout
of another adeb shell
is traced. Is this the intended behavior for user space tracing? Is there any way to trace user events outside the chroot?
18:11:55 - ERROR : Device doesn't have an androdeb environment, run "./androdeb prepare" first
I RUN androdeb prepare,the same error
I see that the most recent changes to adeb
removed the --kernelsrc
flag and expects to run on a kernel with CONFIG_IKHEADERS
.
Based on https://cateee.net/lkddb/web-lkddb/IKHEADERS.html, it seems like only kernels 5.2+ have that option. It looks like the goldfish kernel only has 4.14 as the latest supported kernel.
Where do I find a kernel tree that can run adeb
? Or am I expected to apply the patch from https://lore.kernel.org/patchwork/patch/1067310/ to whatever kernel I'm building?
Hi
I am trying to get adeb-BCC working on a arm64 android platform.
linux kernel is 4.9
biolatency biosnoop biotop bitesize no log output
root@localhost:/usr/share/bcc/tools# ./bitesize
In file included from /virtual/main.c:3:
In file included from include/linux/blkdev.h:14:
include/linux/pagemap.h:556:16: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
if (unlikely(__put_user(0, uaddr) != 0))
^
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:38: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
include/linux/pagemap.h:556:16: note: use constraint modifier "w"
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:34: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
In file included from /virtual/main.c:3:
In file included from include/linux/blkdev.h:14:
include/linux/pagemap.h:556:16: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
if (unlikely(__put_user(0, uaddr) != 0))
^
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:38: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
include/linux/pagemap.h:556:16: note: use constraint modifier "w"
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:34: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
In file included from /virtual/main.c:3:
In file included from include/linux/blkdev.h:14:
include/linux/pagemap.h:564:10: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
return __put_user(0, end);
^
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:38: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
include/linux/pagemap.h:564:10: note: use constraint modifier "w"
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:34: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
In file included from /virtual/main.c:3:
In file included from include/linux/blkdev.h:14:
include/linux/pagemap.h:564:10: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
return __put_user(0, end);
^
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:38: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
include/linux/pagemap.h:564:10: note: use constraint modifier "w"
./arch/arm64/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user'
__put_user_err((x), (ptr), __pu_err);
^
./arch/arm64/include/asm/uaccess.h:328:34: note: expanded from macro '__put_user_err'
__put_user_asm("str", "sttr", "%", __pu_val, (ptr),
^
4 warnings generated.
Tracing... Hit Ctrl-C to end.
^Croot@localhost:/usr/share/bcc/tools#
Any suggestions?
Thank you very much
When I run 'adeb shell' after 'adeb prepare --full' I got the following errors.
$ adeb shell
/system/bin/sh: /system/bin/sh: -t: unknown option
what does this -t option mean?
Please note that I checked Android N/O/Q versions and they all got the same issue.
Buster, the default Debian used by adeb, is now oldstable
.
New stable
is Bullsye: https://wiki.debian.org/DebianReleases
There are a few changes to support Bullseye in adeb, mostly around package names and python3.
I may send some PRs, filing a tracking bug first.
smith@smith-Inspiron-5545:~/adeb/adeb$ adeb prepare |
---|
adeb: v0.99g |
-------------- |
16:05:32 - INFO : Looking for device.. |
16:05:32 - INFO : Preparing device... |
16:05:32 - INFO : Doing a base install. |
16:05:32 - INFO : |
16:05:32 - INFO : Downloading Androdeb from the web... |
16:05:32 - INFO : |
% Total % Received % Xferd Average Speed Time Time Time Current |
Dload Upload Total Spent Left Speed
100 618 0 618 0 0 467 0 --:--:-- 0:00:01 --:--:-- 467
20 48.5M 20 9.8M 0 0 36543 0 0:23:13 0:04:43 0:18:30 0
20 48.5M 20 9.8M 0 0 36414 0 0:23:17 0:04:44 0:18:33 0
20 48.5M 20 9.8M 0 0 21247 0 0:39:55 0:08:08 0:31:47 0
curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104
16:05:41 - ERROR : Failed to download adeb release.
root@localhost:/usr/share/bcc/tools# filetop 5 10
sh: modprobe: command not found
Unable to find kernel headers. Try rebuilding kernel with CONFIG_IKHEADERS=m (module)
chdir(/lib/modules/4.9.186-perf-g4773f96/build): No such file or directory
Traceback (most recent call last):
File "/usr/share/bcc/tools/filetop", line 161, in
b = BPF(text=bpf_text)
File "/usr/lib/python2.7/dist-packages/bcc/init.py", line 343, in init
raise Exception("Failed to compile BPF module %s" % (src_file or ""))
Exception: Failed to compile BPF module
On Android adeb env, if use bpftrace trace uprobe pthread_create, the path should be uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_create,
not uprobe:/system/lib/bootstrap/libc.so:pthread_create, uprobe:/system/lib64/bootstrap/libc.so:pthread_create.
Is that right?
All these paths could list the function path:
root@localhost:/# bpftrace -l 'uprobe:/system/lib/bootstrap/libc.so:pthread*'
uprobe:/system/lib/bootstrap/libc.so:pthread_setspecific
uprobe:/system/lib/bootstrap/libc.so:pthread_barrierattr_getpshared
uprobe:/system/lib/bootstrap/libc.so:pthread_exit
uprobe:/system/lib/bootstrap/libc.so:pthread_mutexattr_gettype
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_getscope
uprobe:/system/lib/bootstrap/libc.so:pthread_cond_timedwait_monotonic_np
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setguardsize
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setschedpolicy
uprobe:/system/lib/bootstrap/libc.so:pthread_getschedparam
uprobe:/system/lib/bootstrap/libc.so:pthread_rwlock_timedwrlock
uprobe:/system/lib/bootstrap/libc.so:pthread_mutexattr_getpshared
uprobe:/system/lib/bootstrap/libc.so:pthread_attr_setinheritsched
...
root@localhost:/# bpftrace -l 'uprobe:/system/lib64/bootstrap/libc.so:pthread*'
uprobe:/system/lib64/bootstrap/libc.so:pthread_mutex_lock
uprobe:/system/lib64/bootstrap/libc.so:pthread_mutexattr_destroy
uprobe:/system/lib64/bootstrap/libc.so:pthread_cond_signal
uprobe:/system/lib64/bootstrap/libc.so:pthread_cond_timedwait
uprobe:/system/lib64/bootstrap/libc.so:pthread_rwlockattr_setpshared
uprobe:/system/lib64/bootstrap/libc.so:pthread_create
uprobe:/system/lib64/bootstrap/libc.so:pthread_attr_setstacksize
uprobe:/system/lib64/bootstrap/libc.so:pthread_mutexattr_gettype
uprobe:/system/lib64/bootstrap/libc.so:pthread_attr_destroy
uprobe:/system/lib64/bootstrap/libc.so:pthread_gettid_np
...
root@localhost:/# bpftrace -l 'uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread*'
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_getattr_np
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_condattr_getpshared
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_setaffinity_np
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_rwlockattr_init
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_timedjoin_np
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_setguardsize
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_getstackaddr
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_condattr_setclock
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_sigqueue
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_attr_setscope
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_barrierattr_setpshared
uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_condattr_setpshared
...
I write a test program that calls pthread_create, built under adeb env, could trace the output result:
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/lib/aarch64-linux-gnu/libpthread.so.0:pthread_create{ printf("%-10u %-6d %-16s %s\n", elapsed /1000000, pid, comm, usym(arg2));}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
181 4669 pthread_test ChildThreadFunction
457 4669 pthread_test ChildThreadFunction
764 4669 pthread_test ChildThreadFunction
1065 4669 pthread_test ChildThreadFunction
1366 4669 pthread_test ChildThreadFunction
1666 4669 pthread_test ChildThreadFunction
1966 4669 pthread_test ChildThreadFunction
2266 4669 pthread_test ChildThreadFunction
2566 4669 pthread_test ChildThreadFunction
2866 4669 pthread_test ChildThreadFunction
3165 4669 pthread_test ChildThreadFunction
3466 4669 pthread_test ChildThreadFunction
3765 4669 pthread_test ChildThreadFunction
^C
but for test program built for android which execute under adb env, there is no trace result output:
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/system/lib/bootstrap/libc.so:pthread_create{ printf("%-6d %-16s\n", pid, comm);}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
^C
root@localhost:/# bpftrace -e 'BEGIN { printf("%-10s %-6s %-16s %s\n", "TIME(ms)", "PID", "COMM", "FUNC");} uprobe:/system/lib64/bootstrap/libc.so:pthread_create{ printf("%-10u %-6d %-16s %s\n", elapsed /1000000, pid, comm, usym(arg2));}'
Attaching 2 probes...
TIME(ms) PID COMM FUNC
^C
So, my problem is that under adeb env, no ability to trace the function caller to bionic library?
Hi,
I am trying to get adeb-BCC working on a Hikey970 android platform.
By default, use the command “adeb prepare --build --bcc --kernelsrc usr/src/linux-4.9.119” to compile bcc is failed.
The error information are as follows:
bash: cannot set terminal process group (16629): Inappropriate ioctl for device
bash: no job control in this shell
-- The C compiler identification is Clang 6.0.1
-- The CXX compiler identification is Clang 6.0.1
-- Check for working C compiler: /usr/bin/clang-6.0
-- Check for working C compiler: /usr/bin/clang-6.0 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/clang++-6.0
-- Check for working CXX compiler: /usr/bin/clang++-6.0 -- broken
CMake Error at /usr/share/cmake-3.11/Modules/CMakeTestCXXCompiler.cmake:45 (message):
The C++ compiler
"/usr/bin/clang++-6.0"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: /bcc-master/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_7686c/fast"
/usr/bin/make -f CMakeFiles/cmTC_7686c.dir/build.make CMakeFiles/cmTC_7686c.dir/build
make[1]: Entering directory '/bcc-master/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_7686c.dir/testCXXCompiler.cxx.o
/usr/bin/clang++-6.0 -o CMakeFiles/cmTC_7686c.dir/testCXXCompiler.cxx.o -c /bcc-master/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
Linking CXX executable cmTC_7686c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7686c.dir/link.txt --verbose=1
/usr/bin/clang++-6.0 -rdynamic CMakeFiles/cmTC_7686c.dir/testCXXCompiler.cxx.o -o cmTC_7686c
/usr/bin/ld: cannot find -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [CMakeFiles/cmTC_7686c.dir/build.make:87: cmTC_7686c] Error 1
make[1]: Leaving directory '/bcc-master/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:126: cmTC_7686c/fast] Error 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.