mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-22 22:01:08 +00:00
PVF worker: switch on seccomp networking restrictions (#2221)
This commit is contained in:
@@ -222,12 +222,6 @@ pub fn worker_entrypoint(
|
||||
},
|
||||
};
|
||||
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
%worker_pid,
|
||||
"worker: sending response to host: {:?}",
|
||||
response
|
||||
);
|
||||
send_response(&mut stream, response)?;
|
||||
}
|
||||
},
|
||||
@@ -360,7 +354,7 @@ fn handle_child_process(
|
||||
/// - The response, either `Ok` or some error state.
|
||||
fn handle_parent_process(
|
||||
mut pipe_read: PipeReader,
|
||||
child: Pid,
|
||||
job_pid: Pid,
|
||||
worker_pid: u32,
|
||||
usage_before: Usage,
|
||||
timeout: Duration,
|
||||
@@ -373,10 +367,11 @@ fn handle_parent_process(
|
||||
// Should retry at any rate.
|
||||
.map_err(|err| io::Error::new(io::ErrorKind::Other, err.to_string()))?;
|
||||
|
||||
let status = nix::sys::wait::waitpid(child, None);
|
||||
let status = nix::sys::wait::waitpid(job_pid, None);
|
||||
gum::trace!(
|
||||
target: LOG_TARGET,
|
||||
%worker_pid,
|
||||
%job_pid,
|
||||
"execute worker received wait status from job: {:?}",
|
||||
status,
|
||||
);
|
||||
@@ -396,6 +391,7 @@ fn handle_parent_process(
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
%worker_pid,
|
||||
%job_pid,
|
||||
"execute job took {}ms cpu time, exceeded execute timeout {}ms",
|
||||
cpu_tv.as_millis(),
|
||||
timeout.as_millis(),
|
||||
@@ -428,6 +424,7 @@ fn handle_parent_process(
|
||||
gum::warn!(
|
||||
target: LOG_TARGET,
|
||||
%worker_pid,
|
||||
%job_pid,
|
||||
"execute job error: {}",
|
||||
job_error,
|
||||
);
|
||||
@@ -443,15 +440,18 @@ fn handle_parent_process(
|
||||
//
|
||||
// The job gets SIGSYS on seccomp violations, but this signal may have been sent for some
|
||||
// other reason, so we still need to check for seccomp violations elsewhere.
|
||||
Ok(WaitStatus::Signaled(_pid, signal, _core_dump)) =>
|
||||
Ok(WorkerResponse::JobDied(format!("received signal: {signal:?}"))),
|
||||
Ok(WaitStatus::Signaled(_pid, signal, _core_dump)) => Ok(WorkerResponse::JobDied {
|
||||
err: format!("received signal: {signal:?}"),
|
||||
job_pid: job_pid.as_raw(),
|
||||
}),
|
||||
Err(errno) => Ok(internal_error_from_errno("waitpid", errno)),
|
||||
|
||||
// It is within an attacker's power to send an unexpected exit status. So we cannot treat
|
||||
// this as an internal error (which would make us abstain), but must vote against.
|
||||
Ok(unexpected_wait_status) => Ok(WorkerResponse::JobDied(format!(
|
||||
"unexpected status from wait: {unexpected_wait_status:?}"
|
||||
))),
|
||||
Ok(unexpected_wait_status) => Ok(WorkerResponse::JobDied {
|
||||
err: format!("unexpected status from wait: {unexpected_wait_status:?}"),
|
||||
job_pid: job_pid.as_raw(),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user