diff options
| author | Suren Baghdasaryan <[email protected]> | 2025-05-17 00:07:39 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-05-25 07:53:48 +0000 |
| commit | 12ca42c237756182aad8ab04654c952765cb9061 (patch) | |
| tree | 68fcd31ac0e0624091926dc8034f73deede1f4cd /mm/vmalloc.c | |
| parent | module: release codetag section when module load fails (diff) | |
| download | kernel-12ca42c237756182aad8ab04654c952765cb9061.tar.gz kernel-12ca42c237756182aad8ab04654c952765cb9061.zip | |
alloc_tag: allocate percpu counters for module tags dynamically
When a module gets unloaded it checks whether any of its tags are still in
use and if so, we keep the memory containing module's allocation tags
alive until all tags are unused. However percpu counters referenced by
the tags are freed by free_module(). This will lead to UAF if the memory
allocated by a module is accessed after module was unloaded.
To fix this we allocate percpu counters for module allocation tags
dynamically and we keep it alive for tags which are still in use after
module unloading. This also removes the requirement of a larger
PERCPU_MODULE_RESERVE when memory allocation profiling is enabled because
percpu memory for counters does not need to be reserved anymore.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 0db6f8d7820a ("alloc_tag: load module tags into separate contiguous memory")
Signed-off-by: Suren Baghdasaryan <[email protected]>
Reported-by: David Wang <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Tested-by: David Wang <[email protected]>
Cc: Christoph Lameter (Ampere) <[email protected]>
Cc: Dennis Zhou <[email protected]>
Cc: Kent Overstreet <[email protected]>
Cc: Pasha Tatashin <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/vmalloc.c')
0 files changed, 0 insertions, 0 deletions
