Skip to contentSkip to conversation

x86 updates for v2.6.28, phase #5, signal code

GIT PULL Ingo Molnar 1 participant 2 messages Oct 10, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest x86-v28-for-linus-phase5 git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-v28-for-linus-phase5

tip/x86/signal and tip/core/signal topics.

out-of-topic modifications in x86-v28-for-linus-phase5:
-------------------------------------------------------
arch/ia64/include/asm/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s
arch/powerpc/include/asm/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s
include/asm-generic/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s
include/asm-parisc/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s

Thanks,

Ingo

------------------>
Hiroshi Shimamoto (22):
x86_32: signal: use syscall_get_nr and error
x86_32: signal: introduce signal_fault()
x86: signal: make NR_restart_syscall
x86: signal: split out frame setups
x86_32: signal: move signal number conversion to upper layer
x86: signal_64.c: clean up signal_fault()
x86: signal_64.c: arg for restore_i387_xstate() is void __user *
x86: signal_64.c: make handle_signal() similar
x86: signal: put give_sigsegv of setup frames together
x86: signal: remove unneeded err handling
x86: signal: introduce do_rt_sigreturn()
x86: signal: cosmetic unification of do_signal()
x86: signal: cosmetic unification of do_notify_resume()
x86: signal: cosmetic unification of handle_signal()
x86: signal_32.c: introduce signr_convert()
x86: signal_64.c: introduce helper function signr_convert()
x86: signal: introduce helper macro is_ia32
x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame
x86: ia32_signal.c: remove unnecessary cast to u32
x86: ia32_signal.c remove unnecessary function calls
x86: signal: move macros out from restore_sigcontext()
x86: signal: remove indent in restore_sigcontext()

Srinivasa Ds (2):
signals: demultiplexing SIGTRAP signal
signals: demultiplexing SIGTRAP signal, fix

 arch/ia64/include/asm/siginfo.h    |    5 -
 arch/powerpc/include/asm/siginfo.h |    5 -
 arch/x86/ia32/ia32_signal.c        |   68 +++++-------
 arch/x86/kernel/ptrace.c           |    7 +-
 arch/x86/kernel/signal_32.c        |  222 ++++++++++++++++++++++--------------
 arch/x86/kernel/signal_64.c        |  207 ++++++++++++++++++++-------------
 arch/x86/kernel/traps_32.c         |    4 +-
 arch/x86/kernel/traps_64.c         |    2 +-
 include/asm-generic/siginfo.h      |    2 +
 include/asm-parisc/siginfo.h       |    5 -
 include/asm-x86/ptrace.h           |    6 +-
 include/asm-x86/traps.h            |   12 ++
 12 files changed, 310 insertions(+), 235 deletions(-)
arch/ia64/include/asm/siginfo.h +0 -5
index 9294e4b..118d429 100644
@@ -113,11 +113,6 @@ typedef struct siginfo {
 #undef NSIGSEGV
 #define NSIGSEGV	3
 
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH	(__SI_FAULT|3)	/* process taken branch trap */
-#define TRAP_HWBKPT	(__SI_FAULT|4)	/* hardware breakpoint or watchpoint */
 #undef NSIGTRAP
 #define NSIGTRAP	4
 
arch/powerpc/include/asm/siginfo.h +0 -5
index 12f1bce..49495b0 100644
@@ -15,11 +15,6 @@
 
 #include <asm-generic/siginfo.h>
 
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH	(__SI_FAULT|3)	/* process taken branch trap */
-#define TRAP_HWBKPT	(__SI_FAULT|4)	/* hardware breakpoint or watchpoint */
 #undef NSIGTRAP
 #define NSIGTRAP	4
 
arch/x86/ia32/ia32_signal.c +27 -41

132 lines not on this page · raw message

arch/x86/kernel/ptrace.c +4 -3
index e375b65..42ec442 100644
@@ -1452,7 +1452,8 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
 #endif
 }
 
-void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
+void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
+					 int error_code, int si_code)
 {
 	struct siginfo info;
 
@@ -1461,7 +1462,7 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
 
 	memset(&info, 0, sizeof(info));
 	info.si_signo = SIGTRAP;
-	info.si_code = TRAP_BRKPT;
+	info.si_code = si_code;
 
 	/* User-mode ip? */
 	info.si_addr = user_mode_vm(regs) ? (void __user *) regs->ip : NULL;
@@ -1548,5 +1549,5 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
 	 */
 	if (test_thread_flag(TIF_SINGLESTEP) &&
 	    tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL))
