And now someone has discovered that sometimes you can enter debug mode from ring 3 and they're calling it a backdoor.
And now someone has discovered that sometimes you can enter debug mode from ring 3 and they're calling it a backdoor.
http://datasheets.chipdb.org/VIA/Nehemiah/VIA%20C3%20Nehemia...
(Page 82, "Alternate Instruction Execution")
Edit: Now it's all coming back to me. I was exploring the 0F opcode space and came upon 0F 3F, which happens to be the "enter alternate execution mode" instruction when it's enabled. There are a lot of other interesting results if you Google "0F 3F", although I remember them being a lot more relevant when I originally discovered this...
https://spth.virii.lu/29a7/Articles/29A-7.029.txt
It's not just the C3 that has this feature, if you Google "ALTINST" you'll find more info.
But the fact that you can twiddle kernel memory from userspace is still fun...
I still wonder why entering debug mode got enabled on some models, but not others. 11th-hour release-to-fab glitch? :/
For which the instruction set is not documented. For which the x86 access instruction ("bound eax") is not documented. For which the capabilities are not documented. From which you can circumvent all of the processor's security checks.
This is a _textbook_ definition of a backdoor.
Why does it matter?
This alternate instruction set is intended for testing, debug, and special application usage. Accordingly, it is not documented for general usage. If you have a justified need for access to these instructions, contact your VIA representative.
> For which the x86 access instruction ("bound eax") is not documented.
The instruction is documented to be LEA (which I presume is correct for this particular processor) and:
While all VIA C3 processor processors contain this alternate instruction feature, the invocation details (e.g., the 0x8D8400 “prefix”) may be different between processors. Check the appropriate processor data sheet for details.
> For which the capabilities are not documented.
It's documented that you can do pretty much anything:
For example, in the alternate instruction set, privileged functions can be used from any protection level, memory descriptor checking can be bypassed, and many x86 exceptions such as alignment check can be bypassed.
> This is a _textbook_ definition of a backdoor.
No.
Even modern Intel and AMD processors are "RISC" under the hood - they decompose CISC x86 instructions into RISC micro-ops, this isn't a VIA phenomenon. But they DON'T open up access to their microcode to some arbitrary user letting you circumvent ring protections to access the kernel from ring 3. If they did that would be a - wait for it - backdoor.
Granted, you can disable single user mode.
"The mechanism for initiating execution of this alternate set of instructions is as follows: 1. Set the FCR ALTINST bit to 1 using WRMSR instruction (this is a privileged instruction). This should be done using a read-modify-write sequence to preserve the values of other FCR bits. 2. The ALTINST bit enables execution of a new x86 jump instruction that starts execution of alternate instructions. This new jump instruction can be executed from any privilege level at any time that ALTINST is 1."
So to turn on the ability to execute ring-0 non-x86 instructions from ring 3, requires an initial privileged instruction. I believe (from other commenters) that the issue arises because some of the cpu's left the fab with ALTINST set to 1 by default. Meaning, no privileged instruction required. Clearly, that's a fuck-up somewhere.