From: Gerd Knorr <kraxel@bytesex.org>
To: uml devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: [uml-devel] 2.6.11-rc1 ...
Date: Fri, 21 Jan 2005 13:15:32 +0100 [thread overview]
Message-ID: <20050121121532.GA22707@bytesex> (raw)
Hi,
Anyone looked at 2.6.11-rc1 for the host? Some more ptrace cleanups
happened there, and one of the changes conflicts with the sysemu code in
the skas-v7 patch for 2.6.10. To me it's not clear how to solve that
conflict as I'm not familier with the sysemu stuff and how these tree
trace flags (syscall, sysemu, singlestep) play together ...
The conflicting changeset is attached below for reference. There are
also some more ptrace changes (for singlestep) which might need fixups
in sysemu.
Gerd
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/01/01 12:24:01-08:00 torvalds@evo.osdl.org
# x86: common send_sigtrap helper for debug event SIGTRAP's,
# and use that for system call single-step events.
#
# This one also gets the user mode test right, and makes sure
# the siginfo is not leaking any stack contents.
#
# include/asm-i386/ptrace.h
# 2005/01/01 12:23:50-08:00 torvalds@evo.osdl.org +2 -0
# x86: common send_sigtrap helper for debug event SIGTRAP's,
# and use that for system call single-step events.
#
# This one also gets the user mode test right, and makes sure
# the siginfo is not leaking any stack contents.
#
# arch/i386/kernel/traps.c
# 2005/01/01 12:23:50-08:00 torvalds@evo.osdl.org +1 -13
# x86: common send_sigtrap helper for debug event SIGTRAP's,
# and use that for system call single-step events.
#
# This one also gets the user mode test right, and makes sure
# the siginfo is not leaking any stack contents.
#
# arch/i386/kernel/ptrace.c
# 2005/01/01 12:23:50-08:00 torvalds@evo.osdl.org +27 -5
# x86: common send_sigtrap helper for debug event SIGTRAP's,
# and use that for system call single-step events.
#
# This one also gets the user mode test right, and makes sure
# the siginfo is not leaking any stack contents.
#
diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c 2005-01-21 12:08:33 +01:00
+++ b/arch/i386/kernel/ptrace.c 2005-01-21 12:08:33 +01:00
@@ -553,6 +553,24 @@
return ret;
}
+void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
+{
+ struct siginfo info;
+
+ tsk->thread.trap_no = 1;
+ tsk->thread.error_code = error_code;
+
+ memset(&info, 0, sizeof(info));
+ info.si_signo = SIGTRAP;
+ info.si_code = TRAP_BRKPT;
+
+ /* User-mode eip? */
+ info.si_addr = user_mode(regs) ? (void __user *) regs->eip : NULL;
+
+ /* Send us the fakey SIGTRAP */
+ force_sig_info(SIGTRAP, &info, tsk);
+}
+
/* notification of system call entry/exit
* - triggered by current->work.syscall_trace
*/
@@ -568,15 +586,19 @@
audit_syscall_exit(current, regs->eax);
}
- if (!test_thread_flag(TIF_SYSCALL_TRACE) &&
- !test_thread_flag(TIF_SINGLESTEP))
- return;
if (!(current->ptrace & PT_PTRACED))
return;
+
+ /* Fake a debug trap */
+ if (test_thread_flag(TIF_SINGLESTEP))
+ send_sigtrap(current, regs, 0);
+
+ if (!test_thread_flag(TIF_SYSCALL_TRACE))
+ return;
+
/* the 0x80 provides a way for the tracing parent to distinguish
between a syscall stop and SIGTRAP delivery */
- ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) &&
- !test_thread_flag(TIF_SINGLESTEP) ? 0x80 : 0));
+ ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
/*
* this isn't the same as continuing with a signal, but it will do
diff -Nru a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
--- a/arch/i386/kernel/traps.c 2005-01-21 12:08:33 +01:00
+++ b/arch/i386/kernel/traps.c 2005-01-21 12:08:33 +01:00
@@ -682,7 +682,6 @@
{
unsigned int condition;
struct task_struct *tsk = current;
- siginfo_t info;
__asm__ __volatile__("movl %%db6,%0" : "=r" (condition));
@@ -723,18 +722,7 @@
}
/* Ok, finally something we can handle */
- tsk->thread.trap_no = 1;
- tsk->thread.error_code = error_code;
- info.si_signo = SIGTRAP;
- info.si_errno = 0;
- info.si_code = TRAP_BRKPT;
-
- /* If this is a kernel mode trap, save the user PC on entry to
- * the kernel, that's what the debugger can make sense of.
- */
- info.si_addr = ((regs->xcs & 3) == 0) ? (void __user *)tsk->thread.eip
- : (void __user *)regs->eip;
- force_sig_info(SIGTRAP, &info, tsk);
+ send_sigtrap(tsk, regs, error_code);
/* Disable additional traps. They'll be re-enabled when
* the signal is delivered.
diff -Nru a/include/asm-i386/ptrace.h b/include/asm-i386/ptrace.h
--- a/include/asm-i386/ptrace.h 2005-01-21 12:08:33 +01:00
+++ b/include/asm-i386/ptrace.h 2005-01-21 12:08:33 +01:00
@@ -55,6 +55,8 @@
#define PTRACE_SET_THREAD_AREA 26
#ifdef __KERNEL__
+struct task_struct;
+extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
#define user_mode(regs) ((VM_MASK & (regs)->eflags) || (3 & (regs)->xcs))
#define instruction_pointer(regs) ((regs)->eip)
#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next reply other threads:[~2005-01-21 12:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-21 12:15 Gerd Knorr [this message]
2005-01-21 13:07 ` [uml-devel] 2.6.11-rc1 Blaisorblade
2005-01-29 23:34 ` Anthony Brock
[not found] ` <20050209173336.GE14590@bytesex>
2005-02-10 12:43 ` [uml-devel] Ported SKAS3-v7 (and partially -V8) for 2.6.11. Uncleanness about SYSEMU_SINGLESTEP Blaisorblade
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=20050121121532.GA22707@bytesex \
--to=kraxel@bytesex.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/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.