Hi Catalin, On 6/19/26 10:19 PM, Catalin Marinas wrote: > On Thu, Jun 18, 2026 at 10:35:15PM +0900, Harry Yoo wrote: >> On 6/12/26 1:44 PM, Dev Jain wrote: >>> Introduce a boot option to tag only at allocation time of the objects. This >>> reduces KASAN MTE overhead, the tradeoff being reduced ability of >>> catching bugs. >> >> I think most of overhead when enabling MTE comes from loading and >> validing tags for every memory access (either in SYNC or ASYNC mode), >> rather than from storing tags. > > I guess it depends on the workload. Lots of allocations for short-lived > buffers (e.g. network traffic) may notice the additional tagging more > than the actual tag checking.
Agreed. Likely depends on lifetime and size of objects. > Of course, it would be nice to get some numbers from those who have > access to MTE capable hardware. Agreed! (I don't have one, unfortunately. It's pretty new hardware feature) >>> Now, when a memory object will be freed, it will retain the random tag it >>> had at allocation time. This compromises on catching UAF bugs, till the >>> time the object is not reallocated, at which point it will have a new >>> random tag. >>> >>> Hence, not catching "use-after-free-before-reallocation" and not catching >>> "double-free" will be the compromise for reduced KASAN overhead. >> >> I doubt users who care about security enough to enable HW_TAGS KASAN >> are willing to compromise on security just to save a few instructions >> to store tags in the free path. >> >> To me, it looks like too much of a compromise on security for little >> performance gain. > > I don't think there's much compromise on security for use-after-free. I think it depends... OH, WAIT! I see what you mean. You mean use-after-free before reallocation does not lead to much compromise on security because objects are initialized after allocation? You're probably right. Hmm, but stores to e.g.) free pointer, fields initialized by constructor or accessed by SLAB_TYPESAFE_BY_RCU semantics after free will be undiscovered if they happen before reallocation. Not sure what are security implications of that, but sounds worth discussing. > The buffer will be re-tagged later so use-after-realloc should be > caught, especially if we ensure that a different tag will be used (I > don't think Dev's patches do this). Agreed that it'll be nice to ensure that. -- Cheers, Harry / Hyeonggon
OpenPGP_signature.asc
Description: OpenPGP digital signature

