Suren Baghdasaryan
052a45c1cb
alloc_tag: fix allocation tag reporting when CONFIG_MODULES=n
...
codetag_module_init() is used to initialize sections containing allocation
tags. This function is used to initialize module sections as well as core
kernel sections, in which case the module parameter is set to NULL. This
function has to be called even when CONFIG_MODULES=n to initialize core
kernel allocation tag sections. When CONFIG_MODULES=n, this function is a
NOP, which is wrong. This leads to /proc/allocinfo reported as empty.
Fix this by making it independent of CONFIG_MODULES.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 916cc5167c ("lib: code tagging framework")
Signed-off-by: Suren Baghdasaryan <[email protected] >
Cc: David Hildenbrand <[email protected] >
Cc: Kees Cook <[email protected] >
Cc: Kent Overstreet <[email protected] >
Cc: Pasha Tatashin <[email protected] >
Cc: Sourav Panda <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: <[email protected] > [6.10+]
Signed-off-by: Andrew Morton <[email protected] >
2024-09-01 17:59:03 -07:00
Suren Baghdasaryan
1438d349d1
lib: add memory allocations report in show_mem()
...
Include allocations in show_mem reports.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Kent Overstreet <[email protected] >
Signed-off-by: Suren Baghdasaryan <[email protected] >
Reviewed-by: Vlastimil Babka <[email protected] >
Tested-by: Kees Cook <[email protected] >
Cc: Alexander Viro <[email protected] >
Cc: Alex Gaynor <[email protected] >
Cc: Alice Ryhl <[email protected] >
Cc: Andreas Hindborg <[email protected] >
Cc: Benno Lossin <[email protected] >
Cc: "Björn Roy Baron" <[email protected] >
Cc: Boqun Feng <[email protected] >
Cc: Christoph Lameter <[email protected] >
Cc: Dennis Zhou <[email protected] >
Cc: Gary Guo <[email protected] >
Cc: Miguel Ojeda <[email protected] >
Cc: Pasha Tatashin <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Tejun Heo <[email protected] >
Cc: Wedson Almeida Filho <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2024-04-25 20:55:57 -07:00
Suren Baghdasaryan
47a92dfbe0
lib: prevent module unloading if memory is not freed
...
Skip freeing module's data section if there are non-zero allocation tags
because otherwise, once these allocations are freed, the access to their
code tag would cause UAF.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Suren Baghdasaryan <[email protected] >
Tested-by: Kees Cook <[email protected] >
Cc: Alexander Viro <[email protected] >
Cc: Alex Gaynor <[email protected] >
Cc: Alice Ryhl <[email protected] >
Cc: Andreas Hindborg <[email protected] >
Cc: Benno Lossin <[email protected] >
Cc: "Björn Roy Baron" <[email protected] >
Cc: Boqun Feng <[email protected] >
Cc: Christoph Lameter <[email protected] >
Cc: Dennis Zhou <[email protected] >
Cc: Gary Guo <[email protected] >
Cc: Kent Overstreet <[email protected] >
Cc: Miguel Ojeda <[email protected] >
Cc: Pasha Tatashin <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Tejun Heo <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Wedson Almeida Filho <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2024-04-25 20:55:52 -07:00
Suren Baghdasaryan
a473573964
lib: code tagging module support
...
Add support for code tagging from dynamically loaded modules.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Suren Baghdasaryan <[email protected] >
Co-developed-by: Kent Overstreet <[email protected] >
Signed-off-by: Kent Overstreet <[email protected] >
Tested-by: Kees Cook <[email protected] >
Cc: Alexander Viro <[email protected] >
Cc: Alex Gaynor <[email protected] >
Cc: Alice Ryhl <[email protected] >
Cc: Andreas Hindborg <[email protected] >
Cc: Benno Lossin <[email protected] >
Cc: "Björn Roy Baron" <[email protected] >
Cc: Boqun Feng <[email protected] >
Cc: Christoph Lameter <[email protected] >
Cc: Dennis Zhou <[email protected] >
Cc: Gary Guo <[email protected] >
Cc: Miguel Ojeda <[email protected] >
Cc: Pasha Tatashin <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Tejun Heo <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Wedson Almeida Filho <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2024-04-25 20:55:52 -07:00
Suren Baghdasaryan
916cc5167c
lib: code tagging framework
...
Add basic infrastructure to support code tagging which stores tag common
information consisting of the module name, function, file name and line
number. Provide functions to register a new code tag type and navigate
between code tags.
Link: https://lkml.kernel.org/r/[email protected]
Co-developed-by: Kent Overstreet <[email protected] >
Signed-off-by: Kent Overstreet <[email protected] >
Signed-off-by: Suren Baghdasaryan <[email protected] >
Tested-by: Kees Cook <[email protected] >
Cc: Alexander Viro <[email protected] >
Cc: Alex Gaynor <[email protected] >
Cc: Alice Ryhl <[email protected] >
Cc: Andreas Hindborg <[email protected] >
Cc: Benno Lossin <[email protected] >
Cc: "Björn Roy Baron" <[email protected] >
Cc: Boqun Feng <[email protected] >
Cc: Christoph Lameter <[email protected] >
Cc: Dennis Zhou <[email protected] >
Cc: Gary Guo <[email protected] >
Cc: Miguel Ojeda <[email protected] >
Cc: Pasha Tatashin <[email protected] >
Cc: Peter Zijlstra <[email protected] >
Cc: Tejun Heo <[email protected] >
Cc: Vlastimil Babka <[email protected] >
Cc: Wedson Almeida Filho <[email protected] >
Signed-off-by: Andrew Morton <[email protected] >
2024-04-25 20:55:52 -07:00