fix printf format string errors

This commit is contained in:
Steffen Schulz 2022-05-22 21:42:43 +02:00 committed by Sergej Schumilo
parent ab668227f9
commit bd34c46b85
7 changed files with 14 additions and 14 deletions

View File

@ -2572,7 +2572,7 @@ int kvm_cpu_exec(CPUState *cpu)
handle_hypercall_kafl_release(run, cpu, (uint64_t)run->hypercall.args[0]);
ret = 0;
#else
debug_fprintf(stderr "Got KVM_EXIT_SHUTDOWN while in fuzzing mode => panic\n",);
debug_fprintf(stderr, "Got KVM_EXIT_SHUTDOWN while in fuzzing mode => panic\n");
handle_hypercall_kafl_panic(run, cpu, (uint64_t)run->hypercall.args[0]);
ret = 0;
#endif
@ -2693,7 +2693,7 @@ int kvm_cpu_exec(CPUState *cpu)
ret = kvm_arch_handle_exit(cpu, run);
assert(ret == 0);
#else
debug_fprintf("kvm_arch_handle_exit(%d) => panic\n", run->exit_reason);
debug_fprintf(stderr, "kvm_arch_handle_exit(%d) => panic\n", run->exit_reason);
ret = kvm_arch_handle_exit(cpu, run);
if (ret != 0)
handle_hypercall_kafl_panic(run, cpu, (uint64_t)run->hypercall.args[0]);

View File

