[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20110617190837.GA18917@redhat.com>
Date: Fri, 17 Jun 2011 21:08:37 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Pedro Alves <pedro@...esourcery.com>
Cc: Tejun Heo <tj@...nel.org>,
Denys Vlasenko <vda.linux@...glemail.com>,
jan.kratochvil@...hat.com, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
indan@....nu, bdonlan@...il.com
Subject: Re: [PATCHSET ptrace] ptrace: implement PTRACE_SEIZE/INTERRUPT and
group stop notification, take#4
On 06/16, Pedro Alves wrote:
>
> On Thursday 16 June 2011 09:38:28, Tejun Heo wrote:
> > On Fri, Jun 03, 2011 at 11:25:15AM +0100, Pedro Alves wrote:
> > > It'd be _very_ useful for x86 (and others) to have
> > > something like TRAP_BRKPT for int3. Both for ptracers
> > > and in-process self debuggers.
> > >
> > > I'd be super happy to be told we have that already
> > > in recent kernels and I missed it. :-)
> >
> > Unfortunately, AFAICS, x86 doesn't have it nor is there a generic
> > mechanism, but this should be solvable without disrupting existing
> > users.
>
> Hmm, looks like there was an earlier attempt:
>
> <http://lkml.indiana.edu/hypermail/linux/kernel/0809.2/1898.html>
>
> Reading that thread, there were some minor revisions, but I didn't
> see any objection. It seems that patch made it 2.6.28 (the only
> sources I have handy), as I see get_si_code calls in arch/x86/kernel/traps.c,
> and arch/x86/include/asm/traps.h.
Yes, this works (I think). But this handles the X86_EFLAGS_TF case, for
example PTRACE_SINGLESTEP.
> But, I'm running 2.6.38, x86-64, and
>
> #include <stdio.h>
> #include <string.h>
> #include <signal.h>
>
> static void
> handler (int sig, siginfo_t *info, void *context)
> {
> printf ("si_code = %x\n", info->si_code);
> }
>
> int
> main (void)
> {
> struct sigaction action;
>
> memset (&action, 0, sizeof (action));
> action.sa_sigaction = handler;
> action.sa_flags |= SA_SIGINFO;
> sigaction (SIGTRAP, &action, NULL);
>
> asm volatile ("int3");
>
> return 0;
> }
>
> still prints:
>
> $ ./trap
> si_code = 80
Yes. do_int3() simply calls force_sig(SIGTRAP). Trivial to change, I think.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists