alloc_tag: allocate percpu counters for module tags dynamically
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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.
From the CVE record · Linux
The Linux kernel can free per-CPU counters while unloaded modules’ allocation tags still reference them. Accessing memory allocated by such a module after it is unloaded can trigger a use-after-free. The input does not specify whether exploitation requires network or local access, authentication, or user interaction.
Engineers running Linux kernels with memory allocation profiling should check whether their kernel includes the alloc_tag fix; affected versions are not specified.