ARM: 8720/1: ensure dump_instr() checks addr_limit
authorMark Rutland <mark.rutland@arm.com>
Thu, 2 Nov 2017 17:44:28 +0000 (18:44 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:51:02 +0000 (20:51 +0000)
commit1e7e03e81806836de6078d15d41af7ad5ee301cf
tree2c25303bbd63cf32c332345a996ffbaa0f740d25
parent57a70fe807328d99a7e483592b883b2e8abaca13
ARM: 8720/1: ensure dump_instr() checks addr_limit

commit b9dd05c7002ee0ca8b676428b2268c26399b5e31 upstream.

When CONFIG_DEBUG_USER is enabled, 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.

So that we can use the same code to dump user instructions and kernel
instructions, the common dumping code is factored out to __dump_instr(),
with the fs manipulated appropriately in dump_instr() around calls to
this.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/arm/kernel/traps.c