[Discuss] Help needed in trying to figure out how the various Meltdown and Spectre mitigations fit together

Cy Schubert Cy.Schubert at cschubert.com
Thu Jan 18 23:00:49 PST 2018


In message <alpine.DEB.2.11.1801171017190.18536 at enira.zlyna.ubzr>, "Alan W. 
Irw
in" writes:
> Hi guys:
>
> For the new hardware buy I am considering (referred to in another
> thread), I have decided to go with an AMD Ryzen 7 1700 8-core, 64GB
> DDR4 hardware package, but I am still deciding about who I get to
> build this beast, and when I actually go ahead with this. To help
> decide that timing, I need some help trying to figure out how the
> various Meltdown and Spectre mitigations all fit together.
>
> According to
> <https://www.phoronix.com/scan.php?page=news_item&px=AMD-Is-Vulnerable-Varian
> t-2>
> and other sources AMD still feels their chips are not vulnerable to
> the Meltdown issue that plagues Intel chips, but AMD chips are apparently
> vulnerable to Spectre (just like Intel chips).  Apparently mitigation of the 
> AMD Spectre
> chip issue requires firmware patches (just coming out for AMD), propagation

Virtually all silicone is affected by variants 1 & 2 to some degree or 
another, including PowerPC, Arm, AMD, and even z/Series (S/370), etc.

> of those to motherboard manufacturers, and eventually BIOS reflashing
> by computer buyers, but Linux users will also require software updates.  For
> example, from the above article we have this statement:

I suppose MB manufacturers could reflash BIOS to include firmware however 
it's simpler to let the O/S do it, distributing microcode to O/S vendors 
who can package it as patches.

Depending on the CPU, a microcode update is simply writing the microcode to 
one of the machine status registers. The microcode update is erased the 
next time CPU is reset, i.e. reboot, and must be loaded again next boot.

>
> "The Retpoline Linux patches continue to be worked on but have yet to
> be mainlined. It's looking like Retpoline will likely land for Linux
> 4.16. There are also needed LLVM / GCC patches too, which have yet to
> land but hopefully will still make it for the upcoming GCC 8.0
> release."

Retpoline is simply an indirect branch through a thunk with an infinite 
loop of an instruction that halts speculative execution such as pause or 
lfence. The infinite loop, which is never reached, is used to fill the 
speculative instruction queue with jmp instructions.

>
> What I don't understand is if the firmware patches are a fix for the
> fundamental AMD chip design flaw (i.e., that speculative execution can

It's not an AMD design flaw. All processors that utilize cache (all of 
them) suffer from spectre to one degree or another. It's a cache design 
flaw that is exploited using a rowhammer exploit.

Rowhammer is used to disclose the contents of memory an application does 
not have access to, memory such as cache, memory such as SSD. (A rowhammer 
exploit can also be used to disclose the contents of files you do not have 
access to on an SSD device. Thus from this standpoint spinning disk is more 
secure.)

> occur without checking at the right time that the programme is allowed
> access to that particular memory being accessed by the speculative
> execution) why are Linux kernel and especially gcc changes required in
> addition?  Does this mean that the AMD firmware patches are just
> workarounds for the fundamental issue and therefore need additional
> help from OS and compiler?

It's not just AMD. All CPUs suffer from this from one degree or another. 
Your smartphone is also vulnerable.

Ultimately a new memory design (includes cache) would be required to fully 
address these flaws. Remember, rowhammer is how the exploits harvest the 
contents of memory.

>
> Here are some further related questions concerning how these firmware,
> kernel, and compiler changes all fit together:
>
> * Will the planned Linux kernel and gcc changes completely protect me (albeit
>    with a modest decrease in speed) even if I
>    don't get the BIOS upgrade?

No.

>
> * Assuming all of AMD, the motherboard manufacturer, and my computer
>    builder are competent is there any chance that the actual reflashing
>    process done by the computer builder to upgrade the BIOS (say a year
>    from now) could turn my nice new computer into a brick?

It's not just AMD. Intel, ARM, Power, and other silicone are also affected 
by variants 1 and 2 (Sectre) to one degree or another. Only Intel is 
affected by variant 3 (Meltdown).

>
> * If so, would it be a better idea to put off the computer buy for a
>    year or so until all the remaining firmware, Linux kernel, and gcc
>    updates are sorted out?

Maybe or purchase AMD. AMD has had some nasty bugs too. Not nearly as bad 
as meltdown (variant 3) but they were bad enough. The Phenom bug comes to 
mind.

I doubt this will be the last of serious hardware security bugs. We will 
likely see more serious hardware security flaws this year.


-- 
Cheers,
Cy Schubert <Cy.Schubert at cschubert.com>
FreeBSD UNIX:  <cy at FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.





More information about the Discuss mailing list