Kernel: Don't disable interrupts in validate_inode_mmap_prot

There's no need to disable interrupts when trying to access an inode's
shared vmobject. Additionally, Inode::shared_vmobject() acquires a Mutex
which is a recipe for deadlock if acquired with interrupts disabled.
This commit is contained in:
Andrew Kaster 2021-08-22 21:48:58 -06:00 committed by Andreas Kling
parent 2038d2c49e
commit 8e70b85215
Notes: sideshowbarker 2024-07-18 05:08:53 +09:00

View File

@ -5,7 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Arch/x86/InterruptDisabler.h>
#include <Kernel/Arch/x86/MSR.h>
#include <Kernel/Arch/x86/SmapDisabler.h>
#include <Kernel/FileSystem/FileDescription.h>
@ -115,7 +114,6 @@ static bool validate_inode_mmap_prot(const Process& process, int prot, const Ino
// keep a Custody or something from mmap time.
if ((prot & PROT_WRITE) && !metadata.may_write(process))
return false;
InterruptDisabler disabler;
if (auto shared_vmobject = inode.shared_vmobject()) {
if ((prot & PROT_EXEC) && shared_vmobject->writable_mappings())
return false;