Bug 216663 - fault injection: add GFP_NOFAULT
Summary: fault injection: add GFP_NOFAULT
Status: NEW
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Sanitizers (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: MM/Sanitizers virtual assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-04 18:35 UTC by Dmitry Vyukov
Modified: 2022-11-04 18:40 UTC (History)
1 user (show)

See Also:
Kernel Version: ALL
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Dmitry Vyukov 2022-11-04 18:35:07 UTC
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.
Comment 1 Dmitry Vyukov 2022-11-04 18:40:56 UTC
Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/all/Y2VT6b%2FAgwddWxYj@nvidia.com/

Note You need to log in before you can comment on or make changes to this bug.