All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Kosina <jkosina@suse.cz>
To: Kees Cook <keescook@chromium.org>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	live-patching@vger.kernel.org, Linux-MM <linux-mm@kvack.org>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86, kaslr: propagate base load address calculation
Date: Wed, 11 Feb 2015 00:07:12 +0100 (CET)	[thread overview]
Message-ID: <alpine.LNX.2.00.1502110001480.10719@pobox.suse.cz> (raw)
In-Reply-To: <CAGXu5jJzs9Ve9so96f6n-=JxP+GR3xYFQYBtZ=mUm+Q7bMAgBw@mail.gmail.com>

On Tue, 10 Feb 2015, Kees Cook wrote:

> > Instead of fixing the logic in module.c, this patch takes more generic
> > aproach, and exposes __KERNEL_OFFSET macro, which calculates the real
> > offset that has been established by choose_kernel_location() during boot.
> > This can be used later by other kernel code as well (such as, but not
> > limited to, live patching).
> >
> > OOPS offset dumper and module loader are converted to that they make use
> > of this macro as well.
> >
> > Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> 
> Ah, yes! This is a good clean up. Thanks! I do see, however, one
> corner case remaining: kASLR randomized to 0 offset. This will force
> module ASLR off, which I think is a mistake. 

Ah, right, good point. I thought that zero-randomization is not possible, 
but looking closely, it is.

> Perhaps we need to export the kaslr state as a separate item to be 
> checked directly, instead of using __KERNEL_OFFSET?

I wanted to avoid sharing variables between compressed loader and the rest 
of the kernel, but if that's what you prefer, I can do it.

Alternatively, we can forbid zero-sized randomization, and always enforce 
at least some minimal offset to be chosen in case zero would be chosen.

I think that'd be even more bulletproof for any future changes, as it 
automatically clearly and immediately distinguishes between 'disabled' and 
'randomized' states, and the loss of entropy is negligible.

Let me know which of the two you'd prefer; I'll then send you a 
corresponding patch, as I don't have a strong opinion either way.

Thanks,

-- 
Jiri Kosina
SUSE Labs

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Kosina <jkosina@suse.cz>
To: Kees Cook <keescook@chromium.org>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	live-patching@vger.kernel.org, Linux-MM <linux-mm@kvack.org>,
	"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH] x86, kaslr: propagate base load address calculation
Date: Wed, 11 Feb 2015 00:07:12 +0100 (CET)	[thread overview]
Message-ID: <alpine.LNX.2.00.1502110001480.10719@pobox.suse.cz> (raw)
In-Reply-To: <CAGXu5jJzs9Ve9so96f6n-=JxP+GR3xYFQYBtZ=mUm+Q7bMAgBw@mail.gmail.com>

On Tue, 10 Feb 2015, Kees Cook wrote:

> > Instead of fixing the logic in module.c, this patch takes more generic
> > aproach, and exposes __KERNEL_OFFSET macro, which calculates the real
> > offset that has been established by choose_kernel_location() during boot.
> > This can be used later by other kernel code as well (such as, but not
> > limited to, live patching).
> >
> > OOPS offset dumper and module loader are converted to that they make use
> > of this macro as well.
> >
> > Signed-off-by: Jiri Kosina <jkosina@suse.cz>
> 
> Ah, yes! This is a good clean up. Thanks! I do see, however, one
> corner case remaining: kASLR randomized to 0 offset. This will force
> module ASLR off, which I think is a mistake. 

Ah, right, good point. I thought that zero-randomization is not possible, 
but looking closely, it is.

> Perhaps we need to export the kaslr state as a separate item to be 
> checked directly, instead of using __KERNEL_OFFSET?

I wanted to avoid sharing variables between compressed loader and the rest 
of the kernel, but if that's what you prefer, I can do it.

Alternatively, we can forbid zero-sized randomization, and always enforce 
at least some minimal offset to be chosen in case zero would be chosen.

I think that'd be even more bulletproof for any future changes, as it 
automatically clearly and immediately distinguishes between 'disabled' and 
'randomized' states, and the loss of entropy is negligible.

Let me know which of the two you'd prefer; I'll then send you a 
corresponding patch, as I don't have a strong opinion either way.

Thanks,

-- 
Jiri Kosina
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2015-02-10 23:07 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10 13:17 [PATCH] x86, kaslr: propagate base load address calculation Jiri Kosina
2015-02-10 13:17 ` Jiri Kosina
2015-02-10 17:25 ` Kees Cook
2015-02-10 17:25   ` Kees Cook
2015-02-10 23:07   ` Jiri Kosina [this message]
2015-02-10 23:07     ` Jiri Kosina
2015-02-10 23:13     ` Jiri Kosina
2015-02-10 23:13       ` Jiri Kosina
2015-02-13 15:04       ` [PATCH v2] " Jiri Kosina
2015-02-13 15:04         ` Jiri Kosina
2015-02-13 17:49         ` Kees Cook
2015-02-13 17:49           ` Kees Cook
2015-02-13 22:20           ` Jiri Kosina
2015-02-13 22:20             ` Jiri Kosina
2015-02-13 23:25             ` Kees Cook
2015-02-13 23:25               ` Kees Cook
2015-02-16 11:55               ` Borislav Petkov
2015-02-16 11:55                 ` Borislav Petkov
2015-02-16 19:27                 ` Kees Cook
2015-02-16 19:27                   ` Kees Cook
2015-02-16 19:42                   ` Borislav Petkov
2015-02-16 19:42                     ` Borislav Petkov
2015-02-17 10:44         ` Borislav Petkov
2015-02-17 10:44           ` Borislav Petkov
2015-02-17 12:21           ` Jiri Kosina
2015-02-17 12:21             ` Jiri Kosina
2015-02-17 12:39             ` Borislav Petkov
2015-02-17 12:39               ` Borislav Petkov
2015-02-17 16:45               ` Kees Cook
2015-02-17 16:45                 ` Kees Cook
2015-02-17 22:31                 ` Borislav Petkov
2015-02-17 22:31                   ` Borislav Petkov
2015-02-18  3:33                   ` Kees Cook
2015-02-18  3:33                     ` Kees Cook
2015-02-18  8:32                     ` Borislav Petkov
2015-02-18  8:32                       ` Borislav Petkov
2015-02-18 10:46                       ` Jiri Kosina
2015-02-18 10:46                         ` Jiri Kosina

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=alpine.LNX.2.00.1502110001480.10719@pobox.suse.cz \
    --to=jkosina@suse.cz \
    --cc=hpa@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=live-patching@vger.kernel.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 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.