mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 23:31:04 +00:00
PVF: remove audit log access (#2461)
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
use crate::{
|
||||
artifacts::ArtifactId,
|
||||
metrics::Metrics,
|
||||
security,
|
||||
worker_intf::{
|
||||
clear_worker_dir_path, framed_recv, framed_send, spawn_with_program_path, IdleWorker,
|
||||
SpawnErr, WorkerDir, WorkerHandle, JOB_TIMEOUT_WALL_CLOCK_FACTOR,
|
||||
@@ -134,7 +133,6 @@ pub async fn start_work(
|
||||
pid,
|
||||
|tmp_artifact_file, mut stream, worker_dir| async move {
|
||||
let preparation_timeout = pvf.prep_timeout();
|
||||
let audit_log_file = security::AuditLogFile::try_open_and_seek_to_end().await;
|
||||
|
||||
if let Err(err) = send_request(&mut stream, &pvf).await {
|
||||
gum::warn!(
|
||||
@@ -170,7 +168,6 @@ pub async fn start_work(
|
||||
&pvf,
|
||||
&cache_path,
|
||||
preparation_timeout,
|
||||
audit_log_file,
|
||||
)
|
||||
.await,
|
||||
Ok(Err(err)) => {
|
||||
@@ -211,34 +208,13 @@ async fn handle_response(
|
||||
pvf: &PvfPrepData,
|
||||
cache_path: &Path,
|
||||
preparation_timeout: Duration,
|
||||
audit_log_file: Option<security::AuditLogFile>,
|
||||
) -> Outcome {
|
||||
let PrepareWorkerSuccess { checksum, stats: PrepareStats { cpu_time_elapsed, memory_stats } } =
|
||||
match result.clone() {
|
||||
Ok(result) => result,
|
||||
// Timed out on the child. This should already be logged by the child.
|
||||
Err(PrepareError::TimedOut) => return Outcome::TimedOut,
|
||||
Err(PrepareError::JobDied { err, job_pid }) => {
|
||||
// The job died. Check if it was due to a seccomp violation.
|
||||
//
|
||||
// NOTE: Log, but don't change the outcome. Not all validators may have
|
||||
// auditing enabled, so we don't want attackers to abuse a non-deterministic
|
||||
// outcome.
|
||||
for syscall in
|
||||
security::check_seccomp_violations_for_job(audit_log_file, job_pid).await
|
||||
{
|
||||
gum::error!(
|
||||
target: LOG_TARGET,
|
||||
%worker_pid,
|
||||
%job_pid,
|
||||
%syscall,
|
||||
?pvf,
|
||||
"A forbidden syscall was attempted! This is a violation of our seccomp security policy. Report an issue ASAP!"
|
||||
);
|
||||
}
|
||||
|
||||
return Outcome::JobDied { err, job_pid }
|
||||
},
|
||||
Err(PrepareError::JobDied { err, job_pid }) => return Outcome::JobDied { err, job_pid },
|
||||
Err(PrepareError::OutOfMemory) => return Outcome::OutOfMemory,
|
||||
Err(err) => return Outcome::Concluded { worker, result: Err(err) },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user