]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
config: enable seccomp profile only when compiled with libseccomp 3947/head
authorMaximilian Blenk <Maximilian.Blenk@bmw.de>
Mon, 23 Aug 2021 20:04:40 +0000 (22:04 +0200)
committerMaximilian Blenk <Maximilian.Blenk@bmw.de>
Mon, 23 Aug 2021 23:17:32 +0000 (01:17 +0200)
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>
src/lxc/confile.c

index d8b96c6921d1f01d8bb36ce05a613635a5321753..1cc8da15f190a65d642c80fc486538e2d7efad3f 100644 (file)
@@ -1211,7 +1211,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,
@@ -4383,7 +4387,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,