mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:08:12 +00:00
Kernel: Make Process::start_tracing_from API OOM safe
Modify the API so it's possible to propagate error on OOM failure. NonnullOwnPtr<T> is not appropriate for the ThreadTracer::create() API, so switch to OwnPtr<T>, use adopt_own_if_nonnull() to handle creation.
This commit is contained in:
parent
dba261f79b
commit
956314f0a1
4 changed files with 12 additions and 6 deletions
|
@ -51,7 +51,9 @@ static KResultOr<u32> handle_ptrace(const Kernel::Syscall::SC_ptrace_params& par
|
|||
if (peer_process.tracer()) {
|
||||
return EBUSY;
|
||||
}
|
||||
peer_process.start_tracing_from(caller.pid());
|
||||
auto result = peer_process.start_tracing_from(caller.pid());
|
||||
if (result.is_error())
|
||||
return result.error();
|
||||
ScopedSpinLock lock(peer->get_lock());
|
||||
if (peer->state() != Thread::State::Stopped) {
|
||||
peer->send_signal(SIGSTOP, &caller);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue