Slab fault injection also fails allocations in other debugging features (KMEMLEAK, stackdepot, reftracker, etc). It's not very useful, makes fail-nth do pointless iterations and may reduce effectiveness of other debugging tools (e.g. some allocations won't be tracked for memory leaks, since the KMEMLEAK allocation failed). There is GFP_NOFAIL and it does prevent fault injects. But it also means "try to allocated as hard as you can" and never return NULL from kmalloc() (I think it will loop infinitely and GFP_NOFAIL may not handle errors at all). While for debugging tools we just want to prevent fault injection, but otherwise don't need the memory allocator to try as hard as it can and can handle failures. We could add GFP_NOFAULT that would just disable fault injection. However, on the second thought, perhaps the existing GFP_NOFAIL is really the right thing for debugging tools. KASAN/KMEMLEAK/reftracker are heavy debugging tools that do relatively small allocations. So perhaps it's not bad for them to loop infinitely until the allocation succeeds, rather than degrade quality of debug checking.
Reported-by: Jason Gunthorpe <jgg@nvidia.com> Link: https://lore.kernel.org/all/Y2VT6b%2FAgwddWxYj@nvidia.com/