1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:34:57 +00:00
serenity/Userland/Libraries/LibJS/Heap
Andreas Kling b6d4eea7ac LibJS: Never give back virtual memory once it belongs to a cell type
Instead of returning HeapBlock memory to the kernel (or a non-type
specific shared cache), we now keep a BlockAllocator per CellAllocator
and implement "deallocation" by basically informing the kernel that we
don't need the physical memory right now.

This is done with MADV_FREE or MADV_DONTNEED if available, but for other
platforms (including SerenityOS) we munmap and then re-mmap the memory
to achieve the same effect. It's definitely clunky, so I've added a
FIXME about implementing the madvise options on SerenityOS too.

The important outcome of this change is that GC types that use a
type-specific allocator become immune to use-after-free type confusion
attacks, since their virtual addresses will only ever be re-used for
the same exact type again and again.

Fixes #22274
2023-12-31 15:35:56 +01:00
..
BlockAllocator.cpp LibJS: Never give back virtual memory once it belongs to a cell type 2023-12-31 15:35:56 +01:00
BlockAllocator.h LibJS: Never give back virtual memory once it belongs to a cell type 2023-12-31 15:35:56 +01:00
Cell.cpp LibJS: Make Cell::initialize() return void 2023-08-08 07:39:11 +02:00
Cell.h Userland: Make bit-fields compatible with MSVC C++ ABI 2023-12-07 10:28:19 -07:00
CellAllocator.cpp LibJS: Never give back virtual memory once it belongs to a cell type 2023-12-31 15:35:56 +01:00
CellAllocator.h LibJS: Never give back virtual memory once it belongs to a cell type 2023-12-31 15:35:56 +01:00
DeferGC.h LibJS: Make GC deferral friendship based 2023-09-25 13:19:25 +02:00
GCPtr.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00
Handle.cpp LibJS: Add source location for Handle nodes in GC graph dumper output 2023-09-24 14:55:32 +02:00
Handle.h AK: Rename GenericTraits to DefaultTraits 2023-11-09 10:05:51 -05:00
Heap.cpp LibJS: Make Heap aware of all CellAllocators 2023-12-23 23:02:10 +01:00
Heap.h LibJS: Never give back virtual memory once it belongs to a cell type 2023-12-31 15:35:56 +01:00
HeapBlock.cpp LibJS: Never give back virtual memory once it belongs to a cell type 2023-12-31 15:35:56 +01:00
HeapBlock.h LibJS: Make Heap aware of all CellAllocators 2023-12-23 23:02:10 +01:00
HeapFunction.h LibJS: Declare HeapFunction::function() with [[nodiscard]] 2023-09-26 19:42:59 +02:00
HeapRoot.h LibJS: Add source location for Handle nodes in GC graph dumper output 2023-09-24 14:55:32 +02:00
Internals.h LibJS: Lower HeapBlock size to 4 KiB 2023-11-19 12:10:31 +01:00
MarkedVector.cpp LibJS: Let MarkedVector<T> inherit from Vector and handle Cell* + Value 2022-02-09 12:25:27 +00:00
MarkedVector.h LibJS: Add source location for Handle nodes in GC graph dumper output 2023-09-24 14:55:32 +02:00