From: Luca Barbieri <ldb@ldb.ods.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@transmeta.com>,
Linux-Kernel ML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] (re-xmit): kprobes for i386
Date: 20 Aug 2002 13:54:24 +0200 [thread overview]
Message-ID: <1029844464.1745.49.camel@ldb> (raw)
In-Reply-To: <20020819235020.56DF12C483@lists.samba.org>
[-- Attachment #1: Type: text/plain, Size: 1407 bytes --]
> ENTRY(debug)
> + pushl %eax
> + SAVE_ALL
> + movl %esp,%edx
> pushl $0
> - pushl $do_debug
> - jmp error_code
> + pushl %edx
> + call do_debug
> + addl $8,%esp
> + testl %eax,%eax
> + jnz restore_all
> + jmp ret_from_exception
How about checking %cs in assembly and branching off for the kernel-mode
case?
Something like this:
ENTRY(debug)
testl $0x3, 4(%esp)
jz handle_kernel_mode_debug
> + /*
> + * We singlestepped with interrupts disabled. So, the result on
> + * the stack would be incorrect for "pushfl" instruction.
> + */
> + if (current_kprobe->opcode == 0x9c) { /* pushfl */
> + regs->esp &= ~(TF_MASK | IF_MASK);
> + regs->esp |= kprobe_old_eflags;
> + }
This masks the stack pointer. It should mask the value pointer at by the
stack pointer.
> + if (kprobe_running() && kprobe_fault_handler(regs, trapnr))
> + return;
> if (!(regs->xcs & 3))
> goto kernel_trap;
The kprobe check should be after the kernel_trap label.
> + if (kprobe_running() && kprobe_fault_handler(regs, 13))
> + return;
>
> if (!(regs->xcs & 3))
> goto gp_in_kernel;
Same here.
kernel. Therefore
> - return;
> + return 0;
Branching off in assembly would avoid having a return value in do_debug.
> + if (kprobe_running() && kprobe_fault_handler(®s, 7))
> + return;
kprobe_running should be inline.
> + if (kprobe_running() && kprobe_fault_handler(regs, 14))
> + return;
> +
Same here.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2002-08-20 11:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-20 4:39 [PATCH] (re-xmit): kprobes for i386 Rusty Russell
2002-08-20 8:19 ` Christoph Hellwig
2002-08-20 10:25 ` Rusty Russell
2002-08-20 11:54 ` Luca Barbieri [this message]
[not found] ` <3D62365E.8030905@iram.es>
2002-08-20 14:06 ` Luca Barbieri
2002-08-20 19:29 ` Linus Torvalds
2002-08-21 1:03 ` Rusty Russell
2002-08-21 1:29 ` Luca Barbieri
2002-08-21 4:21 ` Rusty Russell
2002-08-21 8:31 ` Vamsi Krishna S .
2002-08-21 10:48 ` Rusty Russell
2002-08-21 12:33 ` Vamsi Krishna S .
-- strict thread matches above, loose matches on Subject: below --
2002-09-20 6:16 [PATCH] Re-xmit: " Rusty Russell
2002-08-12 8:18 [PATCH] (Re-xmit) " Rusty Russell
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=1029844464.1745.49.camel@ldb \
--to=ldb@ldb.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@transmeta.com \
/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