Skip to content

Commit

Permalink
fix: revert PR #189 due to issues while running inside a Docker conta…
Browse files Browse the repository at this point in the history
…iner.

Calling the `unshare` syscall is returning `EPERM` error under some circumstances, apparently related to being called inside a Docker container.

For instance, the generation of Python wheels is broken:
https://github.com/VirusTotal/yara-x/actions/runs/10775030489/job/29878522401#step:9:1147
  • Loading branch information
plusvic committed Sep 9, 2024
1 parent eb8611e commit f3ecfba
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 35 deletions.
22 changes: 0 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,6 @@ yara-x-parser = { workspace = true, features = ["serde"] }

lingua = { version = "1.6.2", optional = true, default-features = false, features = ["english", "german", "french", "spanish"] }

# syscalls crate is only available for Linux
[target.'cfg(target_os = "linux")'.dependencies]
syscalls = "0.6.18"

[build-dependencies]
anyhow = { workspace = true }
globwalk = { workspace = true }
Expand Down
9 changes: 0 additions & 9 deletions lib/src/scanner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,15 +591,6 @@ impl<'r> Scanner<'r> {
if self.timeout.is_some() {
INIT_HEARTBEAT.call_once(|| {
thread::spawn(|| loop {
#[cfg(target_os = "linux")]
unsafe {
// unshare(CLONE_FS) preventing setns syscall to fail
// if a timeout is set for the scanner.
// see issue: https://github.com/VirusTotal/yara-x/issues/182
syscalls::syscall!(syscalls::Sysno::unshare, 512)
.unwrap();
}

thread::sleep(Duration::from_secs(1));
ENGINE.increment_epoch();
HEARTBEAT_COUNTER
Expand Down

0 comments on commit f3ecfba

Please sign in to comment.