Last year AMD and Intel as part of the x86 Ecosystem Advisory Group announced ChkTag for x86 memory tagging across processors to better fight buffer overflows and use-after-free errors. In preparing for ChkTag with future processors, Intel has begun adapting their Linear Address Masking (LAM) support to more nicely jive with it.
ChkTag is going to bring new x86 instructions for detecting memory safety violations and various other controls for lots of flexibility around dealing with memory safety issues. Linear Address Masking meanwhile is a feature already found on recent Intel CPUs for allowing metadata like tags to be stored in the upper bits of 64-bit pointers that are otherwise typically ignored/unused. LAM can be useful for garbage collectors, memory sanitizers, security checks, etc.
Intel Linux engineers have been working on preparing a stable x86 LAM user interface in anticipation of ChkTag. Intel engineer Maciej Wieczor-Retman posted the latest patches in simplifying the LAM interface with ChkTag in mind:
“After ChkTag announcement, it’s worth preparing a stable x86 linear address masking (lam) user interface. One important aspect of lam is the tag width, and aligning it with other industry solutions can provide a more popular, generalized interface that other technologies could utilize.
ChkTag will use 4-bit tags and since that’s the direction other memory tagging implementations seem to be taking too (for example Arm’s MTE) it’s reasonable to converge lam in linux to the same specification. Even though x86’s LAM supports 6-bit tags it is beneficial to default lam to 4 bits as ChkTag will likely be the main user of the interface and such connection should simplify things in the future.
If a usecase arises in the future, the 6-bit tags can be made available as a debug feature and possible to enable through debugfs.
The patchset also cleans up some comments referencing LAM_U48 which was not implemented in the kernel and the comments shouldn’t imply it can be enabled.”
This latest code is currently undergoing review for mainlining to a future Linux kernel version. As for ChkTag itself, so far we haven’t seen any compiler or kernel patches emerge but presumably that will be picking up soon.
