Skip to content

Commit

Permalink
pri_taint no need to check magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Feb 15, 2025
1 parent 3d2ed46 commit 999134e
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions panda/plugins/pri_taint/pri_taint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ void i386_hypercall_callback(CPUState *cpu) {
#else
target_ulong addr = panda_virt_to_phys(cpu, env->regs[R_EBX]);
#endif


if ((int) addr == -1) {
#ifdef TARGET_X86_64
Expand All @@ -374,37 +373,32 @@ void i386_hypercall_callback(CPUState *cpu) {
uint64_t funcaddr = 0;
panda_virtual_memory_read(cpu, phs.info, (uint8_t*)&funcaddr, sizeof(target_ulong));

if (phs.magic == 0xabcd) {
// if the phs action is a pri_query point, see
// lava/include/pirate_mark_lava.h
if (phs.action == 13) {
target_ulong pc = panda_current_pc(cpu);
SrcInfo info;
int rc = pri_get_pc_source_info(cpu, pc, &info);
if (!rc) {
struct args args = {cpu, info.filename, info.line_number, phs.src_filename, funcaddr};
dprintf("[pri_taint] panda hypercall: [%s], "
"ln: %4ld, pc @ 0x" TARGET_FMT_lx "\n",
info.filename,
info.line_number,pc);
pri_funct_livevar_iter(cpu, pc, (liveVarCB) pfun, (void *)&args);
}
else {
if (debug) {
printf("[pri_taint] pri_get_pc_src_info has failed: %d != 0.\n", rc);
}
}
// hypercall_log_trace(phs.src_filename);
// if the phs action is a pri_query point, see
// lava/include/pirate_mark_lava.h
if (phs.action == 13) {
target_ulong pc = panda_current_pc(cpu);
SrcInfo info;
int rc = pri_get_pc_source_info(cpu, pc, &info);
if (!rc) {
struct args args = {cpu, info.filename, info.line_number, phs.src_filename, funcaddr};
dprintf("[pri_taint] panda hypercall: [%s], "
"ln: %4ld, pc @ 0x" TARGET_FMT_lx "\n",
info.filename,
info.line_number,pc);
pri_funct_livevar_iter(cpu, pc, (liveVarCB) pfun, (void *)&args);
}
else {
if (debug) {
printf("[pri_taint] Invalid action value in PHS struct: %d != 13.\n", phs.action);
}
printf("[pri_taint] pri_get_pc_src_info has failed: %d != 0.\n", rc);
}
}
// hypercall_log_trace(phs.src_filename);
}
else {
printf("[pri_taint] Invalid magic value in PHS struct: %x != 0xabcd.\n", phs.magic);
}
if (debug) {
printf("[pri_taint] Invalid action value in PHS struct: %d != 13.\n", phs.action);
}
}
}
else {
if (debug) {
Expand Down

0 comments on commit 999134e

Please sign in to comment.