-		send_sigtrap(current, regs, 0);
+		send_sigtrap(current, regs, 0, TRAP_BRKPT);
 }
arch/x86/kernel/signal_32.c +134 -88

389 lines not on this page · raw message

arch/x86/kernel/signal_64.c +124 -83

344 lines not on this page · raw message

arch/x86/kernel/traps_32.c +3 -1
index da5a596..0429c5d 100644
@@ -891,6 +891,7 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code)
 {
 	struct task_struct *tsk = current;
 	unsigned int condition;
+	int si_code;
 
 	trace_hardirqs_fixup();
 
@@ -935,8 +936,9 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code)
 			goto clear_TF_reenable;
 	}
 
+	si_code = get_si_code((unsigned long)condition);
 	/* Ok, finally something we can handle */
-	send_sigtrap(tsk, regs, error_code);
+	send_sigtrap(tsk, regs, error_code, si_code);
 
 	/*
 	 * Disable additional traps. They'll be re-enabled when
arch/x86/kernel/traps_64.c +1 -1
index 2887a78..9c0ac0c 100644
@@ -940,7 +940,7 @@ asmlinkage void __kprobes do_debug(struct pt_regs *regs,
 	tsk->thread.error_code = error_code;
 	info.si_signo = SIGTRAP;
 	info.si_errno = 0;
-	info.si_code = TRAP_BRKPT;
+	info.si_code = get_si_code(condition);
 	info.si_addr = user_mode(regs) ? (void __user *)regs->ip : NULL;
 	force_sig_info(SIGTRAP, &info, tsk);
 
include/asm-generic/siginfo.h +2 -0
index 8786e01..9695701 100644
@@ -199,6 +199,8 @@ typedef struct siginfo {
  */
 #define TRAP_BRKPT	(__SI_FAULT|1)	/* process breakpoint */
 #define TRAP_TRACE	(__SI_FAULT|2)	/* process trace trap */
+#define TRAP_BRANCH     (__SI_FAULT|3)  /* process taken branch trap */
+#define TRAP_HWBKPT     (__SI_FAULT|4)  /* hardware breakpoint/watchpoint */
 #define NSIGTRAP	2
 
 /*
include/asm-parisc/siginfo.h +0 -5
index d4909f5..d703472 100644
@@ -3,11 +3,6 @@
 
 #include <asm-generic/siginfo.h>
 
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH	(__SI_FAULT|3)	/* process taken branch trap */
-#define TRAP_HWBKPT	(__SI_FAULT|4)	/* hardware breakpoint or watchpoint */
 #undef NSIGTRAP
 #define NSIGTRAP	4
 
include/asm-x86/ptrace.h +3 -3
index d64a610..ac578f1 100644
@@ -177,11 +177,11 @@ convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
 
 #ifdef CONFIG_X86_32
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
-			 int error_code);
-#else
-void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
+			 int error_code, int si_code);
 #endif
 
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
+
 extern long syscall_trace_enter(struct pt_regs *);
 extern void syscall_trace_leave(struct pt_regs *);
 
include/asm-x86/traps.h +12 -0
index 2ccebc6..7a692ba 100644
@@ -1,6 +1,8 @@
 #ifndef ASM_X86__TRAPS_H
 #define ASM_X86__TRAPS_H
 
+#include <asm/debugreg.h>
+
 /* Common in X86_32 and X86_64 */
 asmlinkage void divide_error(void);
 asmlinkage void debug(void);
@@ -36,6 +38,16 @@ void do_invalid_op(struct pt_regs *, long);
 void do_general_protection(struct pt_regs *, long);
 void do_nmi(struct pt_regs *, long);
 
+static inline int get_si_code(unsigned long condition)
+{
+	if (condition & DR_STEP)
+		return TRAP_TRACE;
+	else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
+		return TRAP_HWBKPT;
+	else
+		return TRAP_BRKPT;
+}
+
 extern int panic_on_unrecovered_nmi;
 extern int kstack_depth_to_print;
 
#1 lore raw

[git pull, take 2] x86 and core updates for v2.6.28, phase #5, signal code

Quoted 5 lines · Ingo Molnar

Linus,

Please pull the latest x86-v28-for-linus-phase5 git tree from:

tip/x86/signal and tip/core/signal topics.

updated pull request relative to x86-v28-for-linus-phase4-C. Used cached conflict resolutions.

Ingo

