Linux Adjusts "Meltdown Lite" Mitigation Handling On Newer Zen 5 CPUs

Written by Michael Larabel in AMD on 25 October 2024 at 04:30 PM EDT. 15 Comments
AMD
Linus Torvalds took to some coding himself today to fix a user-address masking non-canonical speculation issue. The Linux kernel needed an adaptation for this "Meltdown Lite" issue due to different behavior with the latest AMD Zen 5 processors.

Linus Torvalds authored and committed today the patch x86: fix user address masking non-canonical speculation issue. In there he explains:
"It turns out that AMD has a "Meltdown Lite(tm)" issue with non-canonical accesses in kernel space. And so using just the high bit to decide whether an access is in user space or kernel space ends up with the good old "leak speculative data" if you have the right gadget using the result:

CVE-2020-12965 “Transient Execution of Non-Canonical Accesses“

Now, the kernel surrounds the access with a STAC/CLAC pair, and those instructions end up serializing execution on older Zen architectures, which closes the speculation window.

But that was true only up until Zen 5, which renames the AC bit. That improves performance of STAC/CLAC a lot, but also means that the speculation window is now open.

Note that this affects not just the new address masking, but also the regular valid_user_address() check used by access_ok(), and the asm version of the sign bit check in the get_user() helpers.

It does not affect put_user() or clear_user() variants, since there's no speculative result to be used in a gadget for those operations."

AMD Linux engineer Borislav Petkov commented earlier this week on the Linux kernel mailing list around the difference now with AMD Zen 5 CPUs:
"So I was able to get some info: CLAC/STAC in everything Zen4 and older is serializing so there's no issue there.

Zen5 is a different story and AC is being renamed there and thus, non-serializing. So we'd need to do something there, perhaps something like Josh's patch...

But the good thing is we can alternative it out only for those machines, apart from the rest."

The patch is now in the kernel ahead of the Linux 6.12-rc5 release this weekend and will likely be back-ported to existing stable kernel versions over the coming days.

Zen 5


More background information on the prior AMD security issue now adapted for Zen 5 coverage can be found via this security bulletin and via CVE-2020-12965 that was made public back in 2022.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week