AMD Posts New Linux Code For Zen 4's UAI Feature
The patch series sent out today, which was marked as a "request for comments" (RFC), is making use of the Upper Address Ignore (UAI) functionality found with upcoming AMD processors in order to implement user-space address tagging functionality.
The AMD64 Architecture Programmer's Manual updated back in November did lay out User Address Ignore but obviously didn't specify when it will appear in future AMD processors. With UAI patches now out for the Linux kernel, it pretty much guarantees that it's coming with Zen 4... AMD isn't yet at the stage where they are working publicly on Linux kernel features for two generations ahead.
AMD's programmer manual previously outlined the Upper Address Ignore feature. Now they are working on the first planned usage of UAI for Linux.
The AMD Upper Address Ignore functionality can be used in a similar manner to Arm's Memory Tagging Extension (MTE) that was added with Armv8.5-A and more broadly as part of AArch64 is the Top Byte Ignore (TBI) support. In Arm's MTE case is primarily intended as a memory safety feature while with AMD UAI is mainly open-ended tagging with otherwise unused bits of a memory address like AArch64 TBI.
Intel's ISA programming reference manual previously outlined their Linear Address Masking (LAM) functionality similar in nature to AMD UAI.
Intel for their part has also been working on something similar. Since 2020 I've noted how Intel has been working on Linear Address Masking (LAM). Linear Address Masking is about making use of the untranslated address bits of 64-bit linear addresses for metadata. Intel LAM is coming with future processors and the Linux kernel usage around that is still being finalized with some overlap to today's AMD UAI patches.
With the patches proposed today, AMD is looking to make use of UAI for user address tagging. The AMD patch-set builds upon the Intel LAM Linux patches for extending AArch64's SET_TAGGED_ADDR_CTRL/GET_TAGGED_ADDR_CTRL prctl() options for opening up the x86_64 address tagging to user-space. Memory tagging can be used for detecting memory bugs and other issues by tracking illegal memory operations, among other possible use-cases.
This AMD UAI support for Linux memory tagging has been "lightly tested" so far and out today under the RFC flag in seeking feedback from other kernel developers. See the patch series for this initial AMD work on user-space address tagging for the Linux kernel with their upcoming (Zen 4) processors.