From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 2/2] arm64: hibernate: handle allocation failures
Date: Fri, 12 Aug 2016 19:07:27 +0100 [thread overview]
Message-ID: <57AE105F.2050800@arm.com> (raw)
In-Reply-To: <1470921066-27421-3-git-send-email-mark.rutland@arm.com>
On 11/08/16 14:11, Mark Rutland wrote:
> 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.
Looks good to me.
Acked-by: James Morse <james.morse@arm.com>
Thanks,
James
prev parent reply other threads:[~2016-08-12 18:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 13:11 [PATCHv2 0/2] arm64: hibernate: a couple of fixes Mark Rutland
2016-08-11 13:11 ` [PATCHv2 1/2] arm64: hibernate: avoid potential TLB conflict Mark Rutland
2016-08-11 13:11 ` [PATCHv2 2/2] arm64: hibernate: handle allocation failures Mark Rutland
2016-08-12 18:07 ` James Morse [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57AE105F.2050800@arm.com \
--to=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.