diff --git a/meson.build b/meson.build index a5dc7d0ba03..01b688a2f5d 100644 --- a/meson.build +++ b/meson.build @@ -851,6 +851,16 @@ if with_platform_android ] endif +# On Android, seccomp kills the process on kernels without +# CONFIG_KCMP/CONFIG_CHECKPOINT_RESTORE if it attemps to use KCMP. +# Since we can't detect that, err on the side of caution and disable +# KCMP by default on Android. +if get_option('allow-kcmp') \ + .disable_auto_if(with_platform_android) \ + .allowed() + pre_args += '-DALLOW_KCMP' +endif + prog_python = import('python').find_installation('python3') has_mako = run_command( prog_python, '-c', diff --git a/meson_options.txt b/meson_options.txt index 27f6af7de53..69cea01f32c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -427,6 +427,11 @@ option( value : 25, description : 'Android Platform SDK version. Default: Nougat version.' ) +option( + 'allow-kcmp', + type : 'feature', + description : 'Allow using KCMP_FILE to compare file descriptions. auto = allowed everywhere except on Android' +) option( 'zstd', type : 'feature', diff --git a/src/util/os_file.c b/src/util/os_file.c index 18149b2a4fd..5fb30f2d908 100644 --- a/src/util/os_file.c +++ b/src/util/os_file.c @@ -194,7 +194,7 @@ os_read_file(const char *filename, size_t *size) return buf; } -#if DETECT_OS_LINUX +#if DETECT_OS_LINUX && ALLOW_KCMP #include #include