[lkml]   [2000]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject2.0/2.2 Bug: SIGTRAP lost

If a process executes an int3 (breakpoint) instruction while
another process is attaching to it, the SIGTRAP can be lost. This bug
is present in 2.4.0-test8 and 2.2.14.

Below is a program that demonstrates this behavior. It forks a
child that repeatedly executes an int3 and handles the SIGTRAP. The
parent repeatedly attaches and detaches to the child. Eventually the
SIGTRAP generated by the int3 is lost, and the child falls through (to
the fprintf).

Vic Zandy

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <sys/ptrace.h>

long int dptrace(enum __ptrace_request req, pid_t pid,
void *addr, void *data)
int rv;
rv = ptrace(req, pid, addr, data);
if (0 > rv) {
return rv;

void do_trace(int pid)
while (1) {
dptrace(PTRACE_ATTACH, pid, 0, 0);
waitpid(pid, 0, 0);
dptrace(PTRACE_DETACH, pid, 0, 0);

void handler(int sig, struct sigcontext uap)

void do_int3()
struct sigaction sa;
sa.sa_handler = (void (*)(int)) handler;
sa.sa_flags = 0;
sigaction(SIGTRAP, &sa, NULL);

asm("int3"); /* Should loop here */
fprintf(stderr, "Bug triggered\n");

int main(int argc, char *argv[])
int pid;
pid = fork();
if (pid)
return 0;
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:38    [W:0.030 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site