On 8/25/2025 11:44 PM, Marco Elver wrote: > ... > > Introduce a new mode, TYPED_KMALLOC_CACHES, which leverages Clang's > "allocation tokens" via __builtin_alloc_token_infer [1]. > > This mechanism allows the compiler to pass a token ID derived from the > allocation's type to the allocator. The compiler performs best-effort > type inference, and recognizes idioms such as kmalloc(sizeof(T), ...). > Unlike RANDOM_KMALLOC_CACHES, this mode deterministically assigns a slab > cache to an allocation of type T, regardless of allocation site. > > Clang's default token ID calculation is described as [1]: > > TypeHashPointerSplit: This mode assigns a token ID based on the hash > of the allocated type's name, where the top half ID-space is reserved > for types that contain pointers and the bottom half for types that do > not contain pointers. >
Is a type's token id always the same across different builds? Or somehow predictable? If so, the attacker could probably find out all types that end up with the same id, and use some of them to exploit the buggy one. -Ruiqi