[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190624132129.4c772nkjbrilxtcy@willie-the-truck>
Date: Mon, 24 Jun 2019 14:21:29 +0100
From: Will Deacon <will@...nel.org>
To: jinho lim <jordan.lim@...sung.com>
Cc: will.deacon@....com, mark.rutland@....com,
anshuman.khandual@....com, marc.zyngier@....com,
andreyknvl@...gle.com, linux-kernel@...r.kernel.org,
seroto7@...il.com, ebiederm@...ssion.com,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2] arm64: rename dump_instr as dump_kernel_instr
On Thu, Jun 20, 2019 at 03:52:49PM +0900, jinho lim wrote:
> [v2]
The version information is not usually part of the commit message. Please
drop that...
> dump_kernel_instr does not work for user mode.
> rename dump_instr function and remove __dump_instr.
... and rewrite this so it explains the problem that you're solving.
> 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);
Actually, if we use aarch64_insn_read() instead of get_user() then we can
avoid having to mess directly with the fs and we'll also get endianness
correction for free when running a big-endian kernel.
Will
Powered by blists - more mailing lists