Tahinli/forge
public0 watching
★ 0
| 1 | //! The container's executor. It installs the seccomp filter, then execs the job. |
| 2 | //! |
| 3 | //! This replaces libcontainer's `DefaultExecutor::exec`, which does the same exec without a |
| 4 | //! filter. libcontainer runs the executor in the init process after the namespaces, mounts and |
| 5 | //! `no_new_privileges` are set up, and right before the job starts. `seccompiler::apply_filter` |
| 6 | //! also sets `PR_SET_NO_NEW_PRIVS` itself, so an unprivileged install works. |
| 7 | |
| 8 | use CString; |
| 9 | |
| 10 | use DefaultExecutor; |
| 11 | use ; |
| 12 | use unistd; |
| 13 | use Spec; |
| 14 | use BpfProgram; |
| 15 | |
| 16 | /// Installs `filter` and execs the spec's process. The filter is built by the helper before the |
| 17 | /// container forks, so this only installs it. |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | /// Replaces the process with `args[0]`, as libcontainer's default executor does. It returns only |
| 43 | /// on failure. |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 |