• Daniel Müller's avatar
    libbpf: Add support for attaching uprobes to shared objects in APKs · c44fd845
    Daniel Müller authored
    This change adds support for attaching uprobes to shared objects located
    in APKs, which is relevant for Android systems where various libraries
    may reside in APKs. To make that happen, we extend the syntax for the
    "binary path" argument to attach to with that supported by various
    Android tools:
      <archive>!/<binary-in-archive>
    
    For example:
      /system/app/test-app/test-app.apk!/lib/arm64-v8a/libc++_shared.so
    
    APKs need to be specified via full path, i.e., we do not attempt to
    resolve mere file names by searching system directories.
    
    We cannot currently test this functionality end-to-end in an automated
    fashion, because it relies on an Android system being present, but there
    is no support for that in CI. I have tested the functionality manually,
    by creating a libbpf program containing a uretprobe, attaching it to a
    function inside a shared object inside an APK, and verifying the sanity
    of the returned values.
    Signed-off-by: default avatarDaniel Müller <deso@posteo.net>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/bpf/20230301212308.1839139-4-deso@posteo.net
    c44fd845
libbpf.c 330 KB