Commit 793ecee9 authored by Mark Rutland's avatar Mark Rutland Committed by Thadeu Lima de Souza Cascardo

arm64: ensure __dump_instr() checks addr_limit

BugLink: http://bugs.launchpad.net/bugs/1731915

commit 7a7003b1 upstream.

It's possible for a user to deliberately trigger __dump_instr with a
chosen kernel address.

Let's avoid problems resulting from this by using get_user() rather than
__get_user(), ensuring that we don't erroneously access kernel memory.

Where we use __dump_instr() on kernel text, we already switch to
KERNEL_DS, so this shouldn't adversely affect those cases.

Fixes: 60ffc30d ("arm64: Exception handling")
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarThadeu Lima de Souza Cascardo <cascardo@canonical.com>
parent aa0406b1
...@@ -129,7 +129,7 @@ static void dump_instr(const char *lvl, struct pt_regs *regs) ...@@ -129,7 +129,7 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
for (i = -4; i < 1; i++) { for (i = -4; i < 1; i++) {
unsigned int val, bad; unsigned int val, bad;
bad = __get_user(val, &((u32 *)addr)[i]); bad = get_user(val, &((u32 *)addr)[i]);
if (!bad) if (!bad)
p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val); p += sprintf(p, i == 0 ? "(%08x) " : "%08x ", val);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment