record worker_id in state and report via KAFL_HYPERCALL_GET_HOST_CONFIG

Modifies elements of host_config_t - update guest agent struct!
This commit is contained in:
Steffen Schulz 2021-08-18 10:31:43 -07:00
parent 24e6f39e1c
commit 68f74353b2
5 changed files with 7 additions and 2 deletions

View File

@ -24,6 +24,7 @@ void handle_hypercall_kafl_get_host_config(struct kvm_run *run, CPUState *cpu, u
config.bitmap_size = GET_GLOBAL_STATE()->shared_bitmap_size;
config.ijon_bitmap_size = GET_GLOBAL_STATE()->shared_ijon_bitmap_size;
config.payload_buffer_size = GET_GLOBAL_STATE()->shared_payload_buffer_size;
config.worker_id = GET_GLOBAL_STATE()->worker_id;
write_virtual_memory(vaddr, (uint8_t*)&config, sizeof(host_config_t), cpu);
GET_GLOBAL_STATE()->get_host_config_done = true;
@ -101,4 +102,4 @@ void handle_hypercall_kafl_set_agent_config(struct kvm_run *run, CPUState *cpu,
exit(1);
}
GET_GLOBAL_STATE()->set_agent_config_done = true;
}
}

View File

@ -19,6 +19,7 @@ typedef struct host_config_s{
uint32_t bitmap_size;
uint32_t ijon_bitmap_size;
uint32_t payload_buffer_size;
uint32_t worker_id;
/* more to come */
} __attribute__((packed)) host_config_t;

View File

@ -374,6 +374,7 @@ static void nyx_realize(DeviceState *dev, Error **errp){
if(s->cow_primary_size){
set_global_cow_cache_primary_size(s->cow_primary_size);
}
GET_GLOBAL_STATE()->worker_id = s->worker_id;
if (!s->workdir || !verify_workdir_state(s, errp)){
fprintf(stderr, "[QEMU-Nyx] Error: work dir...\n");

View File

@ -45,6 +45,7 @@ void state_init_global(void){
global_state.nyx_fdl = false;
global_state.workdir_path = NULL;
global_state.worker_id = 0xffff;
global_state.fast_reload_enabled = false;
global_state.fast_reload_mode = false;
@ -234,4 +235,4 @@ void set_payload_pages(uint64_t* payload_pages, uint32_t pages){
void set_workdir_path(char* workdir){
assert(workdir && !global_state.workdir_path);
assert(asprintf(&global_state.workdir_path, "%s", workdir) != -1);
}
}

View File

@ -49,6 +49,7 @@ typedef struct qemu_nyx_state_s{
bool nyx_fdl;
char* workdir_path;
uint32_t worker_id;
/* FAST VM RELOAD */
bool fast_reload_enabled;