------------------>
Linus,

Please pull the latest x86-v28-for-linus-phase5-B git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git x86-v28-for-linus-phase5-B

out-of-topic modifications in x86-v28-for-linus-phase5-B:
---------------------------------------------------------
arch/ia64/include/asm/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s
arch/powerpc/include/asm/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s
include/asm-generic/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s
include/asm-parisc/siginfo.h # da654b7: signals: demultiplexing SIGTRAP s

Thanks,

Ingo

------------------>
Hiroshi Shimamoto (22):
x86_32: signal: use syscall_get_nr and error
x86_32: signal: introduce signal_fault()
x86: signal: make NR_restart_syscall
x86: signal: split out frame setups
x86_32: signal: move signal number conversion to upper layer
x86: signal_64.c: clean up signal_fault()
x86: signal_64.c: arg for restore_i387_xstate() is void __user *
x86: signal_64.c: make handle_signal() similar
x86: signal: put give_sigsegv of setup frames together
x86: signal: remove unneeded err handling
x86: signal: introduce do_rt_sigreturn()
x86: signal: cosmetic unification of do_signal()
x86: signal: cosmetic unification of do_notify_resume()
x86: signal: cosmetic unification of handle_signal()
x86: signal_32.c: introduce signr_convert()
x86: signal_64.c: introduce helper function signr_convert()
x86: signal: introduce helper macro is_ia32
x86: signal_32.c: introduce macro ia32_setup_frame and ia32_setup_rt_frame
x86: ia32_signal.c: remove unnecessary cast to u32
x86: ia32_signal.c remove unnecessary function calls
x86: signal: move macros out from restore_sigcontext()
x86: signal: remove indent in restore_sigcontext()

Srinivasa Ds (2):
signals: demultiplexing SIGTRAP signal
signals: demultiplexing SIGTRAP signal, fix

 arch/ia64/include/asm/siginfo.h    |    5 -
 arch/powerpc/include/asm/siginfo.h |    5 -
 arch/x86/ia32/ia32_signal.c        |   68 +++++-------
 arch/x86/kernel/ptrace.c           |    7 +-
 arch/x86/kernel/signal_32.c        |  222 ++++++++++++++++++++++--------------
 arch/x86/kernel/signal_64.c        |  207 ++++++++++++++++++++-------------
 arch/x86/kernel/traps_32.c         |    4 +-
 arch/x86/kernel/traps_64.c         |    2 +-
 include/asm-generic/siginfo.h      |    2 +
 include/asm-parisc/siginfo.h       |    5 -
 include/asm-x86/ptrace.h           |    6 +-
 include/asm-x86/traps.h            |   12 ++
 12 files changed, 310 insertions(+), 235 deletions(-)
arch/ia64/include/asm/siginfo.h +0 -5
index 9294e4b..118d429 100644
@@ -113,11 +113,6 @@ typedef struct siginfo {
 #undef NSIGSEGV
 #define NSIGSEGV	3
 
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH	(__SI_FAULT|3)	/* process taken branch trap */
-#define TRAP_HWBKPT	(__SI_FAULT|4)	/* hardware breakpoint or watchpoint */
 #undef NSIGTRAP
 #define NSIGTRAP	4
 
arch/powerpc/include/asm/siginfo.h +0 -5
index 12f1bce..49495b0 100644
@@ -15,11 +15,6 @@
 
 #include <asm-generic/siginfo.h>
 
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH	(__SI_FAULT|3)	/* process taken branch trap */
-#define TRAP_HWBKPT	(__SI_FAULT|4)	/* hardware breakpoint or watchpoint */
 #undef NSIGTRAP
 #define NSIGTRAP	4
 
arch/x86/ia32/ia32_signal.c +27 -41

132 lines not on this page · raw message

arch/x86/kernel/ptrace.c +4 -3
index e375b65..42ec442 100644
@@ -1452,7 +1452,8 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
 #endif
 }
 
-void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
+void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
+					 int error_code, int si_code)
 {
 	struct siginfo info;
 
@@ -1461,7 +1462,7 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
 
 	memset(&info, 0, sizeof(info));
 	info.si_signo = SIGTRAP;
-	info.si_code = TRAP_BRKPT;
+	info.si_code = si_code;
 
 	/* User-mode ip? */
 	info.si_addr = user_mode_vm(regs) ? (void __user *) regs->ip : NULL;
@@ -1548,5 +1549,5 @@ asmregparm void syscall_trace_leave(struct pt_regs *regs)
 	 */
 	if (test_thread_flag(TIF_SINGLESTEP) &&
 	    tracehook_consider_fatal_signal(current, SIGTRAP, SIG_DFL))
-		send_sigtrap(current, regs, 0);
+		send_sigtrap(current, regs, 0, TRAP_BRKPT);
 }
