Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate sandboxing for tasks on Linux (and maybe other platforms) #6811

Closed
thestinger opened this issue May 29, 2013 · 5 comments
Closed
Labels
E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. O-linux Operating system: Linux

Comments

@thestinger
Copy link
Contributor

In theory, at least on Linux, we can spawn the tasks without CLONE_VM for a private address space (as in fork). This would lay the groundwork for supporting sandboxing (seccomp, cgroups, namespaces) too.

I think this would be very useful for Servo, to sandbox spidermonkey. I don't know how viable this would be on other platforms where threads and processes aren't considered essentially the same thing by the kernel since it would likely be a huge hit to performance and memory usage.

@huonw
Copy link
Member

huonw commented Jul 23, 2013

Visiting for triage; would be a very cool feature to have built-in. "Nominating" for far-future.

@kmcallister
Copy link
Contributor

@pcwalton and I talked about a design where the sandboxing spawn takes an extern "Rust" fn and does a fork + self-exec while passing the address of that function to the new process in an env var or something. Then the new process will start there rather than main.

This wouldn't have a shared exchange heap; instead you'd have a port/chan variant that uses UNIX pipes or something. The ability to send file descriptors through UNIX-domain sockets is potentially useful.

The killer demo here is something like

do spawn {
    unsafe {
        vulnerable_c_lib(shellcode);
    }
}

Run it and pop a shell. Then change spawn to spawn_seccomp, and watch the spawn'd process get SIGKILL and the parent see a usual task failure.

@thestinger
Copy link
Contributor Author

Yeah, you wouldn't want to share memory directly between the tasks because you need to verify the integrity of any objects you receive to preserve the boundary.

@huonw
Copy link
Member

huonw commented Jan 19, 2014

triage, no change, although @thestinger wrote up something for servo here: https://github.com/mozilla/servo/wiki/Linux-sandboxing

@thestinger
Copy link
Contributor Author

I think this is better suited to a third party library. The core functionality for Linux is here:

https://github.com/thestinger/rust-seccomp

flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 11, 2021
Fix `manual_map` false positives

fixes: rust-lang#6795
fixes: rust-lang#6797
fixes: rust-lang#6811
fixes: rust-lang#6819

changelog: Fix false positives for `manual_map` when `return`, `break`, `continue`, `yield`, `await`, and partially moved values are used.
changelog: Don't expand macros in suggestions  for `manual_map`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. O-linux Operating system: Linux
Projects
None yet
Development

No branches or pull requests

3 participants