linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Daniel Gruss <daniel@gruss.cc>
Cc: "kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	kernel list <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>
Subject: Re: [kernel-hardening] rowhammer protection [was Re: Getting interrupt every million cache misses]
Date: Sat, 29 Oct 2016 23:05:18 +0200	[thread overview]
Message-ID: <20161029210518.GC3827@amd> (raw)
In-Reply-To: <5f5741d5-0695-6a56-6c05-ebdaaa896f54@gruss.cc>

[-- Attachment #1: Type: text/plain, Size: 4032 bytes --]

Hi!

On Sat 2016-10-29 22:05:16, Daniel Gruss wrote:
> On 29.10.2016 21:42, Pavel Machek wrote:
> >Congratulations. Now I'd like to take away your toys :-).
> 
> I'm would like you to do that, but I'm very confident you're not successful
> the way your starting ;)

:-). Lets see.

> >Not in my testing.
> 
> Have you tried music/video reencoding? Games? Anything that works with a
> decent amount of memory but not too much hard disk i/o?
> Numbers are very clear there...

So far I did bzip2 and kernel compilation. I believe I can prevent
flips in rowhammer-test with bzip2 going from 4 seconds to 5
seconds... let me see.

If you have simple test that you'd like me to try, speak up. Best if
it takes cca 10 seconds to run.

> >First, I'm not at all sure lowest CPU speed would
> >make any difference at all
> 
> It would. I've seen many bitflips but none where the CPU operated in the
> lower frequency range.

Ok, let me try that. Problem is that the machine I'm testing on takes
20 minutes to produce bit flip...

> >Second, going to lowest clock speed will reduce performance
> 
> As does the countermeasure you propose...

Yes. But hopefully not quite _as_ drastically. (going to lowest clock
would make bzip2 go from 4 to 12 seconds or so, right?)

> Yes, Flip Feng Shui requires deduplication and does not work without.
> Disabling deduplication is what the authors recommend as a
> countermeasure.

Ok, Flip Feng Shui is easy, then. :-).

> >But it will be nowhere near complete fix, right?
> >
> >Will fix user attacking kernel, but not user1 attacking user2. You
> >could put each "user" into separate 2MB region, but then you'd have to
> >track who needs go go where. (Same uid is not enough, probably "can
> >ptrace"?)
> 
> Exactly. But preventing user2kernel is already a good start, and you would
> prevent that without any doubt and without any cost.

Well, it is only good start if the result is mergeable, and can be
used to prevent all attacks we care about.

> >That'll still let remote server gain permissons of local user running
> >web server... using javascript exploit right?  And that's actually
> >attack that I find most scary. Local user to root exploit is bad, but
> >getting permissions of web browser from remote web server is very,
> >very, very bad.
> 
> Rowhammer.js skips the browser... it goes JS to full phys. memory access.
> Anyway, preventing Rowhammer from JS should be easy because even the
> slightest slow down should be enough to prevent any Rowhammer attack from
> JS.

Are you sure? How much slowdown is enough to prevent the attack? (And
can I get patched chromium? Patched JVM? Patched qemu?) Dunno.. are
only just in time compilers affected? Or can I get for example pdf
document that does all the wrong memory accesses during rendering,
triggering buffer overrun in xpdf and arbitrary code execution?

Running userland on non-working machine is scary :-(.

Shall we introduce new syscall "get_mandatory_jit_slowdown()"?

I'd like kernel patch that works around rowhammer problem... in
kernel. I'm willing to accept some slowdown (say from 4 to 6 seconds
for common tasks). I'd prefer solution to be contained in kernel, and
present working (but slower) machine to userspace. I believe I can do
that.

> >>That is a simple fix that does not cost any runtime performance.
> >
> >Simple? Not really, I'm afraid. Feel free to try to implement it.
> 
> I had a student who already implemented this in another OS, I'm confident it
> can be done in Linux as well...

Well, I'm not saying its impossible. But I'd like to see the
implementation. Its definitely more work than nohammer.c. Order of
magnitude more, at least.

But yes, it will help with side channel attacks, etc. So yes, I'd like
to see the patch.

Best regards,

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2016-10-29 21:06 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 20:54 Getting interrupt every million cache misses Pavel Machek
2016-10-27  8:28 ` Peter Zijlstra
2016-10-27  8:46   ` Pavel Machek
2016-10-27  9:15     ` Peter Zijlstra
2016-10-27  9:11   ` Pavel Machek
2016-10-27  9:33     ` Peter Zijlstra
2016-10-27 20:40       ` Kees Cook
2016-10-27 21:27         ` rowhammer protection [was Re: Getting interrupt every million cache misses] Pavel Machek
2016-10-28  7:07           ` Ingo Molnar
2016-10-28  8:50             ` Pavel Machek
2016-10-28  8:59               ` Ingo Molnar
2016-10-28 11:55                 ` Pavel Machek
2016-10-28  9:04               ` Peter Zijlstra
2016-10-28  9:27                 ` Vegard Nossum
2016-10-28  9:35                   ` Ingo Molnar
2016-10-28  9:47                     ` Vegard Nossum
2016-10-28  9:53                     ` [kernel-hardening] " Mark Rutland
2016-10-28 11:27                 ` Pavel Machek
2016-10-28  9:51           ` [kernel-hardening] " Mark Rutland
2016-10-28 11:21             ` Pavel Machek
2016-10-28 14:05               ` Mark Rutland
2016-10-28 14:18                 ` Peter Zijlstra
2016-10-28 18:30                   ` Pavel Machek
2016-10-28 18:48                     ` Peter Zijlstra
2016-11-02 18:13                   ` Pavel Machek
2016-10-28 17:27                 ` Pavel Machek
2016-10-29 13:06                   ` Daniel Gruss
2016-10-29 19:42                     ` Pavel Machek
2016-10-29 20:05                       ` Daniel Gruss
2016-10-29 21:05                         ` Pavel Machek [this message]
2016-10-29 21:07                           ` Daniel Gruss
2016-10-29 21:45                             ` Pavel Machek
2016-10-29 21:49                               ` Daniel Gruss
2016-10-29 22:01                                 ` Pavel Machek
2016-10-29 22:02                                   ` Daniel Gruss
2016-10-31  8:27                 ` Pavel Machek
2016-10-31 14:47                   ` Mark Rutland
2016-10-31 21:13                     ` Pavel Machek
2016-10-31 22:09                       ` Mark Rutland
2016-11-01  6:33                   ` Ingo Molnar
2016-11-01  7:20                     ` Daniel Micay
2016-11-01  7:53                     ` Daniel Gruss
2016-11-01  8:10                     ` Pavel Machek
2016-11-01  8:13                       ` Daniel Gruss

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=20161029210518.GC3827@amd \
    --to=pavel@ucw.cz \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=daniel@gruss.cc \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=peterz@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 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).