[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190620065249.24112-1-jordan.lim@samsung.com>
Date: Thu, 20 Jun 2019 15:52:49 +0900
From: jinho lim <jordan.lim@...sung.com>
To: will.deacon@....com
Cc: mark.rutland@....com, ebiederm@...ssion.com, marc.zyngier@....com,
anshuman.khandual@....com, andreyknvl@...gle.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
seroto7@...il.com, jinho lim <jordan.lim@...sung.com>
Subject: [PATCH v2] arm64: rename dump_instr as dump_kernel_instr
[v2]
dump_kernel_instr does not work for user mode.
rename dump_instr function and remove __dump_instr.
Signed-off-by: jinho lim <jordan.lim@...sung.com>
---
Thanks for review, I rename dump_instr function and merge __dump_instr in it.
arch/arm64/kernel/traps.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index ccc13b45d9b1..7053165cb31a 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -66,11 +66,20 @@ static void dump_backtrace_entry(unsigned long where)
printk(" %pS\n", (void *)where);
}
-static void __dump_instr(const char *lvl, struct pt_regs *regs)
+static void dump_kernel_instr(const char *lvl, struct pt_regs *regs)
{
- unsigned long addr = instruction_pointer(regs);
+ unsigned long addr;
char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
int i;
+ mm_segment_t fs;
+
+ if (user_mode(regs))
+ return;
+
+ addr = instruction_pointer(regs);
+
+ fs = get_fs();
+ set_fs(KERNEL_DS);
for (i = -4; i < 1; i++) {
unsigned int val, bad;
@@ -84,19 +93,10 @@ static void __dump_instr(const char *lvl, struct pt_regs *regs)
break;
}
}
+
printk("%sCode: %s\n", lvl, str);
-}
-static void dump_instr(const char *lvl, struct pt_regs *regs)
-{
- if (!user_mode(regs)) {
- mm_segment_t fs = get_fs();
- set_fs(KERNEL_DS);
- __dump_instr(lvl, regs);
- set_fs(fs);
- } else {
- __dump_instr(lvl, regs);
- }
+ set_fs(fs);
}
void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
@@ -182,8 +182,7 @@ static int __die(const char *str, int err, struct pt_regs *regs)
print_modules();
show_regs(regs);
- if (!user_mode(regs))
- dump_instr(KERN_EMERG, regs);
+ dump_kernel_instr(KERN_EMERG, regs);
return ret;
}
--
2.17.1
Powered by blists - more mailing lists