From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753334AbdKVWgz (ORCPT ); Wed, 22 Nov 2017 17:36:55 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:54368 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752318AbdKVWgx (ORCPT ); Wed, 22 Nov 2017 17:36:53 -0500 Date: Wed, 22 Nov 2017 23:36:50 +0100 From: Pavel Machek To: Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, ard.biesheuvel@linaro.org, sboyd@codeaurora.org, dave.hansen@linux.intel.com, keescook@chromium.org Subject: Re: [PATCH 00/18] arm64: Unmap the kernel whilst running in userspace (KAISER) Message-ID: <20171122223650.GA6130@amd> References: <1510942921-12564-1-git-send-email-will.deacon@arm.com> <20171122161913.GB12684@amd> <20171122193713.GL22648@arm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zYM0uCDKw75PZbzx" Content-Disposition: inline In-Reply-To: <20171122193713.GL22648@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --zYM0uCDKw75PZbzx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed 2017-11-22 19:37:14, Will Deacon wrote: > On Wed, Nov 22, 2017 at 05:19:14PM +0100, Pavel Machek wrote: > > > This patch series implements something along the lines of KAISER for = arm64: > > >=20 > > > https://gruss.cc/files/kaiser.pdf > > >=20 > > > although I wrote this from scratch because the paper has some funny > > > assumptions about how the architecture works. There is a patch series > > > in review for x86, which follows a similar approach: > > >=20 > > > http://lkml.kernel.org/r/<20171110193058.BECA7D88@viggo.jf.intel.co= m> > > >=20 > > > and the topic was recently covered by LWN (currently subscriber-only): > > >=20 > > > https://lwn.net/Articles/738975/ > > >=20 > > > The basic idea is that transitions to and from userspace are proxied > > > through a trampoline page which is mapped into a separate page table = and > > > can switch the full kernel mapping in and out on exception entry and > > > exit respectively. This is a valuable defence against various KASLR a= nd > > > timing attacks, particularly as the trampoline page is at a fixed vir= tual > > > address and therefore the kernel text can be randomized > > > independently. > >=20 > > If I'm willing to do timing attacks to defeat KASLR... what prevents > > me from using CPU caches to do that? >=20 > Is that a rhetorical question? If not, then I'm probably not the best per= son > to answer it. All I'm doing here is protecting against a class of attacks= on > kaslr that make use of the TLB/page-table walker to determine where the > kernel is mapped. Yeah. What I'm saying is that I can use cache effects to probe where kernel is mapped (and what it is doing). > > There was blackhat talk about exactly that IIRC... >=20 > Got a link? I'd be interested to see how the idea works in case there's an > orthogonal defence against it. https://www.youtube.com/watch?v=3D9KsnFWejpQg (Tell me if it is not the right one). As of defenses... yes. "maxcpus=3D1" and flush caches on switch to usermode will do the trick :-). Ok, so that was sarcastic. I'm not sure if good defense exists. ARM is better than i386 because reading time and cache flushing is priviledged, but... Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --zYM0uCDKw75PZbzx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAloV/AIACgkQMOfwapXb+vJ+hQCeKrXzoGdlqvjQCAjOop+7w0zD fzQAn1MY6wADTMhYoC9iNH2fDtPOikJH =xujW -----END PGP SIGNATURE----- --zYM0uCDKw75PZbzx--