arch/x86/kernel/signal_32.c +134 -88

389 lines not on this page · raw message

arch/x86/kernel/signal_64.c +124 -83

344 lines not on this page · raw message

arch/x86/kernel/traps_32.c +3 -1
index da5a596..0429c5d 100644
@@ -891,6 +891,7 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code)
 {
 	struct task_struct *tsk = current;
 	unsigned int condition;
+	int si_code;
 
 	trace_hardirqs_fixup();
 
@@ -935,8 +936,9 @@ void __kprobes do_debug(struct pt_regs *regs, long error_code)
 			goto clear_TF_reenable;
 	}
 
+	si_code = get_si_code((unsigned long)condition);
 	/* Ok, finally something we can handle */
-	send_sigtrap(tsk, regs, error_code);
+	send_sigtrap(tsk, regs, error_code, si_code);
 
 	/*
 	 * Disable additional traps. They'll be re-enabled when
arch/x86/kernel/traps_64.c +1 -1
index 2887a78..9c0ac0c 100644
@@ -940,7 +940,7 @@ asmlinkage void __kprobes do_debug(struct pt_regs *regs,
 	tsk->thread.error_code = error_code;
 	info.si_signo = SIGTRAP;
 	info.si_errno = 0;
-	info.si_code = TRAP_BRKPT;
+	info.si_code = get_si_code(condition);
 	info.si_addr = user_mode(regs) ? (void __user *)regs->ip : NULL;
 	force_sig_info(SIGTRAP, &info, tsk);
 
include/asm-generic/siginfo.h +2 -0
index 8786e01..9695701 100644
@@ -199,6 +199,8 @@ typedef struct siginfo {
  */
 #define TRAP_BRKPT	(__SI_FAULT|1)	/* process breakpoint */
 #define TRAP_TRACE	(__SI_FAULT|2)	/* process trace trap */
+#define TRAP_BRANCH     (__SI_FAULT|3)  /* process taken branch trap */
+#define TRAP_HWBKPT     (__SI_FAULT|4)  /* hardware breakpoint/watchpoint */
 #define NSIGTRAP	2
 
 /*
include/asm-parisc/siginfo.h +0 -5
index d4909f5..d703472 100644
@@ -3,11 +3,6 @@
 
 #include <asm-generic/siginfo.h>
 
-/*
- * SIGTRAP si_codes
- */
-#define TRAP_BRANCH	(__SI_FAULT|3)	/* process taken branch trap */
-#define TRAP_HWBKPT	(__SI_FAULT|4)	/* hardware breakpoint or watchpoint */
 #undef NSIGTRAP
 #define NSIGTRAP	4
 
include/asm-x86/ptrace.h +3 -3
index d64a610..ac578f1 100644
@@ -177,11 +177,11 @@ convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs);
 
 #ifdef CONFIG_X86_32
 extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
-			 int error_code);
-#else
-void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
+			 int error_code, int si_code);
 #endif
 
+void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
+
 extern long syscall_trace_enter(struct pt_regs *);
 extern void syscall_trace_leave(struct pt_regs *);
 
include/asm-x86/traps.h +12 -0
index 2ccebc6..7a692ba 100644
@@ -1,6 +1,8 @@
 #ifndef ASM_X86__TRAPS_H
 #define ASM_X86__TRAPS_H
 
+#include <asm/debugreg.h>
+
 /* Common in X86_32 and X86_64 */
 asmlinkage void divide_error(void);
 asmlinkage void debug(void);
@@ -36,6 +38,16 @@ void do_invalid_op(struct pt_regs *, long);
 void do_general_protection(struct pt_regs *, long);
 void do_nmi(struct pt_regs *, long);
 
+static inline int get_si_code(unsigned long condition)
+{
+	if (condition & DR_STEP)
+		return TRAP_TRACE;
+	else if (condition & (DR_TRAP0|DR_TRAP1|DR_TRAP2|DR_TRAP3))
+		return TRAP_HWBKPT;
+	else
+		return TRAP_BRKPT;
+}
+
 extern int panic_on_unrecovered_nmi;
 extern int kstack_depth_to_print;