[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161102181349.GA28047@amd>
Date: Wed, 2 Nov 2016 19:13:49 +0100
From: Pavel Machek <pavel@....cz>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Mark Rutland <mark.rutland@....com>,
Kees Cook <keescook@...omium.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
kernel list <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
"kernel-hardening@...ts.openwall.com"
<kernel-hardening@...ts.openwall.com>
Subject: Re: [kernel-hardening] rowhammer protection [was Re: Getting
interrupt every million cache misses]
Hi!
> On Fri, Oct 28, 2016 at 03:05:22PM +0100, Mark Rutland wrote:
> >
> > > > * the precise semantics of performance counter events varies drastically
> > > > across implementations. PERF_COUNT_HW_CACHE_MISSES, might only map to
> > > > one particular level of cache, and/or may not be implemented on all
> > > > cores.
> > >
> > > If it maps to one particular cache level, we are fine (or maybe will
> > > trigger protection too often). If some cores are not counted, that's bad.
> >
> > Perhaps, but that depends on a number of implementation details. If "too
> > often" means "all the time", people will turn this off when they could
> > otherwise have been protected (e.g. if we can accurately monitor the
> > last level of cache).
>
> Right, so one of the things mentioned in the paper is x86 NT stores.
> Those are not cached and I'm not at all sure they're accounted in the
> event we use for cache misses.
Well, I tried this... and the movnti is as fast as plain mov. Clearly
it is being cached here.
I guess we could switch to different performance counter, such as
+ [PERF_COUNT_HW_BUS_CYCLES] = 0xc06f, /* Non
halted bus cycles: 0x013c */
if NT stores are indeed a problem. But so far I don't have any
indication they are, so I'd like to have an working example to test
against. (It does not have to produce bitflips, it would be enough to
produce enough memory traffic bypassing cache.)
Best regards,
Pavel
/*
* gcc -O2 rowhammer.c -o rowhammer
*/
char pad[1024];
long long foo;
char pad2[1024];
void main(void)
{
long long i;
asm volatile(
"mov $foo, %%edi \n\
clflush (%%edi)" ::: "%edi");
for (i=0; i<1000000000; i++) {
#if 1
asm volatile(
"mov $foo, %%edi \n\
movnti %%eax, (%%edi)" ::: "%edi");
#endif
// asm volatile( "" );
}
}
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists