Article View: alt.privacy.anon-server
Article #296920Re: Intel junk...Kernel-memory-leaking Intel processor design flaw forces Linux, Windows redesign
From: Jan-Erik Soderholm
Date: Sun, 07 Jan 2018 00:12
Date: Sun, 07 Jan 2018 00:12
80 lines
5166 bytes
5166 bytes
Den 2018-01-06 kl. 19:23, skrev Tim Streater: > In article <p2qtjk$ul0$1@Iltempo.Update.UU.SE>, Johnny Billquist > <bqt@softjar.se> wrote: > >> And then they figured out a clever way of mining the contents of the cache. >> >> One could argue that the cache should be invalidated in such a scenario, >> but that is not happening either. > > Never mind invalidating it. WTF is going on if a non-priv process has > the right to do anything at all to the cache? Non-priv processes > shouldn't even be aware that there *is* a cache, never mind having the > right to execute instructions *about* the cache. > The non-priv process doesn't know there is a cache and it doesn't do anything with the cache. Short summary... You have two arrays in your code, ar1 is 16 bytes and ar2 is 256*1024 or 262144 bytes (see * below). Then you have an read from the smaller array using an index: ar1[x] so far so good. But then you add a range check: if (x < 16): ar1[x] And then you use the value read from ar1 as an index into ar2: if (x < 16): y = ar2[(ar1[x] * 1024)] Then you run this a number of times with x < 16 to "learn" the predictive execution unit that x is "usually lower then 16". So the next time, the processor guesses that it will probably need to run the code after the if, so it does that at once, at more or less the same time as the if is evaluated. The value of x must of course be fetched, but it is optimized over to the second statement before any priv-checkes has been done. One other important thing, is that you have also run some other code of your own so that ar2 is completely removed from the cache. Any read from ar2 will have to go to real memory. The value ar1[x] will be lost, but one member of ar2 will have been read and is now cached. And the address is a direct track back to the (protected) value read using an invalid value of x using ar1. Anyware in any physically accessable memory. Now, another important thing. There are counters within modern CPUs that ticks at a very high speed, say the core speed. These can be use to time critical code paths or to debug the processor itself. These timers are not critical as such, but here comes the clever part... You now read the whole of ar2, taking note of the time to read/load each member of the ar2 array. When it finds a member whos access time is way lower then the rest of the ar2 array, it has found the addess that was cached and it can count back and calculate the value that must have been read from the protected memory. And there you are. Just rerun. Clear the cache, feed the optimizer with values of x < 16, read the next protected memory address and then re-read ar2 counting the access times. The protection built in in the processor stops you from directly see the value read from ar1 (using the out of bounds value of x). Enjoy! Jan-Erik. (*) I'm not sure about the size of the second array, why not just 256 bytes? I think it has something to do with the way the cache is organized in "pages", or whatever it is called.
Technical Details
Message-ID:
<p2rolo$aul$2@news.albasani.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.os.linux.advocacy.(1483839).mbox.7z!not-for-mailReferences:
<7db9888b131268038007398919a05b86@dizum.com> <jmhs4d1khine5frfj09mahpksmclbsa88q@4ax.com> <p2m3kt$vnk$1@dont-email.me> <040120182204575400%timstreater@greenbee.net> <p2m8t9$efm$4@news.albasani.net> <p2o19j$e88$1@dont-email.me> <t7adndjRJMgAF9LHnZ2dnUU7-QnNnZ2d@giganews.com> <p2op29$v81$1@dont-email.me> <puydnboIF7Npd83HnZ2dnUU7-XnNnZ2d@giganews.com> <p2qs6u$aul$1@news.albasani.net> <w9qdnQWsSamFaM3HnZ2dnUU7-d2dnZ2d@giganews.com> <p2qtjk$ul0$1@Iltempo.Update.UU.SE> <060120181823336560%timstreater@greenbee.net>Show Full Headers
Complete Article Headers
Message-ID: <p2rolo$aul$2@news.albasani.net> Subject: Re: Intel junk...Kernel-memory-leaking Intel processor design flaw forces Linux, Windows redesign Date: Sun, 7 Jan 2018 01:12:37 +0100 From: Jan-Erik Soderholm <jan-erik.soderholm@telia.com> References: <7db9888b131268038007398919a05b86@dizum.com> <jmhs4d1khine5frfj09mahpksmclbsa88q@4ax.com> <p2m3kt$vnk$1@dont-email.me> <040120182204575400%timstreater@greenbee.net> <p2m8t9$efm$4@news.albasani.net> <p2o19j$e88$1@dont-email.me> <t7adndjRJMgAF9LHnZ2dnUU7-QnNnZ2d@giganews.com> <p2op29$v81$1@dont-email.me> <puydnboIF7Npd83HnZ2dnUU7-XnNnZ2d@giganews.com> <p2qs6u$aul$1@news.albasani.net> <w9qdnQWsSamFaM3HnZ2dnUU7-d2dnZ2d@giganews.com> <p2qtjk$ul0$1@Iltempo.Update.UU.SE> <060120181823336560%timstreater@greenbee.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.os.linux.advocacy.(1483839).mbox.7z!not-for-mail Newsgroups: alt.privacy.anon-server,alt.comp.os.windows-10,comp.os.linux.advocacy,comp.sys.mac.system,comp.os.vms Organization: albasani.net Lines: 81 Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net pZZ9PWlaxujP0gXLK7WJkBleLVI/RHBc/0AQ/KO8ZY0nHTrJrLGEURCJfAO6JNEVV/PCgZ4nxe+r99rKeZ8JUQ== NNTP-Posting-Date: Sun, 7 Jan 2018 00:12:40 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="k5Tq69Nv0uYRi9QuFVSPSHFVU7upyN+0L3suOtpdXzz5CZBEE+nafnfxCDxwo1MBx9kimuMX5Jwa8vySLjRk4+hHzmMJ8eBJ26GdmGeKsaV7rComkQrrcUDEfHc8azJh"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 In-Reply-To: <060120181823336560%timstreater@greenbee.net> Content-Language: sv Cancel-Lock: sha1:QBvuBDDZO9fv7b1KAxwWedgiBCA= X-Received-Body-CRC: 3850423854