linux-sg2042/arch/arm64
Mark Rutland dfbca61af0 arm64: hibernate: handle allocation failures
In create_safe_exec_page(), we create a copy of the hibernate exit text,
along with some page tables to map this via TTBR0. We then install the
new tables in TTBR0.

In swsusp_arch_resume() we call create_safe_exec_page() before trying a
number of operations which may fail (e.g. copying the linear map page
tables). If these fail, we bail out of swsusp_arch_resume() and return
an error code, but leave TTBR0 as-is. Subsequently, the core hibernate
code will call free_basic_memory_bitmaps(), which will free all of the
memory allocations we made, including the page tables installed in
TTBR0.

Thus, we may have TTBR0 pointing at dangling freed memory for some
period of time. If the hibernate attempt was triggered by a user
requesting a hibernate test via the reboot syscall, we may return to
userspace with the clobbered TTBR0 value.

Avoid these issues by reorganising swsusp_arch_resume() such that we
have no failure paths after create_safe_exec_page(). We also add a check
that the zero page allocation succeeded, matching what we have for other
allocations.

Fixes: 82869ac57b ("arm64: kernel: Add support for hibernate/suspend-to-disk")
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: James Morse <james.morse@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: <stable@vger.kernel.org> # 4.7+
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2016-08-12 19:08:33 +01:00
..
boot PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
configs ARM: SoC 64-bit changes for v4.8 2016-08-01 18:29:28 -04:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-03-17 11:22:54 -07:00
include arm64: Remove stack duplicating code from jprobes 2016-08-11 17:38:16 +01:00
kernel arm64: hibernate: handle allocation failures 2016-08-12 19:08:33 +01:00
kvm KVM/ARM Changes for v4.8 - Take 2 2016-08-04 13:59:56 +02:00
lib arm64: kasan: instrument user memory access API 2016-06-21 15:37:18 +01:00
mm arm64: Handle el1 synchronous instruction aborts cleanly 2016-08-12 17:58:48 +01:00
net arm64: bpf: optimize LD_ABS, LD_IND 2016-06-10 23:11:50 -07:00
xen arm/xen: add support for vm_assist hypercall 2016-07-06 10:42:14 +01:00
Kconfig PCI changes for the v4.8 merge window: 2016-08-02 17:12:29 -04:00
Kconfig.debug arm64: enable CONFIG_SET_MODULE_RONX by default 2016-05-31 14:23:29 +01:00
Kconfig.platforms ARM: 64-bit DT updates for v4.8 2016-08-01 18:47:01 -04:00
Makefile arm64 fixes: 2016-08-06 08:58:59 -04:00