seccomp: use lxc_log_get_level()

This will now enable LXD users to dump the seccomp filter in the log when logging at TRACE level. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 09c8768a
...@@ -1260,16 +1260,18 @@ int lxc_seccomp_load(struct lxc_conf *conf) ...@@ -1260,16 +1260,18 @@ int lxc_seccomp_load(struct lxc_conf *conf)
/* After load seccomp filter into the kernel successfully, export the current seccomp /* After load seccomp filter into the kernel successfully, export the current seccomp
* filter to log file */ * filter to log file */
#if HAVE_SCMP_FILTER_CTX #if HAVE_SCMP_FILTER_CTX
if ((lxc_log_get_level() <= LXC_LOG_LEVEL_TRACE || if (lxc_log_get_level() <= LXC_LOG_LEVEL_TRACE) {
conf->loglevel <= LXC_LOG_LEVEL_TRACE) && int fd_log;
lxc_log_get_fd() >= 0) {
ret = seccomp_export_pfc(conf->seccomp.seccomp_ctx, lxc_log_fd); fd_log = lxc_log_get_fd();
/* Just give an warning when export error */ if (fd_log >= 0) {
ret = seccomp_export_pfc(conf->seccomp.seccomp_ctx, fd_log);
if (ret < 0) { if (ret < 0) {
errno = -ret; errno = -ret;
SYSWARN("Failed to export seccomp filter to log file"); SYSWARN("Failed to export seccomp filter to log file");
} }
} }
}
#endif #endif
#if HAVE_DECL_SECCOMP_NOTIFY_FD #if HAVE_DECL_SECCOMP_NOTIFY_FD
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment