mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
Kernel: Allow preventing kmalloc and kfree
For "destructive" disallowance of allocations throughout the system, Thread gains a member that controls whether allocations are currently allowed or not. kmalloc checks this member on both allocations and deallocations (with the exception of early boot) and panics the kernel if allocations are disabled. This will allow for critical sections that can't be allowed to allocate to fail-fast, making for easier debugging. PS: My first proper Kernel commit :^)
This commit is contained in:
parent
b8d640c3f9
commit
e2c9578390
Notes:
sideshowbarker
2024-07-17 21:14:34 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: e2c9578390
Pull-request: https://github.com/SerenityOS/serenity/pull/11738
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/BertalanD
Reviewed-by: https://github.com/bgianfo
Reviewed-by: https://github.com/linusg ✅
2 changed files with 12 additions and 2 deletions
|
@ -1244,6 +1244,9 @@ public:
|
|||
bool is_promise_violation_pending() const { return m_is_promise_violation_pending; }
|
||||
void set_promise_violation_pending(bool value) { m_is_promise_violation_pending = value; }
|
||||
|
||||
bool is_allocation_enabled() const { return m_allocation_enabled; }
|
||||
void set_allocation_enabled(bool value) { m_allocation_enabled = value; }
|
||||
|
||||
String backtrace();
|
||||
|
||||
private:
|
||||
|
@ -1348,6 +1351,7 @@ private:
|
|||
u32 m_lock_requested_count { 0 };
|
||||
IntrusiveListNode<Thread> m_blocked_threads_list_node;
|
||||
LockRank m_lock_rank_mask { LockRank::None };
|
||||
bool m_allocation_enabled { true };
|
||||
|
||||
#if LOCK_DEBUG
|
||||
struct HoldingLockInfo {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue