4 ms·
find a bug in Intel's pseudocode It's well-known that the official docs have bugs; others have had success using AMD's to compare: https://www.os2museum.com/w
by userbinator 4y ago
find a bug in Intel's pseudocode
It's well-known that the official docs have bugs; others have had success using AMD's to compare:
https://www.os2museum.com/wp/sgdtsidt-fiction-and-reality/ https://www.os2museum.com/wp/sgdtsidt-fiction-and-reality/
- chc4 4y agoThis led to some fun times, like the infamous POP SS bug (CVE-2018-8897), which was a privilege escalation vulnerability in basically every kernel on Intel CPUs. But it didn't affect AMD CPUs, because they implemented the instruction as written in the x86 specification, which didn't have the bug that hardware did.
- rep_lodsb 4y agoThat behaviour is actually documented though? It seems to be a corner case that OS developers didn't pay attention to until it was exploited. It goes all the way back to 1980, where a revision to the 8086 introduced this to prevent an exception or non-maskable interrupt from using an incorrect stack pointer (by making MOV SS / POP SS atomic with the next instruction, which must load SP). Arguably it should no longer be necessary in ring 3 protected mode, since the stack will be switched automatically - unless the handler itself was in ring 3, but no current OS allows that?
- chc4 4y agoWoops, sorry, I was actually thinking of the SYSRET vulnerability (CVE-2012-0217) which was a mismatch between Intel and the written spec[0]. POPSS did also have differences between Intel and AMD implementations but both were vulnerable in different ways. 0: https://xenproject.org/2012/06/13/the-intel-sysret-privilege-escalation/ https://xenproject.org/2012/06/13/the-intel-sysret-privilege...
- hedora 4y agoThe X86-TSO paper is great if you want to learn how to write code for intel machines with more than one core: https://pages.cs.wisc.edu/~markhill/restricted/cacm10_x86-TSO.pdf https://pages.cs.wisc.edu/~markhill/restricted/cacm10_x86-TS... It is relevant here because none of the documentation the authors found was correct, so they wrote this and confirmed it matched observed hardware behavior. Now, I just need to find the equivalent for arm…
- gnufx 4y agoI don't remember what they cover, but Sewell's group also have models for ARM and POWER which must be referenced from https://www.cl.cam.ac.uk/~pes20/ https://www.cl.cam.ac.uk/~pes20/ For anyone who hasn't encountered one, Sewell gives excellent talks, e.g. at CCC, most recently https://media.ccc.de/v/35c3-9647-taming_the_chaos_can_we_build_systems_that_actually_work https://media.ccc.de/v/35c3-9647-taming_the_chaos_can_we_bui...
- jcranmer 4y agoIf you want to be pedantic, this isn't from the official documentation (that's the bajillion-paged manual of every instruction), it's from the intrinsics guide here: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html https://www.intel.com/content/www/us/en/docs/intrinsics-guid... Ideally, it should pull from the same master repository of information, but given my limited experience with how documentation tends to get built, I would be not at all surprised to learn that it's copy-pasted between several different projects, so that bugs in one don't get reflected in others.