diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2021-09-14 11:05:17 -0700 |
---|---|---|
committer | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-09-14 18:31:16 +0000 |
commit | fbb31b4519256c119b99fcf5b8bed9dd0acb937b (patch) | |
tree | 9bb347b7ac6fef036443af1d5cfc5608b789f20a /Kernel | |
parent | 44cc6e1662a25887f6596bc4069cf3ff5856b834 (diff) | |
download | serenity-fbb31b4519256c119b99fcf5b8bed9dd0acb937b.zip |
Kernel: Disable lock rank enforcement by default for now
There are a few violations with signal handling that I won't be able to
fix it until later this week. So lets put lock rank enforcement under a
debug option for now so other folks don't hit these crashes until rank
enforcement is more fleshed out.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Debug.h.in | 4 | ||||
-rw-r--r-- | Kernel/Locking/LockRank.cpp | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/Kernel/Debug.h.in b/Kernel/Debug.h.in index 78820e6848..d8315c095c 100644 --- a/Kernel/Debug.h.in +++ b/Kernel/Debug.h.in @@ -170,6 +170,10 @@ #cmakedefine01 LOCK_IN_CRITICAL_DEBUG #endif +#ifndef LOCK_RANK_ENFORCEMENT +#cmakedefine01 LOCK_RANK_ENFORCEMENT +#endif + #ifndef LOCK_RESTORE_DEBUG #cmakedefine01 LOCK_RESTORE_DEBUG #endif diff --git a/Kernel/Locking/LockRank.cpp b/Kernel/Locking/LockRank.cpp index 62efe7400d..338e24d508 100644 --- a/Kernel/Locking/LockRank.cpp +++ b/Kernel/Locking/LockRank.cpp @@ -14,16 +14,20 @@ namespace Kernel { void track_lock_acquire(LockRank rank) { - auto thread = Thread::current(); - if (thread && !thread->is_crashing()) - thread->track_lock_acquire(rank); + if constexpr (LOCK_RANK_ENFORCEMENT) { + auto thread = Thread::current(); + if (thread && !thread->is_crashing()) + thread->track_lock_acquire(rank); + } } void track_lock_release(LockRank rank) { - auto thread = Thread::current(); - if (thread && !thread->is_crashing()) - thread->track_lock_release(rank); + if constexpr (LOCK_RANK_ENFORCEMENT) { + auto thread = Thread::current(); + if (thread && !thread->is_crashing()) + thread->track_lock_release(rank); + } } } |