mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
Kernel: Allow multiple inspectors of a process (in /proc)
Replace Process::m_being_inspected with an inspector reference count. This prevents an assertion from firing when inspecting the same process in /proc from multiple processes at the same time. It was trivially reproducible by opening multiple FileManagers.
This commit is contained in:
parent
a78bc5e6fc
commit
0e33f53cf8
1 changed files with 12 additions and 6 deletions
|
@ -371,8 +371,7 @@ public:
|
||||||
Region& allocate_split_region(const Region& source_region, const Range&, size_t offset_in_vmobject);
|
Region& allocate_split_region(const Region& source_region, const Range&, size_t offset_in_vmobject);
|
||||||
Vector<Region*, 2> split_region_around_range(const Region& source_region, const Range&);
|
Vector<Region*, 2> split_region_around_range(const Region& source_region, const Range&);
|
||||||
|
|
||||||
void set_being_inspected(bool b) { m_being_inspected = b; }
|
bool is_being_inspected() const { return m_inspector_count; }
|
||||||
bool is_being_inspected() const { return m_being_inspected; }
|
|
||||||
|
|
||||||
void terminate_due_to_signal(u8 signal);
|
void terminate_due_to_signal(u8 signal);
|
||||||
void send_signal(u8, Process* sender);
|
void send_signal(u8, Process* sender);
|
||||||
|
@ -399,6 +398,9 @@ public:
|
||||||
VeilState veil_state() const { return m_veil_state; }
|
VeilState veil_state() const { return m_veil_state; }
|
||||||
const Vector<UnveiledPath>& unveiled_paths() const { return m_unveiled_paths; }
|
const Vector<UnveiledPath>& unveiled_paths() const { return m_unveiled_paths; }
|
||||||
|
|
||||||
|
void increment_inspector_count(Badge<ProcessInspectionHandle>) { ++m_inspector_count; }
|
||||||
|
void decrement_inspector_count(Badge<ProcessInspectionHandle>) { --m_inspector_count; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class MemoryManager;
|
friend class MemoryManager;
|
||||||
friend class Scheduler;
|
friend class Scheduler;
|
||||||
|
@ -458,7 +460,6 @@ private:
|
||||||
u8 m_termination_signal { 0 };
|
u8 m_termination_signal { 0 };
|
||||||
u16 m_thread_count { 0 };
|
u16 m_thread_count { 0 };
|
||||||
|
|
||||||
bool m_being_inspected { false };
|
|
||||||
bool m_dead { false };
|
bool m_dead { false };
|
||||||
bool m_profiling { false };
|
bool m_profiling { false };
|
||||||
|
|
||||||
|
@ -509,6 +510,8 @@ private:
|
||||||
HashMap<u32, OwnPtr<WaitQueue>> m_futex_queues;
|
HashMap<u32, OwnPtr<WaitQueue>> m_futex_queues;
|
||||||
|
|
||||||
OwnPtr<PerformanceEventBuffer> m_perf_event_buffer;
|
OwnPtr<PerformanceEventBuffer> m_perf_event_buffer;
|
||||||
|
|
||||||
|
u32 m_inspector_count { 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
class ProcessInspectionHandle {
|
class ProcessInspectionHandle {
|
||||||
|
@ -517,13 +520,16 @@ public:
|
||||||
: m_process(process)
|
: m_process(process)
|
||||||
{
|
{
|
||||||
if (&process != ¤t->process()) {
|
if (&process != ¤t->process()) {
|
||||||
ASSERT(!m_process.is_being_inspected());
|
InterruptDisabler disabler;
|
||||||
m_process.set_being_inspected(true);
|
m_process.increment_inspector_count({});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
~ProcessInspectionHandle()
|
~ProcessInspectionHandle()
|
||||||
{
|
{
|
||||||
m_process.set_being_inspected(false);
|
if (&m_process != ¤t->process()) {
|
||||||
|
InterruptDisabler disabler;
|
||||||
|
m_process.decrement_inspector_count({});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Process& process() { return m_process; }
|
Process& process() { return m_process; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue