aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ptrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/ptrace.c')
-rw-r--r--arch/x86/kernel/ptrace.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 7079ddaf0731..77b60085a810 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -1676,21 +1676,33 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
1676#endif 1676#endif
1677} 1677}
1678 1678
1679void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, 1679static void fill_sigtrap_info(struct task_struct *tsk,
1680 int error_code, int si_code) 1680 struct pt_regs *regs,
1681 int error_code, int si_code,
1682 struct siginfo *info)
1681{ 1683{
1682 struct siginfo info;
1683
1684 tsk->thread.trap_no = 1; 1684 tsk->thread.trap_no = 1;
1685 tsk->thread.error_code = error_code; 1685 tsk->thread.error_code = error_code;
1686 1686
1687 memset(&info, 0, sizeof(info)); 1687 memset(info, 0, sizeof(*info));
1688 info.si_signo = SIGTRAP; 1688 info->si_signo = SIGTRAP;
1689 info.si_code = si_code; 1689 info->si_code = si_code;
1690 info->si_addr = user_mode_vm(regs) ? (void __user *)regs->ip : NULL;
1691}
1692
1693void user_single_step_siginfo(struct task_struct *tsk,
1694 struct pt_regs *regs,
1695 struct siginfo *info)
1696{
1697 fill_sigtrap_info(tsk, regs, 0, TRAP_BRKPT, info);
1698}
1690 1699
1691 /* User-mode ip? */ 1700void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
1692 info.si_addr = user_mode_vm(regs) ? (void __user *) regs->ip : NULL; 1701 int error_code, int si_code)
1702{
1703 struct siginfo info;
1693 1704
1705 fill_sigtrap_info(tsk, regs, error_code, si_code, &info);
1694 /* Send us the fake SIGTRAP */ 1706 /* Send us the fake SIGTRAP */
1695 force_sig_info(SIGTRAP, &info, tsk); 1707 force_sig_info(SIGTRAP, &info, tsk);
1696} 1708}