Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPIC: uprobe #19

Open
1 task
tamemo99 opened this issue Oct 25, 2024 · 4 comments
Open
1 task

EPIC: uprobe #19

tamemo99 opened this issue Oct 25, 2024 · 4 comments
Labels
eBPF eBPF related issues Epic uprobes

Comments

@tamemo99
Copy link
Contributor

tamemo99 commented Oct 25, 2024

Schwierigkeit: methoden finden
bpfdroid paper lesen: .oat and .so files, pages 7-9

Edit by @fhilgers:

As a PO I want to trace arbitrary function calls from programs running on the device.

Acceptance criteria:

  • Retrieving memory addresses to attach uprobe ebpf programs

Further tickets:

  • Writing uprobe ebpf programs that export information
  • Loading and configuring them via the daemon
@fhilgers
Copy link
Collaborator

We definitely have to split this task up a lot.

For research:

  • Read the pages in the paper
  • Read the code from the paper

Then the actual implementation are multiple parts as well:

  1. Getting the right symbols this happens outside of ebpf)
  2. Actually tracing those (inside ebpf)

The implementation of the paper gets symbols from shared libraries (.so) files and .oat files.

  • Find a list of shared libraries on the system
  • getting oat files from zygote

The bpfroid repository (from the paper) has shell scripts:

Afterwards we have to decide whether we want to offer the capabilities for finding available uprobe entries while the loader is running, or whether that happens as part of generating a configuration.

I suggest:

  1. Find methods via script outside of the actual process via adb and make them available to the daemon via a config or settings file
  2. Call external programs which are on android devices in our loader for retrieving methods (oatdump).
  3. Write a library to the the methods without external program calls

We should start with 1 and defer 2 and 3 to new tickets.

@der-whity der-whity self-assigned this Oct 30, 2024
@ffranzgitHub ffranzgitHub self-assigned this Nov 1, 2024
@der-whity
Copy link
Contributor

In the BPFroid repo the mentioned scripts for searching symbols are implemented in go in the tracee.go file (https://github.com/yanivagman/BPFroid/tree/main/tracee/tracee.go) in the function initLibBases.
We could follow that. It works as follows:

  1. find the zygote-process so you can later calculate the symbols' memory-addresses via a offset from that zygote-base-adress
  2. search for .so and .oat files included in the zygote (and therefore in all applications) via /proc/$ZYGOTE_PID/maps
  3. calculate the correct addresses and extract the symbols

But with that code - afaik - BPFroid only traces standard-lib methods, which are included in every process. So if we wanted to trace arbitrary methods which aren't included by default, we would have to search every $PID in /proc/$PID/maps

@fhilgers
Copy link
Collaborator

fhilgers commented Nov 3, 2024

We should just start with standard-lib methods and get that working. Afterward we expand to more, but as part of new tickets, so the work is better split up and we have continuous progress.

@Mr-Kanister Mr-Kanister added the eBPF eBPF related issues label Nov 6, 2024
@ffranzgitHub ffranzgitHub removed their assignment Nov 7, 2024
@der-whity der-whity removed their assignment Nov 10, 2024
@tamemo99 tamemo99 changed the title scope(ebpf/daemon) uprobe EPIC: uprobe Nov 26, 2024
@tamemo99 tamemo99 moved this from Sprint Backlog to In Progress in amos2024ws03-feature-board Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eBPF eBPF related issues Epic uprobes
Projects
Status: In Progress
Development

No branches or pull requests

5 participants