Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1379357

Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation
Date 2016-04-15 00:50 +0200
Message-ID <rnYfg-17X-7@gated-at.bofh.it> (permalink)
References <rneP8-6Cz-9@gated-at.bofh.it> <rnVKp-7KX-13@gated-at.bofh.it> <rnVU6-7Po-17@gated-at.bofh.it> <rnWdr-83L-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Apr 14, 2016 at 1:34 PM, Pavel Machek <pavel@denx.de> wrote:
> On Thu 2016-04-14 13:14:07, Kees Cook wrote:
>> On Thu, Apr 14, 2016 at 1:01 PM, Pavel Machek <pavel@denx.de> wrote:
>> > Hi!
>> >
>> >> Since kASLR and Hibernation can not currently coexist at runtime
>> >> on x86, the default behavior was to disable kASLR by default when
>> >> CONFIG_HIBERNATION was present (to retain original behavior).
>> >>
>> >> The behavior of kASLR on arm64 (and soon MIPS) is to be enabled by
>> >> default when selected at build time. Since arm64 Hibernation does not
>> >> conflict with kASLR, this fixes the hibernation argument parsing to be
>> >> x86-specific. Additionally, since end users want to be able to select
>> >> kASLR on x86 by default at build time, create CONFIG_RANDOMIZE_BASE_ON
>> >> that is present only on x86.
>> >>
>> >> Signed-off-by: Kees Cook <keescook@chromium.org>
>> >
>> > I believe this is bad idea. arm64 shows that kaslr and hibernation can
>> > coexist, and hibernation is still useful when your battery runs out.
>>
>> What? I'm confused -- this patch leaves the x86 behavior as-is by
>> default but allows hibernation to work with arm64. (For example, right
>> now, if you boot arm64 with "kaslr" kernel argument, hibernation will
>> get needlessly disabled.)
>
> So it is very different from the PATCH v1, still it shares the
> subject?

It was similar, but not the same:

v1: Prefer kASLR over Hibernation
v2: kaslr: allow kASLR to be default over Hibernation

I'm happy to call it whatever you like, though! :)

> This is the part I don't like:
>
>> >> Since kASLR and Hibernation can not currently coexist at runtime
>> >> on x86, the default behavior was to disable kASLR by default when
>> >> CONFIG_HIBERNATION was present (to retain original behavior).
>
> Now I notice that it is quite unclear if it actually changes
> anything...

Okay, right. So, there are a few problems that this patch is solving,
and maybe it needs to be broken up into separate patches, but it
didn't seem like it to me at the time. Specifically:

1) The x86 hibernation and KASLR code don't play well together currently.

"1" was worked around so that both could be built in, but only one
would be active at a time. This lead to:

2) The general hibernation code contains kernel arguments that should
only affect x86.

And we have the desire by folks to have KASLR enabled by default on
x86, giving us:

3) There is no build-time way on x86 to switch the preference of KASLR
vs hibernation.

I think "2" should be solved for this release, since arm64 KASLR is
landing, and mistakenly booting an arm64 system with "kaslr" on the
command line will needlessly disable hibernation.

3 and 2 are a result of 1, and IIUC, you're saying you want to solve 1
to make everything else go away? My only concern with that idea is
that I don't (yet) have the knowledge of x86 hibernation internals to
fix this, and it'll take a while to get to having KASLR on by default
if we have to wait on me to fix hibernation. (I'm not saying I
won't/can't, it's just that it'll take me time to come up to speed on
it.)

That do you think?

-Kees

-- 
Kees Cook
Chrome OS & Brillo Security

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2] kaslr: allow kASLR to be default over Hibernation Kees Cook <keescook@chromium.org> - 2016-04-13 00:20 +0200
  Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation Pavel Machek <pavel@denx.de> - 2016-04-14 22:10 +0200
    Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation Kees Cook <keescook@chromium.org> - 2016-04-14 22:20 +0200
      Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation Pavel Machek <pavel@denx.de> - 2016-04-14 22:40 +0200
        Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation Kees Cook <keescook@chromium.org> - 2016-04-15 00:50 +0200
          Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation Ingo Molnar <mingo@kernel.org> - 2016-04-15 11:30 +0200
          Re: [PATCH v2] kaslr: allow kASLR to be default over Hibernation Pavel Machek <pavel@denx.de> - 2016-04-15 15:10 +0200

csiph-web