Skip to content

Commit

Permalink
fix: makes it work with java
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jan 30, 2023
1 parent 298a1d6 commit d6dd661
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/catbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};

use libc_stdhandle::{stderr, stdin, stdout};
use log::{debug, error, info};
use nix::libc::{self, freopen};
use nix::libc::{self, freopen, ptrace};
use nix::mount::{mount, MsFlags};
use nix::sys::ptrace;
use nix::sys::resource::{setrlimit, Resource};
Expand Down Expand Up @@ -312,9 +312,10 @@ pub fn run(option: &CatBoxOption) -> Result<CatBoxResult, CatBoxError> {
| Signal::SIGSYS
| Signal::SIGXFSZ => {
info!("Child process #{}. is stopped by {}", pid, signal);
ptrace::kill(pid)?;
last_signal = Some(signal);
break (None, Some(signal));
ptrace::cont(pid, signal)?;
// ptrace::kill(pid)?;
// break (None, Some(signal));
}
// 未捕获 SIGCONT,不是终端
Signal::SIGCONT | Signal::SIGHUP | Signal::SIGINT => {
Expand Down
4 changes: 2 additions & 2 deletions src/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl SyscallFilter {
match feature {
RestrictedSyscall::Net => {
self
.forbid(SYS_socket)
// .forbid(SYS_socket)
.forbid(SYS_socketpair)
.forbid(SYS_setsockopt)
.forbid(SYS_getsockopt)
Expand All @@ -73,7 +73,7 @@ impl SyscallFilter {
.forbid(SYS_listen)
.forbid(SYS_accept)
.forbid(SYS_accept4)
.forbid(SYS_connect)
// .forbid(SYS_connect)
.forbid(SYS_shutdown);
}
RestrictedSyscall::Process => {
Expand Down

0 comments on commit d6dd661

Please sign in to comment.