mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-16 11:01:26 +00:00
build: add seccomp build option
Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
This commit is contained in:
parent
826391b2a2
commit
0b9adfdad4
76
meson.build
76
meson.build
@ -146,6 +146,7 @@ want_capabilities = get_option('capabilities')
|
|||||||
want_apparmor = get_option('apparmor')
|
want_apparmor = get_option('apparmor')
|
||||||
want_openssl = get_option('openssl')
|
want_openssl = get_option('openssl')
|
||||||
want_selinux = get_option('selinux')
|
want_selinux = get_option('selinux')
|
||||||
|
want_seccomp = get_option('seccomp')
|
||||||
|
|
||||||
srcconf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
|
srcconf.set_quoted('DEFAULT_CGROUP_PATTERN', cgrouppattern)
|
||||||
if coverity
|
if coverity
|
||||||
@ -291,41 +292,45 @@ endif
|
|||||||
threads = dependency('threads')
|
threads = dependency('threads')
|
||||||
|
|
||||||
## Seccomp.
|
## Seccomp.
|
||||||
libseccomp = dependency('libseccomp', required: false)
|
if want_seccomp
|
||||||
srcconf.set10('HAVE_SECCOMP', libseccomp.found())
|
libseccomp = dependency('libseccomp', required: false)
|
||||||
pkgconfig_libs += libseccomp
|
srcconf.set10('HAVE_SECCOMP', libseccomp.found())
|
||||||
if libseccomp.found()
|
pkgconfig_libs += libseccomp
|
||||||
if libseccomp.version().version_compare('>=2.5.0')
|
if libseccomp.found()
|
||||||
# https://github.com/seccomp/libseccomp/commit/dead12bc788b259b148cc4d93b970ef0bd602b1a
|
if libseccomp.version().version_compare('>=2.5.0')
|
||||||
srcconf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', true)
|
# https://github.com/seccomp/libseccomp/commit/dead12bc788b259b148cc4d93b970ef0bd602b1a
|
||||||
else
|
srcconf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', true)
|
||||||
srcconf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', false)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if libseccomp.version().version_compare('>=2.0.0')
|
|
||||||
# https://github.com/seccomp/libseccomp/commit/6220c8c0fc479d97b6d3e3166a4e46fbfe25a3c0
|
|
||||||
srcconf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', true)
|
|
||||||
else
|
|
||||||
srcconf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', false)
|
|
||||||
endif
|
|
||||||
|
|
||||||
seccomp_headers = '''
|
|
||||||
#include <seccomp.h>
|
|
||||||
'''
|
|
||||||
|
|
||||||
foreach decl: [
|
|
||||||
'scmp_filter_ctx',
|
|
||||||
'struct seccomp_notif_sizes',
|
|
||||||
'struct clone_args',
|
|
||||||
]
|
|
||||||
|
|
||||||
# We get -1 if the size cannot be determined
|
|
||||||
if cc.sizeof(decl, prefix: seccomp_headers, args: '-D_GNU_SOURCE') > 0
|
|
||||||
srcconf.set10('HAVE_' + decl.underscorify().to_upper(), true)
|
|
||||||
else
|
else
|
||||||
srcconf.set10('HAVE_' + decl.underscorify().to_upper(), false)
|
srcconf.set10('HAVE_DECL_SECCOMP_NOTIFY_FD', false)
|
||||||
endif
|
endif
|
||||||
endforeach
|
|
||||||
|
if libseccomp.version().version_compare('>=2.0.0')
|
||||||
|
# https://github.com/seccomp/libseccomp/commit/6220c8c0fc479d97b6d3e3166a4e46fbfe25a3c0
|
||||||
|
srcconf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', true)
|
||||||
|
else
|
||||||
|
srcconf.set10('HAVE_DECL_SECCOMP_SYSCALL_RESOLVE_NAME_ARCH', false)
|
||||||
|
endif
|
||||||
|
|
||||||
|
seccomp_headers = '''
|
||||||
|
#include <seccomp.h>
|
||||||
|
'''
|
||||||
|
|
||||||
|
foreach decl: [
|
||||||
|
'scmp_filter_ctx',
|
||||||
|
'struct seccomp_notif_sizes',
|
||||||
|
'struct clone_args',
|
||||||
|
]
|
||||||
|
|
||||||
|
# We get -1 if the size cannot be determined
|
||||||
|
if cc.sizeof(decl, prefix: seccomp_headers, args: '-D_GNU_SOURCE') > 0
|
||||||
|
srcconf.set10('HAVE_' + decl.underscorify().to_upper(), true)
|
||||||
|
else
|
||||||
|
srcconf.set10('HAVE_' + decl.underscorify().to_upper(), false)
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
srcconf.set10('HAVE_SECCOMP', false)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
## SELinux.
|
## SELinux.
|
||||||
@ -667,9 +672,12 @@ subdir('src/lxc/pam')
|
|||||||
# Library.
|
# Library.
|
||||||
liblxc_dependencies = [
|
liblxc_dependencies = [
|
||||||
threads,
|
threads,
|
||||||
libseccomp,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if want_seccomp
|
||||||
|
liblxc_dependencies += libseccomp
|
||||||
|
endif
|
||||||
|
|
||||||
if want_capabilities
|
if want_capabilities
|
||||||
liblxc_dependencies += [libcap]
|
liblxc_dependencies += [libcap]
|
||||||
endif
|
endif
|
||||||
|
@ -32,6 +32,9 @@ option('commands', type: 'boolean', value: 'true',
|
|||||||
option('capabilities', type: 'boolean', value: 'true',
|
option('capabilities', type: 'boolean', value: 'true',
|
||||||
description: 'use capabilities')
|
description: 'use capabilities')
|
||||||
|
|
||||||
|
option('seccomp', type: 'boolean', value: 'true',
|
||||||
|
description: 'use seccomp')
|
||||||
|
|
||||||
option('apparmor', type: 'boolean', value: 'true',
|
option('apparmor', type: 'boolean', value: 'true',
|
||||||
description: 'use apparmor')
|
description: 'use apparmor')
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ liblxc_sources = files(
|
|||||||
'uuid.c',
|
'uuid.c',
|
||||||
'uuid.h')
|
'uuid.h')
|
||||||
|
|
||||||
if libseccomp.found()
|
if want_seccomp and libseccomp.found()
|
||||||
liblxc_sources += files('seccomp.c')
|
liblxc_sources += files('seccomp.c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user