All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juho Snellman <jsnell@iki.fi>
To: linux-kernel@vger.kernel.org
Subject: x86-64: int3 no longer causes SIGTRAP in 2.6.10
Date: Tue, 18 Jan 2005 03:12:45 +0200	[thread overview]
Message-ID: <20050118011244.GA23256@iki.fi> (raw)

2.6.10 changed the behaviour of the int3 instruction on x86-64. It
used to result in a SIGTRAP, now it's a SIGSEGV in both native and
32-bit legacy modes. This was apparently caused by the kprobe port,
specifically this part:

--- a/arch/x86_64/kernel/traps.c        2004-12-24 13:36:17 -08:00
+++ b/arch/x86_64/kernel/traps.c        2004-12-24 13:36:17 -08:00
@@ -862,8 +910,8 @@
        set_intr_gate(0,&divide_error);
        set_intr_gate_ist(1,&debug,DEBUG_STACK);
        set_intr_gate_ist(2,&nmi,NMI_STACK);
-       set_system_gate(3,&int3);       /* int3-5 can be called from all */
-       set_system_gate(4,&overflow);
+       set_intr_gate(3,&int3);
+       set_system_gate(4,&overflow);   /* int4-5 can be called from all */

Was effectively disabling int3 a conscious decision, or just an
unintended side-effect? This breaks at least Steel Bank Common Lisp
(x86 and x86-64) and CMU Common Lisp (x86), which use int3 for error
traps and breakpoints.

Simple test case:

% cat foo.c  
int main (void) {
    asm("int3");
    return 0;
}
% gcc -o foo foo.c
% ./foo
zsh: trace trap  ./foo
% gcc -m32 -o foo-32 foo.c
% ./foo-32
zsh: trace trap  ./foo-32

[ reboot ]

% uname -a
Linux kiki 2.6.10 #2 Sun Dec 26 04:54:05 EET 2004 x86_64 x86_64 x86_64
% ./foo
zsh: segmentation fault  ./foo
% ./foo-32
zsh: segmentation fault  ./foo-32

-- 
Juho Snellman

             reply	other threads:[~2005-01-18  1:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-18  1:12 Juho Snellman [this message]
2005-01-18  1:47 ` x86-64: int3 no longer causes SIGTRAP in 2.6.10 Andi Kleen
2005-01-18  8:49   ` Prasanna S Panchamukhi
2005-01-18  8:52     ` Andi Kleen
2005-01-19 11:36       ` Prasanna S Panchamukhi
2005-01-19 12:19         ` Andi Kleen

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=20050118011244.GA23256@iki.fi \
    --to=jsnell@iki.fi \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.