mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "In Cognito" <defend.the.world@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: ptrace still broken- PTRACE_CONT trap flag, and debug state
Date: Fri, 25 May 2007 06:57:33 -0400	[thread overview]
Message-ID: <5a20704e0705250357j3b45e0dpb6d3d0d907af4da3@mail.gmail.com> (raw)

Hello,

main(){
__asm__("pushf\r\n"
               "popf\r\n"
              );
}

Single stepping through the "pushf" instruction and then attempting to
PTRACE_CONT will generate SIGTRAPs at each instruction. Although the
trap flag appears to not be set according to GETREG values, the pushf
will push a value with the TF bit on, which is then restored with
popf...

Here's an example of single stepping on a 2.6.8 and the trap flag
(uppercase letter means enabled):

8048351: push %ecx.
  eax=bffff7cc ebx=40146adc ecx=bffff740 edx=00000001
  esi=bffff7c4 edi=bffff750 ebp=bffff728 esp=bffff724
  flags= [c] [P] [a] [z] [S] [T] [I] [df] [id]

8048352: pushf .
  eax=bffff7cc ebx=40146adc ecx=bffff740 edx=00000001
  esi=bffff7c4 edi=bffff750 ebp=bffff728 esp=bffff720
  flags= [c] [P] [a] [z] [S] [T] [I] [df] [id]

8048353: popf .
  eax=bffff7cc ebx=40146adc ecx=bffff740 edx=00000001
  esi=bffff7c4 edi=bffff750 ebp=bffff728 esp=bffff724
  flags= [c] [P] [a] [z] [S] [T] [I] [df] [id]

8048354: pop %ecx.
  eax=bffff7cc ebx=40146adc ecx=bffff740 edx=00000001
  esi=bffff7c4 edi=bffff750 ebp=bffff728 esp=bffff728
  flags= [c] [P] [a] [z] [S] [T] [I] [df] [id]



and a 2.6.20



8048351: push %ecx.
  eax=bfcff654 ebx=b7f52ff4 ecx=bfcff5d0 edx=00000001
  esi=b7f80ce0 edi=00000000 ebp=bfcff5b8 esp=bfcff5b4
  flags= [c] [P] [a] [z] [S] [t] [I] [df] [id] 286

8048352: pushf .
  eax=bfcff654 ebx=b7f52ff4 ecx=bfcff5d0 edx=00000001
  esi=b7f80ce0 edi=00000000 ebp=bfcff5b8 esp=bfcff5b0
  flags= [c] [P] [a] [z] [S] [t] [I] [df] [id] 286

8048353: popf .
  eax=bfcff654 ebx=b7f52ff4 ecx=bfcff5d0 edx=00000001
  esi=b7f80ce0 edi=00000000 ebp=bfcff5b8 esp=bfcff5b4
  flags= [c] [P] [a] [z] [S] [T] [I] [df] [id] 386

8048354: pop %ecx.
  eax=bfcff654 ebx=b7f52ff4 ecx=bfcff5d0 edx=00000001
  esi=b7f80ce0 edi=00000000 ebp=bfcff5b8 esp=bfcff5b8
  flags= [c] [P] [a] [z] [S] [T] [I] [df] [id] 386



I'm not sure where along the line this was broken but it looks like
there were more than a few changes...

                 reply	other threads:[~2007-05-25 10:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a20704e0705250357j3b45e0dpb6d3d0d907af4da3@mail.gmail.com \
    --to=defend.the.world@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®