int tstringsearch_label(CPUState *env, target_ulong pc, target_ulong addr, target_ulong size) { tstringsearch_enable_taint(env, pc); if (tstringsearch_label_on == false) { return 0; } if (!done_labeling && pc == the_pc) { printf ("\n****************************************************************************\n"); printf ("applying taint labels to search string of length %d @ p=0x" TARGET_FMT_lx "\n", the_len, the_buf); printf ("******************************************************************************\n"); // label that buffer int i; for (i=0; i<the_len; i++) { target_ulong va = the_buf + i; hwaddr pa = panda_virt_to_phys(env, va); if (pa != (hwaddr) -1) { if (positional_tainting) { taint2_label_ram(pa, i); } else { taint2_label_ram(pa, 10); } } } tstringsearch_label_on = false; if (only_first) done_labeling = true; } return 0; }
int tstringsearch_label(CPUState *env, target_ulong pc, target_ulong addr, target_ulong size, void *buf) { tstringsearch_enable_taint(env, pc); if (tstringsearch_label_on == false) { return 0; } if (pc == the_pc) { printf ("\n****************************************************************************\n"); printf ("applying taint labels to search string of length %d @ p=0x" TARGET_FMT_lx "\n", the_len, the_buf); printf ("******************************************************************************\n"); // label that buffer int i; for (i=0; i<the_len; i++) { target_ulong va = the_buf + i; target_phys_addr_t pa = cpu_get_phys_addr(cpu_single_env, va); if (pa != (target_phys_addr_t) -1) { if (positional_tainting) { taint2_label_ram(pa, i); } else { taint2_label_ram(pa, 10); } } } tstringsearch_label_on = false; } return 0; }