From: Ingo Molnar <mingo@elte.hu>
To: Andi Kleen <andi@firstfloor.org>
Cc: Dave Jones <davej@redhat.com>,
Stephane Eranian <eranian@google.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Arjan van de Ven <arjan@infradead.org>
Subject: Re: [BUG] perf: bogus correlation of kernel symbols
Date: Tue, 17 May 2011 14:17:45 +0200 [thread overview]
Message-ID: <20110517121745.GI13475@elte.hu> (raw)
In-Reply-To: <m2iptezi07.fsf@firstfloor.org>
* Andi Kleen <andi@firstfloor.org> wrote:
> > The x86 kernel is relocatable, so slightly randomizing the position of the
> > kernel would be feasible with no overhead on the vast majority of exising
> > distro installs, with just an updated kernel.
>
> Problem is that we don't have a source of secure randomness early on when the
> relocation would need to happen.
That's indeed a problem but not a fundamental one: we can read out the current
time (RTC CMOS is always available on most systems), mix it with the current
cycle counter value and PRNG mix it.
It could only be recovered if the attacker is local to that box, guesses the
precise cycle count on that specific hardware (and hardware has small thermal
variations) and knows the precise boot time to the second as present in the
RTC.
Note that the amount of randomization would be small to begin with: if we have
only 3 bits of randomization and can thus make ~90% of kernel exploit attempts
crash statistically then we have most of the advantages already.
[ For the really paranoid we could add a new flag to the boot protocol and
embedd a random seed in the bzImage. This could be re-set upon installation
of a new kernel package, so on the next reboot the system gains a unique
seed.
Or we could add a boot parameter to seed things and cut this particular boot
parameter from all output like /proc/cmdline or the syslog command line
parameters printout. /etc/grub.conf is already inaccessible to unprivileged
userspace on most distros so the parameter is hidden. ]
So it's a solvable problem.
> You could either pass it as an option, but that option would be right now too
> exposed, or just use kexec and boot twice.
>
> But all of this has drawbacks.
>
> > When exposing randomized RIPs to user-space we could recalculate all RIPs back
> > to the 0xffffffff80000000 base, so oopses would have the usual non-randomized
> > form:
>
> This would be very confusing because the register and stack contents
> would have the non relocated addresses.
Well, kernel crashes can expose security relevant details anyway so they better
be hidden from unprivileged attackers anyway, the important thing is to
properly decode the symbols. We can keep the rest of the oops in its raw form
(and thus expose the seed to a privileged user - which we'd do anyway), being
dependable is important for oopses.
> I bet it would cause a lot of similar problems as the current %kP madness,
> just more subtle ones.
Well, did you expect me to react to your claim of 'subtle issues'?
If yes (which i assume) then why didn't you outline what you meant with that in
more detail, why are you forcing me to ask you what you mean precisely?
Thanks,
Ingo
next prev parent reply other threads:[~2011-05-17 12:18 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-12 14:48 [BUG] perf: bogus correlation of kernel symbols Stephane Eranian
2011-05-12 18:06 ` David Miller
2011-05-12 18:37 ` Dave Jones
2011-05-12 19:01 ` David Miller
2011-05-12 19:58 ` Pekka Enberg
2011-05-13 6:12 ` Kees Cook
2011-05-13 6:24 ` Pekka Enberg
2011-05-12 20:24 ` Alexey Dobriyan
2011-05-12 21:06 ` Ingo Molnar
2011-05-12 20:31 ` Linus Torvalds
2011-05-12 20:43 ` David Miller
2011-05-12 21:00 ` [PATCH] vsprintf: Turn kptr_restrict off by default Ingo Molnar
2011-05-12 21:08 ` David Miller
2011-05-12 21:07 ` [BUG] perf: bogus correlation of kernel symbols Stephane Eranian
2011-05-12 21:30 ` Stephane Eranian
2011-05-12 21:35 ` Ingo Molnar
2011-05-12 21:38 ` Stephane Eranian
2011-05-12 21:50 ` Ingo Molnar
2011-05-12 21:56 ` Stephane Eranian
2011-05-12 22:00 ` Ingo Molnar
2011-05-12 22:07 ` Dave Jones
2011-05-12 22:15 ` Stephane Eranian
2011-05-13 9:01 ` Ingo Molnar
2011-05-13 8:57 ` Ingo Molnar
2011-05-13 16:23 ` Andi Kleen
2011-05-17 12:17 ` Ingo Molnar [this message]
2011-05-12 21:36 ` Ingo Molnar
2011-05-12 21:41 ` Stephane Eranian
2011-05-12 21:54 ` Ingo Molnar
[not found] <1305292059.1949.0.camel@dan>
2011-05-13 13:29 ` Dan Rosenberg
2011-05-16 15:35 ` Ingo Molnar
2011-05-16 16:14 ` Dan Rosenberg
2011-05-20 0:56 ` Dan Rosenberg
2011-05-20 12:07 ` Ingo Molnar
2011-05-20 12:54 ` Dan Rosenberg
2011-05-20 13:11 ` Ingo Molnar
2011-05-20 17:41 ` Dan Rosenberg
2011-05-20 18:14 ` Linus Torvalds
2011-05-20 18:27 ` Kees Cook
2011-05-20 18:34 ` Dan Rosenberg
2011-05-20 18:42 ` Ingo Molnar
2011-05-20 18:28 ` Ingo Molnar
2011-05-22 6:11 ` david
2011-05-20 18:35 ` Ingo Molnar
2011-05-22 18:45 ` Dan Rosenberg
[not found] ` <BANLkTik1SK_kWVvGsKk0SqdByQ5-0b5nFg@mail.gmail.com>
2011-05-23 0:25 ` Dan Rosenberg
2011-05-23 0:37 ` H. Peter Anvin
2011-05-23 10:49 ` Ingo Molnar
2011-05-23 19:02 ` Ray Lee
2011-05-23 19:35 ` Ingo Molnar
2011-05-24 1:59 ` Valdis.Kletnieks
2011-05-24 4:06 ` Ingo Molnar
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=20110517121745.GI13475@elte.hu \
--to=mingo@elte.hu \
--cc=acme@redhat.com \
--cc=andi@firstfloor.org \
--cc=arjan@infradead.org \
--cc=davej@redhat.com \
--cc=eranian@google.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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.