Skip to content

Commit

Permalink
Partially unbitrot ptraceomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Aug 1, 2017
1 parent 3bb7f38 commit 46446b3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
7 changes: 7 additions & 0 deletions tools/ptraceomatic.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,13 @@ static void step_tracing(struct cpu_state *cpu, int pid, int sender, int receive
pt_copy(pid, regs.rbx, sizeof(struct uname)); break;
case 140: // _llseek
pt_copy(pid, regs.rsi, 8); break;
case 145: { // readv
struct io_vec vecs[regs.rdx];
user_get_count(regs.rcx, vecs, sizeof(vecs));
for (int i = 0; i < regs.rdx; i++)
pt_copy(pid, vecs[i].base, vecs[i].len);
break;
}
case 183: // getcwd
pt_copy(pid, regs.rbx, cpu->eax); break;

Expand Down
18 changes: 13 additions & 5 deletions tools/undefined-flags.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@ int undefined_flags_mask(int pid, struct cpu_state *cpu) {
case 0x0f:
read(opcode);
switch(opcode) {
case 0xaf: return S|Z|A|P; // imul
case 0xac: {
case 0xac:
case 0xad: {
ip++;
byte_t shift_count;
read(shift_count);
if (shift_count > 0)
byte_t shift;
if (opcode == 0xad)
shift = cpu->cl;
else
read(shift);
if (shift == 1)
return A;
else if (shift > 1)
return O|A;
break;
}
case 0xaf: return S|Z|A|P; // imul
case 0xbc: return O|S|A|P|C; // bsf
}
break;
case 0x69:
case 0x6b: return S|Z|A|P; // imul

case 0xc0:
Expand Down

0 comments on commit 46446b3

Please sign in to comment.