Skip to content

Commit

Permalink
config: enable seccomp profile only when compiled with libseccomp
Browse files Browse the repository at this point in the history
Make lxc fail if seccomp.profile is specified but lxc is compiled
without seccomp support. Currently, seccomp.profile is silently ignored
if is specified in such a scenario. This could lead to the false
impression that the seccomp filter is applied while it actually isn't.

Signed-off-by: Maximilian Blenk <Maximilian.Blenk@bmw.de>
  • Loading branch information
Maximilian Blenk authored and Christian Brauner committed Oct 14, 2021
1 parent 58b6132 commit 61dd752
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lxc/confile.c
Expand Up @@ -1124,7 +1124,11 @@ static int set_config_seccomp_notify_proxy(const char *key, const char *value,
static int set_config_seccomp_profile(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
#ifdef HAVE_SECCOMP
return set_config_path_item(&lxc_conf->seccomp.seccomp, value);
#else
return ret_set_errno(-1, ENOSYS);
#endif
}

static int set_config_execute_cmd(const char *key, const char *value,
Expand Down Expand Up @@ -4099,7 +4103,11 @@ static int get_config_seccomp_notify_proxy(const char *key, char *retv, int inle
static int get_config_seccomp_profile(const char *key, char *retv, int inlen,
struct lxc_conf *c, void *data)
{
#ifdef HAVE_SECCOMP
return lxc_get_conf_str(retv, inlen, c->seccomp.seccomp);
#else
return ret_errno(ENOSYS);
#endif
}

static int get_config_autodev(const char *key, char *retv, int inlen,
Expand Down

0 comments on commit 61dd752

Please sign in to comment.