* [RESEND][PATCH] Fix BUG_ON() reporting in real mode on PPC
@ 2016-02-18 2:48 Balbir Singh
2016-02-29 11:05 ` [RESEND] " Michael Ellerman
0 siblings, 1 reply; 4+ messages in thread
From: Balbir Singh @ 2016-02-18 2:48 UTC (permalink / raw)
To: mpe, linuxppc-dev; +Cc: paulus, Balbir Singh
Changelog:
Don't use REGION_ID, breaks on some platforms
Don't blindly add PAGE_OFFSET to bugaddr
I ran into this issue while debugging an early boot problem.
The system hit a BUG_ON() but report bug failed to print the
line number and file name. The reason being that the system
was running in real mode and report_bug() searches for
addresses in the PAGE_OFFSET+ region
Suggested-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/kernel/traps.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index b6becc7..4e5c11d 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1148,6 +1148,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
goto bail;
}
if (reason & REASON_TRAP) {
+ unsigned long bugaddr;
/* Debugger is first in line to stop recursive faults in
* rcu_lock, notify_die, or atomic_notifier_call_chain */
if (debugger_bpt(regs))
@@ -1158,8 +1159,15 @@ void __kprobes program_check_exception(struct pt_regs *regs)
== NOTIFY_STOP)
goto bail;
+ bugaddr = regs->nip;
+ /*
+ * Fixup bugaddr for BUG_ON() in real mode
+ */
+ if (!is_kernel_addr(bugaddr) && !(regs->msr & MSR_IR))
+ bugaddr += PAGE_OFFSET;
+
if (!(regs->msr & MSR_PR) && /* not user-mode */
- report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
+ report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) {
regs->nip += 4;
goto bail;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [RESEND] Fix BUG_ON() reporting in real mode on PPC
2016-02-18 2:48 [RESEND][PATCH] Fix BUG_ON() reporting in real mode on PPC Balbir Singh
@ 2016-02-29 11:05 ` Michael Ellerman
0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2016-02-29 11:05 UTC (permalink / raw)
To: Balbir Singh, linuxppc-dev; +Cc: paulus
On Thu, 2016-18-02 at 02:48:01 UTC, Balbir Singh wrote:
> Changelog:
> Don't use REGION_ID, breaks on some platforms
> Don't blindly add PAGE_OFFSET to bugaddr
>
> I ran into this issue while debugging an early boot problem.
> The system hit a BUG_ON() but report bug failed to print the
> line number and file name. The reason being that the system
> was running in real mode and report_bug() searches for
> addresses in the PAGE_OFFSET+ region
>
> Suggested-by: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Balbir Singh <bsingharora@gmail.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a4c3f909b4d9bb9430bf42ad58
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RESEND][PATCH] Fix BUG_ON() reporting in real mode on PPC
2016-02-18 0:20 [RESEND][PATCH] " Balbir Singh
@ 2016-02-18 2:03 ` kbuild test robot
0 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2016-02-18 2:03 UTC (permalink / raw)
To: Balbir Singh; +Cc: kbuild-all, mpe, linuxppc-dev, paulus
[-- Attachment #1: Type: text/plain, Size: 1629 bytes --]
Hi Balbir,
[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.5-rc4 next-20160217]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Balbir-Singh/Fix-BUG_ON-reporting-in-real-mode-on-PPC/20160218-082259
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-allnoconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=powerpc
All errors (new ones prefixed by >>):
arch/powerpc/kernel/traps.c: In function 'program_check_exception':
>> arch/powerpc/kernel/traps.c:1163:8: error: implicit declaration of function 'REGION_ID' [-Werror=implicit-function-declaration]
if ((REGION_ID(bugaddr) == 0) && !(regs->msr & MSR_IR))
^
cc1: all warnings being treated as errors
vim +/REGION_ID +1163 arch/powerpc/kernel/traps.c
1157 /* trap exception */
1158 if (notify_die(DIE_BPT, "breakpoint", regs, 5, 5, SIGTRAP)
1159 == NOTIFY_STOP)
1160 goto bail;
1161
1162 bugaddr = regs->nip;
> 1163 if ((REGION_ID(bugaddr) == 0) && !(regs->msr & MSR_IR))
1164 bugaddr += PAGE_OFFSET;
1165
1166 if (!(regs->msr & MSR_PR) && /* not user-mode */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 5708 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [RESEND][PATCH] Fix BUG_ON() reporting in real mode on PPC
@ 2016-02-18 0:20 Balbir Singh
2016-02-18 2:03 ` kbuild test robot
0 siblings, 1 reply; 4+ messages in thread
From: Balbir Singh @ 2016-02-18 0:20 UTC (permalink / raw)
To: mpe, linuxppc-dev; +Cc: paulus, Balbir Singh
Resending to remove whitespace issues created by email client
Changelog:
Don't add PAGE_OFFSET blindly, check if REGION_ID is 0
I ran into this issue while debugging an early boot problem.
The system hit a BUG_ON() but report bug failed to print the
line number and file name. The reason being that the system
was running in real mode and report_bug() searches for
addresses in the PAGE_OFFSET+ region
Suggested-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Balbir Singh <bsingharora@gmail.com>
---
arch/powerpc/kernel/traps.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index b6becc7..4de4fe7 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1148,6 +1148,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
goto bail;
}
if (reason & REASON_TRAP) {
+ unsigned long bugaddr;
/* Debugger is first in line to stop recursive faults in
* rcu_lock, notify_die, or atomic_notifier_call_chain */
if (debugger_bpt(regs))
@@ -1158,8 +1159,12 @@ void __kprobes program_check_exception(struct pt_regs *regs)
== NOTIFY_STOP)
goto bail;
+ bugaddr = regs->nip;
+ if ((REGION_ID(bugaddr) == 0) && !(regs->msr & MSR_IR))
+ bugaddr += PAGE_OFFSET;
+
if (!(regs->msr & MSR_PR) && /* not user-mode */
- report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
+ report_bug(bugaddr, regs) == BUG_TRAP_TYPE_WARN) {
regs->nip += 4;
goto bail;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-02-29 11:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-18 2:48 [RESEND][PATCH] Fix BUG_ON() reporting in real mode on PPC Balbir Singh
2016-02-29 11:05 ` [RESEND] " Michael Ellerman
-- strict thread matches above, loose matches on Subject: below --
2016-02-18 0:20 [RESEND][PATCH] " Balbir Singh
2016-02-18 2:03 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).