mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +00:00
Kernel: Make Region weakable and use WeakPtr<Region> instead of Region*
This turns use-after-free bugs into null pointer dereferences instead.
This commit is contained in:
parent
79576f9280
commit
30a8991dbf
5 changed files with 14 additions and 8 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <AK/InlineLinkedList.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Weakable.h>
|
||||
#include <Kernel/Heap/SlabAllocator.h>
|
||||
#include <Kernel/VM/RangeAllocator.h>
|
||||
|
||||
|
@ -41,7 +42,9 @@ enum class PageFaultResponse {
|
|||
Continue,
|
||||
};
|
||||
|
||||
class Region final : public InlineLinkedListNode<Region> {
|
||||
class Region final
|
||||
: public InlineLinkedListNode<Region>
|
||||
, public Weakable<Region> {
|
||||
friend class MemoryManager;
|
||||
|
||||
MAKE_SLAB_ALLOCATED(Region)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue