Как писать и читать, используя set_seccomp_strict? - PullRequest
0 голосов
/ 21 марта 2020

Я хотел бы иметь возможность записывать данные в файл, используя режим seccomp 1:

use prctl;
use std::thread;

fn sandboxed() {

    println!("Inside sandboxed function");

    match prctl::set_seccomp_strict() {
        Ok(()) => {
                   println!("seccomp activated"),
                   //write into file here and control that len is ok !!
                   //close will be forbidden due to seccomp mode 1
                   }
        Err(ret) => println!("prctl to seccomp failed with error {}", ret)
    }

    println!("File is written !");
}


fn main() {

    println!("Starting...");

    let handle = thread::spawn(|| sandboxed() );

    handle.join().unwrap();

    println!("Back in main and shutting down.");
}

И иметь возможность читать созданный файл таким же образом, также используя set_seccomp_strict.

...