panda
panda copied to clipboard
guest plugins
This is a draft PR for tracking the new feature: guest plugins.
The PR includes several new PANDA plugins:
-
linjector
- A hypervisor-based executable injector. -
guest_plugin_manager
- A general interface for PANDA plugins to interact with guest plugins. -
hyperfuse
- An example guest plugin for PANDA which exposes the internal guest file system to the host file system via FUSE. -
guest_shell
- An example guest plugin for PANDA which exposes an injected command line interface for the guest to the host.
TODO:
- [x] Build generic interface for
panda_require
from rust and make use of it forguest_plugin_manager
to loadlinjector
- [ ] linjector port to MIPS and aarch64
- [ ] Fix linjector on currently "supported" but broken architectures
- [x] ARM
- [ ] i386
- [x] Add a PPP callback for "linjector injected" and a consumer in
guest_plugin_manager
- [x] Add a PPP callback for "guest agent loaded" and add consumer in PANDA guest plugins
- [x] Remove hardcoded paths from linjector/hyperfuse
- [x] Add a guest plugin retrieval-by-name mechanism
- [x] Add load-by-name to guest_plugin_manager
- [x] Add bindings to panda-rs
- [x] Add guest plugin building to the build system (prereq for last 2)
- [x] Add out-of-tree guest plugin building
- [x] Add a Rust attribute for wrapping the message_recv callback
- [x] PANDA API documentation
- [ ] guest plugin API guide
- [x] move
guest_plugin_path
function into panda-rs - [x] remove hardcoded path from
rust_example
guest plugin- [x] setup hyperchannels library for commit-agnostic versioning
- [x] move to its own repo
- [x] publish to crates.io
- [x] setup hyperchannels library for commit-agnostic versioning
- [x] Rewrite PANDA-side guest_shell plugin for readability
- [ ] hyperfuse improvements
- [x] Implement symlink resolution
- [x] Rewrite list caching
- [x] Rework to not invalidate on hit (links are resolved twice by ls, for example)
- [x] Pre-fetch lookups of symlinks on directory listing
- [x] Rewrite list caching
- [x] Fix I/O error for
/proc
and/sys
- [ ] Investigate which unimplemented features are important
- [x] Have mount point be an environment variable
- [x] Implement symlink resolution
Instructions for trying hyperfuse/guest_shell today:
Setup
- Clone both
panda-re/panda
andpanda-re/igloo-internal
- Checkout the
linjector_base4
branch of panda - Checkout the
guest_agent
branch of igloo-internal - Set the
EXTRA_GUEST_PLUGINS_PATH
environment variable to point toigloo-internal/pie_idea/guest_code
- Ensure you have the musl target installed for Rust:
rustup target add x86_64-unknown-linux-musl
- Build PANDA for x86_64 (other architectures are currently broken)
cd build
../build.sh x86_64-softmmu
Using hyperfuse
- Create a directory to use as your mount point for the guest filesystem
- Set the
HYPERFUSE_MOUNT
environment variable to point to that directory - Run
panda/python/examples/hyperfuse.py
Give it a second to start up, then your mount point should now mirror the guest filesystem's state.
Using guest_shell
- Run
panda/python/examples/guest_shell.py
- In another terminal (the one you want to use as the shell) run
panda/plugins/guest_shell/guest_shell_pty.sh
- Give it a second to start up. You should see a
#
prompt in your second terminal and you can begin using the shell
@panda.ppp("linjector", "before_guest_inject")
def linjector_finish(cpu):
print("!!!! Injection finished !!!!")
@panda.ppp("guest_plugin_manager", "on_guest_agent_load")
def agent_loaded(cpu):
print("!!!! Guest agent loaded !!!!")
Examples of the added PPP callbacks