@ -127,8 +127,8 @@ bool apply_capabilities(CPUState *cpu){
debug_printf("--------------------------\n");
debug_printf("GET_GLOBAL_STATE()->cap_compile_time_tracing_buffer_vaddr: %lx\n", GET_GLOBAL_STATE()->cap_compile_time_tracing_buffer_vaddr);
debug_printf("GET_GLOBAL_STATE()->shared_bitmap_fd: %lx\n", GET_GLOBAL_STATE()->shared_bitmap_fd);
debug_printf("GET_GLOBAL_STATE()->shared_bitmap_size: %lx\n", GET_GLOBAL_STATE()->shared_bitmap_size);
debug_printf("GET_GLOBAL_STATE()->shared_bitmap_fd: %d\n", GET_GLOBAL_STATE()->shared_bitmap_fd);
debug_printf("GET_GLOBAL_STATE()->shared_bitmap_size: %x\n", GET_GLOBAL_STATE()->shared_bitmap_size);
debug_printf("GET_GLOBAL_STATE()->cap_cr3: %lx\n", GET_GLOBAL_STATE()->cap_cr3);
debug_printf("--------------------------\n");
@ -153,7 +153,7 @@ bool apply_capabilities(CPUState *cpu){
}
if(GET_GLOBAL_STATE()->cap_ijon_tracing){
debug_printf(stderr, "%s: agent trace buffer at vaddr: %lx\n", __func__, GET_GLOBAL_STATE()->cap_ijon_tracing_buffer_vaddr);
debug_printf("%s: agent trace buffer at vaddr: %lx\n", __func__, GET_GLOBAL_STATE()->cap_ijon_tracing_buffer_vaddr);
if(GET_GLOBAL_STATE()->cap_ijon_tracing_buffer_vaddr&0xfff){
fprintf(stderr, "[QEMU-Nyx] Error: guest's ijon buffer v_addr (0x%lx) is not page aligned!\n", GET_GLOBAL_STATE()->cap_ijon_tracing_buffer_vaddr);

View File

@ -315,7 +315,7 @@ static void handle_hypercall_kafl_range_submit(struct kvm_run *run, CPUState *cp
}
if(GET_GLOBAL_STATE()->pt_ip_filter_configured[buffer[2]]){
QEMU_PT_PRINTF(CORE_PREFIX, "Ignoring agent-provided address ranges (abort reason: 1) - %d", buffer[2]);
QEMU_PT_PRINTF(CORE_PREFIX, "Ignoring agent-provided address ranges (abort reason: 1) - %ld", buffer[2]);
return;
}
@ -324,7 +324,7 @@ static void handle_hypercall_kafl_range_submit(struct kvm_run *run, CPUState *cp
GET_GLOBAL_STATE()->pt_ip_filter_b[buffer[2]] = buffer[1];
GET_GLOBAL_STATE()->pt_ip_filter_configured[buffer[2]] = true;
QEMU_PT_PRINTF(CORE_PREFIX, "Configuring agent-provided address ranges:");
QEMU_PT_PRINTF(CORE_PREFIX, "\tIP%d: %lx-%lx [ENABLED]", buffer[2], GET_GLOBAL_STATE()->pt_ip_filter_a[buffer[2]], GET_GLOBAL_STATE()->pt_ip_filter_b[buffer[2]]);
QEMU_PT_PRINTF(CORE_PREFIX, "\tIP%ld: %lx-%lx [ENABLED]", buffer[2], GET_GLOBAL_STATE()->pt_ip_filter_a[buffer[2]], GET_GLOBAL_STATE()->pt_ip_filter_b[buffer[2]]);
}
else{
QEMU_PT_PRINTF(CORE_PREFIX, "Ignoring agent-provided address ranges (abort reason: 2)");
@ -626,7 +626,7 @@ static void handle_hypercall_kafl_lock(struct kvm_run *run, CPUState *cpu, uint6
QEMU_PT_PRINTF(CORE_PREFIX, "Creating pre image snapshot <%s> ...", GET_GLOBAL_STATE()->fast_reload_pre_path);
printf("Creating pre image snapshot");
debug_printf("Creating pre image snapshot");
request_fast_vm_reload(GET_GLOBAL_STATE()->reload_state, REQUEST_SAVE_SNAPSHOT_PRE);
}
@ -794,7 +794,7 @@ static void handle_hypercall_kafl_dump_file(struct kvm_run *run, CPUState *cpu,
void* page = malloc(PAGE_SIZE);
uint32_t written = 0;
QEMU_PT_PRINTF(CORE_PREFIX, "%s: dump %d bytes to %s (append=%u)\n",
QEMU_PT_PRINTF(CORE_PREFIX, "%s: dump %d bytes to %s (append=%u)",
__func__, bytes, host_path, file_obj.append);
while (bytes > 0) {

View File

@ -6,6 +6,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "nyx/debug.h"
//#define SHAREDIR_DEBUG
@ -167,7 +168,7 @@ uint64_t sharedir_request_file(sharedir_t* self, const char* file, uint8_t* page
}
}
else{
fprintf(stderr, "WARNING: No such file in sharedir: %s\n", file);
debug_fprintf(stderr, "WARNING: No such file in sharedir: %s\n", file);
return 0xFFFFFFFFFFFFFFFFUL;
}
}

View File

@ -4,6 +4,7 @@
#include "nyx/snapshot/block/block_cow.h"
#include "sysemu/block-backend.h"
#include "nyx/state/state.h"
#include "nyx/debug.h"
//#define COW_CACHE_DEBUG
@ -547,7 +548,7 @@ static int cow_cache_write(cow_cache_t* self, BlockBackend *blk, int64_t offset,
void switch_to_fuzz_mode(cow_cache_t* self){
self->enabled_fuzz = true;
assert(!mprotect(self->data_primary, self->cow_primary_size, PROT_READ));
printf("[qemu-nyx] switching to secondary CoW buffer\n");
debug_printf("[qemu-nyx] switching to secondary CoW buffer\n");
}
void cow_cache_read_entry(void* opaque){

View File

@ -346,8 +346,6 @@ nyx_device_state_t* nyx_device_state_init_from_snapshot(const char* snapshot_fol
struct stat buffer;
assert(stat (qemu_state_file, &buffer) == 0);
debug_printf("FILE EXISTS...\n");
void* state_buf2 = malloc(STATE_BUFFER);
f = fopen(qemu_state_file, "r");

View File

@ -877,7 +877,7 @@ static int fdl_enumerate_section(state_reallocation_t* self, QEMUFile *f, Migrat
ret = fdl_vmstate_load(self, f, se, version_id);
}
else{
debug_fprintf(stderr, "---------------------------------\nVMSD2: %x\n", se->vmsd);
debug_fprintf(stderr, "---------------------------------\nVMSD2: %p\n", (void*)se->vmsd);
//abort();
//fprintf(stderr, "---------------------------------\nVMSD2: %s\n", (VMStateDescription *)(se->vmsd)->name);
ret = vmstate_load(f, se);