Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1292663

[PATCH] arm64: reenable interrupt when handling ptrace breakpoint

From Yang Shi <yang.shi@linaro.org>
Newsgroups linux.kernel
Subject [PATCH] arm64: reenable interrupt when handling ptrace breakpoint
Date 2015-12-16 01:40 +0100
Message-ID <qG8il-32J-1@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


The kernel just send out a SIGTRAP signal when handling ptrace breakpoint in
debug exception, so it sounds safe to have interrupt enabled if it is not
disabled by the parent process.

Signed-off-by: Yang Shi <yang.shi@linaro.org>
---
 arch/arm64/kernel/debug-monitors.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index 8aee3ae..90d70e4 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -239,6 +239,9 @@ static int single_step_handler(unsigned long addr, unsigned int esr,
 		return 0;
 
 	if (user_mode(regs)) {
+		if (interrupts_enabled(regs))
+			local_irq_enable();
+
 		info.si_signo = SIGTRAP;
 		info.si_errno = 0;
 		info.si_code  = TRAP_HWBKPT;
@@ -310,6 +313,9 @@ static int brk_handler(unsigned long addr, unsigned int esr,
 	siginfo_t info;
 
 	if (user_mode(regs)) {
+		if (interrupts_enabled(regs))
+			local_irq_enable();
+
 		info = (siginfo_t) {
 			.si_signo = SIGTRAP,
 			.si_errno = 0,
@@ -337,6 +343,10 @@ int aarch32_break_handler(struct pt_regs *regs)
 	if (!compat_user_mode(regs))
 		return -EFAULT;
 
+	/* COMPAT_PSR_I_BIT has the same bit mask with non-compat one */
+	if (interrupts_enabled(regs))
+		local_irq_enable();
+
 	if (compat_thumb_mode(regs)) {
 		/* get 16-bit Thumb instruction */
 		get_user(thumb_instr, (u16 __user *)pc);
-- 
2.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] arm64: reenable interrupt when handling ptrace breakpoint Yang Shi <yang.shi@linaro.org> - 2015-12-16 01:40 +0100
  Re: [PATCH] arm64: reenable interrupt when handling ptrace breakpoint Will Deacon <will.deacon@arm.com> - 2015-12-16 12:20 +0100
    Re: [PATCH] arm64: reenable interrupt when handling ptrace breakpoint "Shi, Yang" <yang.shi@linaro.org> - 2015-12-16 21:50 +0100
      Re: [PATCH] arm64: reenable interrupt when handling ptrace breakpoint Will Deacon <will.deacon@arm.com> - 2015-12-21 11:50 +0100
        Re: [PATCH] arm64: reenable interrupt when handling ptrace  breakpoint Thomas Gleixner <tglx@linutronix.de> - 2015-12-21 18:00 +0100
          Re: [PATCH] arm64: reenable interrupt when handling ptrace breakpoint Will Deacon <will.deacon@arm.com> - 2015-12-21 18:10 +0100
            Re: [PATCH] arm64: reenable interrupt when handling ptrace breakpoint "Shi, Yang" <yang.shi@linaro.org> - 2015-12-21 18:30 +0100

csiph-web