All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Ingo Molnar <mingo@kernel.org>
Cc: 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>,
	"kernel-hardening@lists.openwall.com"
	<kernel-hardening@lists.openwall.com>
Subject: [kernel-hardening] Re: rowhammer protection [was Re: Getting interrupt every million cache misses]
Date: Fri, 28 Oct 2016 13:55:45 +0200	[thread overview]
Message-ID: <20161028115545.GC5635@amd> (raw)
In-Reply-To: <20161028085937.GA21247@gmail.com>

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

Hi!

> > I agree this needs to be tunable (and with the other suggestions). But
> > this is actually not the most important tunable: the detection
> > threshold (rh_attr.sample_period) should be way more important.
> > 
> > And yes, this will all need to be tunable, somehow. But lets verify
> > that this works, first :-).
> 
> Yeah.
> 
> Btw., a 56 NMI delay is pretty brutal in terms of latencies - it might
> result in a smoother system to detect 100,000 cache misses and do a
> ~5.6 msecs delay instead?
> 
> (Assuming the shorter threshold does not trigger too often, of
> course.)

Yeah, it is brutal workaround for a nasty bug. Slowdown depends on maximum utilization:

+/*
+ * Maximum permitted utilization of DRAM. Setting this to f will mean that
+ * when more than 1/f of maximum cache-miss performance is used, delay will
+ * be inserted, and will have similar effect on rowhammer as refreshing memory
+ * f times more often.
+ *
+ * Setting this to 8 should prevent the rowhammer attack.
+ */
+       int dram_max_utilization_factor = 8;

|                               | no prot. | fact. 1 | fact. 2 | fact. 8 |
| linux-n900$ time ./mkit       | 1m35     | 1m47    | 2m07    | 6m37    |
| rowhammer-test (for 43200000) | 2.86     | 9.75    | 16.7307 | 59.3738 |

(With factor 1 and 2 cpu attacker, we don't guarantee any protection.)

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 --]

WARNING: multiple messages have this Message-ID (diff)
From: Pavel Machek <pavel@ucw.cz>
To: Ingo Molnar <mingo@kernel.org>
Cc: 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>,
	"kernel-hardening@lists.openwall.com" 
	<kernel-hardening@lists.openwall.com>
Subject: Re: rowhammer protection [was Re: Getting interrupt every million cache misses]
Date: Fri, 28 Oct 2016 13:55:45 +0200	[thread overview]
Message-ID: <20161028115545.GC5635@amd> (raw)
In-Reply-To: <20161028085937.GA21247@gmail.com>

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

Hi!

> > I agree this needs to be tunable (and with the other suggestions). But
> > this is actually not the most important tunable: the detection
> > threshold (rh_attr.sample_period) should be way more important.
> > 
> > And yes, this will all need to be tunable, somehow. But lets verify
> > that this works, first :-).
> 
> Yeah.
> 
> Btw., a 56 NMI delay is pretty brutal in terms of latencies - it might
> result in a smoother system to detect 100,000 cache misses and do a
> ~5.6 msecs delay instead?
> 
> (Assuming the shorter threshold does not trigger too often, of
> course.)

Yeah, it is brutal workaround for a nasty bug. Slowdown depends on maximum utilization:

+/*
+ * Maximum permitted utilization of DRAM. Setting this to f will mean that
+ * when more than 1/f of maximum cache-miss performance is used, delay will
+ * be inserted, and will have similar effect on rowhammer as refreshing memory
+ * f times more often.
+ *
+ * Setting this to 8 should prevent the rowhammer attack.
+ */
+       int dram_max_utilization_factor = 8;

|                               | no prot. | fact. 1 | fact. 2 | fact. 8 |
| linux-n900$ time ./mkit       | 1m35     | 1m47    | 2m07    | 6m37    |
| rowhammer-test (for 43200000) | 2.86     | 9.75    | 16.7307 | 59.3738 |

(With factor 1 and 2 cpu attacker, we don't guarantee any protection.)

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-28 11:55 UTC|newest]

Thread overview: 56+ 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       ` [kernel-hardening] " Kees Cook
2016-10-27 20:40         ` Kees Cook
2016-10-27 21:27         ` [kernel-hardening] rowhammer protection [was Re: Getting interrupt every million cache misses] Pavel Machek
2016-10-27 21:27           ` Pavel Machek
2016-10-28  7:07           ` [kernel-hardening] " Ingo Molnar
2016-10-28  7:07             ` Ingo Molnar
2016-10-28  8:50             ` [kernel-hardening] " Pavel Machek
2016-10-28  8:50               ` Pavel Machek
2016-10-28  8:59               ` [kernel-hardening] " Ingo Molnar
2016-10-28  8:59                 ` Ingo Molnar
2016-10-28 11:55                 ` Pavel Machek [this message]
2016-10-28 11:55                   ` Pavel Machek
2016-10-28  9:04               ` [kernel-hardening] " Peter Zijlstra
2016-10-28  9:04                 ` Peter Zijlstra
2016-10-28  9:27                 ` [kernel-hardening] " Vegard Nossum
2016-10-28  9:27                   ` Vegard Nossum
2016-10-28  9:35                   ` [kernel-hardening] " Ingo Molnar
2016-10-28  9:35                     ` Ingo Molnar
2016-10-28  9:47                     ` [kernel-hardening] " Vegard Nossum
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 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 20:14                         ` Daniel Gruss
2016-10-29 21:05                         ` Pavel Machek
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=20161028115545.GC5635@amd \
    --to=pavel@ucw.cz \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --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 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.