Bug 218322

Summary: KASAN (hw-tags): skip page_alloc (un)poisoning of large kmalloc allocations
Product: Memory Management Reporter: Andrey Konovalov (andreyknvl)
Component: SanitizersAssignee: MM/Sanitizers virtual assignee (mm_sanitizers)
Status: NEW ---    
Severity: normal CC: kasan-dev
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:

Description Andrey Konovalov 2023-12-26 00:08:36 UTC
Currently, the tag-based KASAN modes rely on page_alloc to poison/unpoison large kmalloc allocations.

However, for the Hardware Tag-Based mode, page_alloc might skip unpoisoning due to sampling, which shouldn't affect large kmalloc allocations.

We should skip (un)poisoning of large kmalloc allocations in page_alloc via __GFP_SKIP_KASAN and (un)poison them in kasan_kmalloc/kfree_large instead.

Or we could document that the kasan.page_alloc.sample command-line parameter also affects large kmalloc allocations. This would be, arguably, confusing, as the parameter does not affect e.g. vmalloc allocations even though they rely on page_alloc as well.
Comment 1 Andrey Konovalov 2024-01-10 03:03:55 UTC
If skipping is implemented, https://bugzilla.kernel.org/show_bug.cgi?id=218358 becomes obsolete.