From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: mpe@ellerman.id.au, mikey@neuling.org
Cc: benh@kernel.crashing.org, paulus@samba.org,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
npiggin@gmail.com, christophe.leroy@c-s.fr,
naveen.n.rao@linux.vnet.ibm.com,
Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: [PATCH v3 2/3] Powerpc64/Watchpoint: Don't ignore extraneous exceptions
Date: Wed, 10 Jul 2019 10:24:44 +0530 [thread overview]
Message-ID: <20190710045445.31037-3-ravi.bangoria@linux.ibm.com> (raw)
In-Reply-To: <20190710045445.31037-1-ravi.bangoria@linux.ibm.com>
On Powerpc64, watchpoint match range is double-word granular. On
a watchpoint hit, DAR is set to the first byte of overlap between
actual access and watched range. And thus it's quite possible that
DAR does not point inside user specified range. Ex, say user creates
a watchpoint with address range 0x1004 to 0x1007. So hw would be
configured to watch from 0x1000 to 0x1007. If there is a 4 byte
access from 0x1002 to 0x1005, DAR will point to 0x1002 and thus
interrupt handler considers it as extraneous, but it's actually not,
because part of the access belongs to what user has asked. So, let
kernel pass it on to user and let user decide what to do with it
instead of silently ignoring it. The drawback is, it can generate
false positive events.
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
arch/powerpc/kernel/hw_breakpoint.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
index 5c876e986c18..c457d52778e3 100644
--- a/arch/powerpc/kernel/hw_breakpoint.c
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -204,9 +204,10 @@ int hw_breakpoint_handler(struct die_args *args)
#ifndef CONFIG_PPC_8xx
int stepped = 1;
unsigned int instr;
+#else
+ unsigned long dar = regs->dar;
#endif
struct arch_hw_breakpoint *info;
- unsigned long dar = regs->dar;
/* Disable breakpoints during exception handling */
hw_breakpoint_disable();
@@ -240,14 +241,14 @@ int hw_breakpoint_handler(struct die_args *args)
/*
* Verify if dar lies within the address range occupied by the symbol
- * being watched to filter extraneous exceptions. If it doesn't,
- * we still need to single-step the instruction, but we don't
- * generate an event.
+ * being watched to filter extraneous exceptions.
*/
info->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ;
+#ifdef CONFIG_PPC_8xx
if (!((bp->attr.bp_addr <= dar) &&
(dar - bp->attr.bp_addr < bp->attr.bp_len)))
info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ;
+#endif
#ifndef CONFIG_PPC_8xx
/* Do not emulate user-space instructions, instead single-step them */
--
2.20.1
next prev parent reply other threads:[~2019-07-10 4:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-10 4:54 [PATCH v3 0/3] Powerpc64/Watchpoint: Few important fixes Ravi Bangoria
2019-07-10 4:54 ` [PATCH v3 1/3] Powerpc64/Watchpoint: Fix length calculation for unaligned target Ravi Bangoria
2019-07-10 4:54 ` Ravi Bangoria [this message]
2019-07-10 6:27 ` [PATCH v3 2/3] Powerpc64/Watchpoint: Don't ignore extraneous exceptions Christophe Leroy
2019-07-10 6:38 ` Ravi Bangoria
2019-09-04 14:42 ` Naveen N. Rao
2019-09-05 3:56 ` Ravi Bangoria
2019-07-10 4:54 ` [PATCH v3 3/3] Powerpc64/Watchpoint: Rewrite ptrace-hwbreak.c selftest Ravi Bangoria
2019-08-28 6:14 ` Christophe Leroy
2019-09-04 9:10 ` Ravi Bangoria
2019-08-06 3:27 ` [PATCH v3 0/3] Powerpc64/Watchpoint: Few important fixes Ravi Bangoria
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=20190710045445.31037-3-ravi.bangoria@linux.ibm.com \
--to=ravi.bangoria@linux.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.vnet.ibm.com \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
/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
all inboxes | Powered by JetHome®