From: Ingo Molnar <mingo@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Pavel Machek <pavel@denx.de>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Matt Redfearn <matt.redfearn@imgtec.com>,
Yves-Alexis Perez <corsac@debian.org>,
Emrah Demir <ed@abdsec.com>, Jonathan Corbet <corbet@lwn.net>,
the arch/x86 maintainers <x86@kernel.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>, Borislav Petkov <bp@suse.de>,
Andy Lutomirski <luto@kernel.org>,
"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
"kernel-hardening@lists.openwall.com"
<kernel-hardening@lists.openwall.com>
Subject: Re: [PATCH] Prefer kASLR over Hibernation
Date: Wed, 6 Apr 2016 23:48:35 +0200 [thread overview]
Message-ID: <20160406214835.GA23620@gmail.com> (raw)
In-Reply-To: <CAGXu5jJ+8v_hMkV91jqNGwFdzbpoKL=gZv-92hGMF8d4o8DswQ@mail.gmail.com>
* Kees Cook <keescook@chromium.org> wrote:
> On Wed, Apr 6, 2016 at 1:56 PM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> > On Wed, Apr 6, 2016 at 1:17 PM, Pavel Machek <pavel@denx.de> wrote:
> >>
> >> Why is kASLR incompatible with hibernation? We can hibernate have
> >> 4.3 kernel resume hibernation image of 4.2 kernel (on x86-64, and I
> >> have patches for x86). Resuming kernel with different randomization
> >> does not look that much different...
> >
> > Oh, I'd absolutely prefer to just allow kaslr together with
> > hibernation if it actually works.
> >
> > Could the people who piped up to say that they actually use
> > hibernation just try passing in the "kaslr" command line option on
> > their machine, and see if it works for them? We could just remove the
> > "no kaslr with hibername" code - or at least limit it to 32-bit for
> > now..
> >
> > Because that would be lovely.
>
> This is where our original investigation of having them coexist ended:
> https://lkml.org/lkml/2014/6/15/180
>
> To quote Rafael Wysocki:
> > We're jumping from the boot kernel into the image kernel. The virtual address
> > comes from the image kernel, but the boot kernel has to use it. The only way
> > we can ensure that we'll jump to the right place is to pass the physical address
> > in the header (otherwise we de facto assume that the virtual address of the
> > target page frame will be the same in both the boot and the image kernels).
> >
> > The missing piece is that the code in swsusp_arch_resume() sets up temporary
> > page tables to ensure that they won't be overwritten while copying the last
> > remaining image kernel pages to the right page frames (those page tables
> > have to be stored in page frames that are free from the kernel image perspective).
> >
> > But if the kernel address space is randomized, set_up_temporary_mappings()
> > really should duplicate the existing layout instead of creating a new one from
> > scratch. Otherwise, virtual addresses before set_up_temporary_mappings() may
> > be different from the ones after it.
So as I suggested it in the previous mail, the right solution would be to pass in
the randomization seed via a new kasl_seed=xyz boot option, and thus have the same
addresses as prior hibernation.
That should make hibernation work as-is, with very little effort.
Two details I can think of:
1) the new option has to be hidden from /proc/cmdline, due to:
triton:~/tip> ll /proc/cmdline
-r--r--r-- 1 root root 0 Apr 6 23:45 /proc/cmdline
2)
another detail is that the new boot option has to be checked in
choose_kernel_location(), to make sure it's done at the right point during bootup.
That's a good place to remove it from the boot options string as well.
Thanks,
Ingo
next prev parent reply other threads:[~2016-04-06 21:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 19:44 [PATCH] Prefer kASLR over Hibernation Kees Cook
2016-04-06 20:17 ` Pavel Machek
2016-04-06 20:56 ` Linus Torvalds
2016-04-06 21:25 ` Kees Cook
2016-04-06 21:48 ` Ingo Molnar [this message]
2016-04-06 21:52 ` Ingo Molnar
2016-04-06 22:32 ` Rafael J. Wysocki
2016-04-07 0:49 ` Ingo Molnar
2016-04-06 21:49 ` Rafael J. Wysocki
2016-04-06 21:56 ` Ingo Molnar
2016-04-06 22:04 ` Rafael J. Wysocki
2016-04-06 22:16 ` Kees Cook
2016-04-06 22:41 ` Paul Bolle
2016-04-07 0:05 ` Ingo Molnar
2016-04-11 8:00 ` James Morse
2016-04-11 18:03 ` Kees Cook
2016-04-11 18:21 ` Geert Uytterhoeven
2016-04-11 18:47 ` Kees Cook
2016-04-12 17:51 ` James Morse
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=20160406214835.GA23620@gmail.com \
--to=mingo@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=bp@suse.de \
--cc=corbet@lwn.net \
--cc=corsac@debian.org \
--cc=ed@abdsec.com \
--cc=keescook@chromium.org \
--cc=kernel-hardening@lists.openwall.com \
--cc=len.brown@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=luto@kernel.org \
--cc=matt.redfearn@imgtec.com \
--cc=pavel@denx.de \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@rjwysocki.net \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).