From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbdKWKrF (ORCPT ); Thu, 23 Nov 2017 05:47:05 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:43845 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751998AbdKWKrD (ORCPT ); Thu, 23 Nov 2017 05:47:03 -0500 Date: Thu, 23 Nov 2017 11:46:56 +0100 From: Pavel Machek To: Ard Biesheuvel Cc: Will Deacon , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Catalin Marinas , Mark Rutland , Stephen Boyd , Dave Hansen , Kees Cook Subject: Re: [PATCH 00/18] arm64: Unmap the kernel whilst running in userspace (KAISER) Message-ID: <20171123104656.GA17990@amd> References: <1510942921-12564-1-git-send-email-will.deacon@arm.com> <20171122161913.GB12684@amd> <20171122223355.GA5877@amd> <20171122233738.GA25313@amd> <20171123090747.GA6948@amd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: 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 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu 2017-11-23 09:23:02, Ard Biesheuvel wrote: > On 23 November 2017 at 09:07, Pavel Machek wrote: > > Hi! > > > >> > On 22 Nov 2017, at 23:37, Pavel Machek wrote: > >> > > >> > Hi! > >> > > >> >>>>> If I'm willing to do timing attacks to defeat KASLR... what prev= ents > >> >>>>> me from using CPU caches to do that? > >> >>>>> > >> >>>> > >> >>>> Because it is impossible to get a cache hit on an access to an > >> >>>> unmapped address? > >> >>> > >> >>> Um, no, I don't need to be able to directly access kernel addresse= s. I > >> >>> just put some data in _same place in cache where kernel data would > >> >>> go_, then do syscall and look if my data are still cached. Caches > >> >>> don't have infinite associativity. > >> >>> > >> >> > >> >> Ah ok. Interesting. > >> >> > >> >> But how does that leak address bits that are covered by the tag? > >> > > >> > Same as leaking any other address bits? Caches are "virtually > >> > indexed", > >> > >> Not on arm64, although I don=E2=80=99t see how that is relevant if you= are trying to defeat kaslr. > >> > >> > and tag does not come into play... > >> > > >> > >> Well, I must be missing something then, because I don=E2=80=99t see ho= w knowledge about which userland address shares a cache way with a kernel a= ddress can leak anything beyond the bits that make up the index (i.e., whic= h cache way is being shared) > >> > > > > Well, KASLR is about keeping bits of kernel virtual address secret > > from userland. Leaking them through cache sidechannel means KASLR is > > defeated. > > >=20 > Yes, that is what you claim. But you are not explaining how any of the > bits that we do want to keep secret can be discovered by making > inferences from which lines in a primed cache were evicted during a > syscall. >=20 > The cache index maps to low order bits. You can use this, e.g., to > attack table based AES, because there is only ~4 KB worth of tables, > and you are interested in finding out which exact entries of the table > were read by the process under attack. >=20 > You are saying the same approach will help you discover 30 high order > bits of a virtual kernel address, by observing the cache evictions in > a physically indexed physically tagged cache. How? I assumed high bits are hashed into cache index. I might have been wrong. Anyway, page tables are about same size as AES tables. So...: http://cve.circl.lu/cve/CVE-2017-5927 Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAloWpyAACgkQMOfwapXb+vJtsgCgpPoidVfhhdzM5Ghyl6hyGfH+ 5boAoLMezg2LYOQKYKP2/FfD9IpWcrvQ =9O2E -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--