Kernel/ProcFS: Allow a process directory to have a null Process pointer

In case we are about to delete the PID directory, we clear the Process
pointer. If someone still holds a reference to the PID directory (by
opening it), we still need to delete the process, but we can't delete
the directory, so we will keep it alive, but any operation on it will
fail by propogating the error to userspace about that the Process was
deleted and therefore there's no meaning to trying to do operations on
the directory.

Fixes #8576.
This commit is contained in:
Liav A 2021-07-10 00:24:47 +03:00 committed by Andreas Kling
parent d1028f8aed
commit bee75c1f24
Notes: sideshowbarker 2024-07-18 09:03:43 +09:00
4 changed files with 87 additions and 24 deletions

View file

@ -59,8 +59,6 @@ void ProcFSComponentRegistry::unregister_process(Process& deleted_process)
process_folder->prepare_for_deletion();
process_folder->m_list_node.remove();
dbgln_if(PROCFS_DEBUG, "ProcFSExposedDirectory ref_count now: {}", process_folder->ref_count());
// Note: Let's ensure we are the last holder of the ProcFSProcessDirectory object before it can be deleted for good
VERIFY(process_folder->ref_count() == 1);
}
RefPtr<ProcFS> ProcFS::create()