From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262101AbUEKGOg (ORCPT ); Tue, 11 May 2004 02:14:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262132AbUEKGOg (ORCPT ); Tue, 11 May 2004 02:14:36 -0400 Received: from x35.xmailserver.org ([69.30.125.51]:35222 "EHLO x35.xmailserver.org") by vger.kernel.org with ESMTP id S262129AbUEKGOe (ORCPT ); Tue, 11 May 2004 02:14:34 -0400 X-AuthUser: davidel@xmailserver.org Date: Mon, 10 May 2004 23:14:32 -0700 (PDT) From: Davide Libenzi X-X-Sender: davide@bigblue.dev.mdolabs.com To: Fabiano Ramos cc: Daniel Jacobowitz , OGAWA Hirofumi , Andi Kleen , Linux Kernel Mailing List Subject: Re: ptrace in 2.6.5 In-Reply-To: <1084236054.1763.25.camel@slack.domain.invalid> Message-ID: References: <1UlcA-6lq-9@gated-at.bofh.it> <1084220684.1798.3.camel@slack.domain.invalid> <877jvkx88r.fsf@devron.myhome.or.jp> <873c67yk5v.fsf@devron.myhome.or.jp> <20040510225818.GA24796@nevyn.them.org> <1084236054.1763.25.camel@slack.domain.invalid> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 May 2004, Fabiano Ramos wrote: > The question is: the int 0x80 can be seen as complex instructions that > is only completed after the iret. This way, I do not see why a debug > trap is not generated afer the int 0x80 and BEFORE the mov. > > I reinvented the wheel and built a module that did the same thing as > a singlestep ptrace, and a the trap WAS generated after the int 0x80 > completed, before the mov. > > So I think it has sth to do with the debug trap handler. > > I DO NOT BELIEVE THIS BEAVIOUR is right, since if it is not stopping > after the int 0x80, ptrace is not TRULLY singlestepping. If you look at the Intel manual 24319202 page 44 (TF bit), it clearly says that the trap is generated on the instruction that follows the IRET. In the same doc, at page 145, it also says that the return address seen by the trap handler is the one following the trapped instructuion (INT#1 is a trap). Ideally, I'm with you in expecting a full trace on all the instructions (out of INTs), but this doesn't seem to be what documented. On the kernel side, this would be pretty much solved by issuing a ptrace op, with a modified EIP (+2) on return from a syscall (if in single-step mode). - Davide