Bug 212181

Summary: KASAN (hw-tags): use read-only static keys
Product: Memory Management Reporter: Andrey Konovalov (andreyknvl)
Component: SanitizersAssignee: MM/Sanitizers virtual assignee (mm_sanitizers)
Status: NEW ---    
Severity: normal CC: kasan-dev, melver
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: upstream Subsystem:
Regression: No Bisected commit-id:

Description Andrey Konovalov 2021-03-09 14:08:04 UTC
Currently, HW_TAGS KASAN uses read/write static keys (search for DEFINE_STATIC_KEY) as the read-only static keys were buggy when HW_TAGS was being worked on.
Comment 1 Marco Elver 2021-11-19 13:42:44 UTC
Fully solving this requires reworking static keys itself and how it maintains the list of locations it needs to patch, which is infeasible.

The problem is that any static key that is EXPORT_SYMBOL cannot be read-only. That means kasan_flag_enabled cannot be read-only.

However, kasan_flag_stacktrace can trivially be changed. We can leave this bug open just for that static key if we're sure it won't need changing after init.