core: Introduce PrivateBPF= to mount a private BPFFS
Add a new option PrivateBPF= to mount a new instance of bpffs within a namespace. PrivateBPF= can be set to "no" to use the host bpffs in readonly mode and "yes" to do a new mount. The mount is done with the new fsopen()/fsmount() API because in future we'll hook some commands between the two calls.
This commit is contained in:
+5
-2
@@ -324,6 +324,7 @@ bool exec_needs_mount_namespace(
|
||||
exec_needs_cgroup_mount(context) ||
|
||||
context->protect_proc != PROTECT_PROC_DEFAULT ||
|
||||
context->proc_subset != PROC_SUBSET_ALL ||
|
||||
context->private_bpf != PRIVATE_BPF_NO ||
|
||||
exec_needs_ipc_namespace(context) ||
|
||||
exec_needs_pid_namespace(context, params))
|
||||
return true;
|
||||
@@ -1124,7 +1125,8 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
"%sKeyringMode: %s\n"
|
||||
"%sProtectHostname: %s%s%s\n"
|
||||
"%sProtectProc: %s\n"
|
||||
"%sProcSubset: %s\n",
|
||||
"%sProcSubset: %s\n"
|
||||
"%sPrivateBPF: %s\n",
|
||||
prefix, c->umask,
|
||||
prefix, empty_to_root(c->working_directory),
|
||||
prefix, empty_to_root(c->root_directory),
|
||||
@@ -1151,7 +1153,8 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
|
||||
prefix, exec_keyring_mode_to_string(c->keyring_mode),
|
||||
prefix, protect_hostname_to_string(c->protect_hostname), c->private_hostname ? ":" : "", strempty(c->private_hostname),
|
||||
prefix, protect_proc_to_string(c->protect_proc),
|
||||
prefix, proc_subset_to_string(c->proc_subset));
|
||||
prefix, proc_subset_to_string(c->proc_subset),
|
||||
prefix, private_bpf_to_string(c->private_bpf));
|
||||
|
||||
if (c->set_login_environment >= 0)
|
||||
fprintf(f, "%sSetLoginEnvironment: %s\n", prefix, yes_no(c->set_login_environment > 0));
|
||||
|
||||
Reference in New Issue
Block a user