MCPcopy Create free account
hub / github.com/apache/mesos / create

Method create

src/slave/containerizer/mesos/isolators/linux/seccomp.cpp:47–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45namespace slave {
46
47Try<Isolator*> LinuxSeccompIsolatorProcess::create(const Flags& flags)
48{
49 if (geteuid() != 0) {
50 return Error("Linux Seccomp isolator requires root permissions");
51 }
52
53 // Check if the kernel supports seccomp filter.
54 const int ret = prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, nullptr);
55 if (!(ret == -1 && EFAULT == errno)) {
56 return Error("Seccomp is not supported by the kernel");
57 }
58
59 if (flags.seccomp_config_dir.isNone()) {
60 return Error("Missing required `--seccomp_config_dir` flag");
61 }
62
63 Option<ContainerSeccompProfile> defaultProfile;
64
65 // Parse default Seccomp profile.
66 if (flags.seccomp_profile_name.isSome()) {
67 const auto path = path::join(
68 flags.seccomp_config_dir.get(), flags.seccomp_profile_name.get());
69
70 Try<ContainerSeccompProfile> profile =
71 mesos::internal::seccomp::parseProfile(path);
72
73 if (profile.isError()) {
74 return Error(profile.error());
75 }
76
77 defaultProfile = profile.get();
78 }
79
80 return new MesosIsolator(Owned<MesosIsolatorProcess>(
81 new LinuxSeccompIsolatorProcess(flags, defaultProfile)));
82}
83
84
85bool LinuxSeccompIsolatorProcess::supportsNesting() { return true; }

Callers

nothing calls this directly

Calls 8

parseProfileFunction · 0.85
errorMethod · 0.65
ErrorFunction · 0.50
joinFunction · 0.50
isNoneMethod · 0.45
isSomeMethod · 0.45
getMethod · 0.45
isErrorMethod · 0.45

Tested by

no test coverage detected