diff options
author | 2025-03-03 17:28:05 +0000 | |
---|---|---|
committer | 2025-03-04 08:57:48 +0100 | |
commit | a6687c8ff613fc13a71ce1390593ba8d27c52db9 (patch) | |
tree | 4b9ec270e691d5f2e76485eb5294661c3d919eea /scripts/generate_rust_analyzer.py | |
parent | kunit, slub: Add test_kfree_rcu_wq_destroy use case (diff) | |
download | wireguard-linux-a6687c8ff613fc13a71ce1390593ba8d27c52db9.tar.xz wireguard-linux-a6687c8ff613fc13a71ce1390593ba8d27c52db9.zip |
slab: Mark large folios for debugging purposes
If a user calls p = kmalloc(1024); kfree(p); kfree(p); and 'p' was the
only object in the slab, we may free the slab after the first call to
kfree(). If we do, we clear PGTY_slab and the second call to kfree()
will call free_large_kmalloc(). That will leave a trace in the logs
("object pointer: 0x%p"), but otherwise proceed to free the memory,
which is likely to corrupt the page allocator's metadata.
Allocate a new page type for large kmalloc and mark the memory with it
while it's allocated. That lets us detect this double-free and return
without harming any data structures.
Reported-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions