Skip to content

Commit 2f873fa

Browse files
committed
Attempt to clarify error message for missing CONFIG_SECCOMP_FILTER
General-purpose desktop distributions are compiled with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER, but vendor kernels for phones and other assorted embedded devices don't necessarily enable these options. These kernels are unsuitable for running Flatpak, or anything else that relies on `bwrap --seccomp` or `bwrap --add-seccomp-fd`. Missing CONFIG_SECCOMP or CONFIG_SECCOMP_FILTER is not the *only* reason why we could get EINVAL here: I think we'd also get EINVAL if the seccomp program is syntatically invalid. However, it's a relatively likely reason, so it seems worth providing a hint. Helps: flatpak/flatpak#3069 Signed-off-by: Simon McVittie <smcv@collabora.com>
1 parent 41fd02a commit 2f873fa

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

bubblewrap.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,15 @@ seccomp_programs_apply (void)
288288
for (program = seccomp_programs; program != NULL; program = program->next)
289289
{
290290
if (prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &program->program) != 0)
291-
die_with_error ("prctl(PR_SET_SECCOMP)");
291+
{
292+
if (errno == EINVAL)
293+
die ("Unable to set up system call filtering as requested: "
294+
"prctl(PR_SET_SECCOMP) reported EINVAL. "
295+
"(Hint: this requires a kernel configured with "
296+
"CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER.)");
297+
298+
die_with_error ("prctl(PR_SET_SECCOMP)");
299+
}
292300
}
293301
}
294302

0 commit comments

Comments
 (0)