Skip to content

Commit 94742a4

Browse files
committed
Update pri_taint to use Hypercall library
1 parent 295defc commit 94742a4

File tree

7 files changed

+304
-170
lines changed

7 files changed

+304
-170
lines changed

panda/debian/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
panda.deb
1+
*.deb
2+
*.whl

panda/plugins/hypercaller/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This was designed primarily for Python use cases:
5151
MAGIC = 0x12345678
5252
@panda.hypercall(MAGIC)
5353
def hypercall(cpu):
54-
print("Hello from my hypercall!"
54+
print("Hello from my hypercall!")
5555

5656
```
5757

@@ -64,7 +64,7 @@ It's much easier to handle this from Python, but here's an example of how you mi
6464
#include <panda/plugin.h>
6565
#include <hypercaller/hypercaller.h>
6666

67-
hypercall_t* register_hypercall;
67+
register_hypercall_t register_hypercall;
6868

6969
void my_hypercall(CPUState *cpu) {
7070
printf("Hello from my hypercall!\n");
@@ -76,7 +76,7 @@ bool init_plugin(void *self) {
7676
panda_require("hypercaller");
7777
hypercaller = panda_get_plugin_by_name("hypercaller");
7878
}
79-
register_hypercall = (hypercall_t*)dlsym(hypercaller, "register_hypercall");
79+
register_hypercall_t register_hypercall = (register_hypercall_t) dlsym(hypercaller, "register_hypercall");
8080
register_hypercall(0x12345678, my_hypercall);
8181
return true;
8282
}

panda/plugins/hypercaller/hypercaller.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// files in this directory that contain subsections like this one.
77

88
typedef void (*hypercall_t)(CPUState *cpu);
9+
typedef void (*register_hypercall_t)(uint32_t, hypercall_t);
910
void register_hypercall(uint32_t magic, hypercall_t);
1011
void unregister_hypercall(uint32_t magic);
1112

panda/plugins/pri_taint/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ QEMU_CXXFLAGS := $(filter-out -Wundef,$(QEMU_CXXFLAGS))
22
QEMU_CXXFLAGS += -DTAINT2_HYPERCALLS
33
QEMU_CFLAGS += -DTAINT2_HYPERCALLS
44

5+
# If you need custom CFLAGS or LIBS, set them up here
6+
# CFLAGS+=
7+
# LIBS+=
8+
9+
# Example: this plugin has runtime symbol dependencies on plugin_x:
10+
# LIBS+=-L$(PLUGIN_TARGET_DIR) -l:panda_plugin_x.so
11+
# Also create a plugin_plugin.d file in this directory to ensure plugin_x
12+
# gets compiled before this plugin, example contents:
13+
# plugin-this_plugins_name : plugin-plugin_x
14+
# or if you're using the extra plugins dir:
15+
# extra-plugin-this_plugins_name : extra-plugin-plugin_x
16+
517
# The main rule for your plugin. List all object-file dependencies.
618
$(PLUGIN_TARGET_DIR)/panda_$(PLUGIN_NAME).so: \
719
$(PLUGIN_OBJ_DIR)/$(PLUGIN_NAME).o

0 commit comments

Comments
 (0)