worker-privs: allow munmap/mremap/madvise for isolated workers

Fix worker crashes on musl-based systems when isolate-workers = true by allowing munmap, mremap, and madvise in the worker seccomp filter.

Move seccomp coverage to Alpine CI and use oc_syslog for seccomp trap diagnostics instead of direct write()-based output.

Keep glibc backtrace diagnostics as the default and allow musl builds to select the syscall-only fallback with the assume-glibc Meson option.

Resolves: #749
Signed-off-by: Alex Protsko <fidget2015@yahoo.com>
This commit is contained in:
Alex Protsko
2026-07-20 16:43:23 +03:00
parent cfb0e0a2b2
commit b931112cb2
4 changed files with 44 additions and 3 deletions
+27 -1
View File
@@ -221,7 +221,7 @@ musl/Alpine:
stage: testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$ALPINE_BUILD
script:
- meson setup build -Dwith-werror=true
- meson setup build -Dwith-werror=true -Dassume-glibc=false
- ninja -C build -j$JOBS
tags:
- saas-linux-small-amd64
@@ -339,6 +339,32 @@ seccomp/Fedora:
untracked: true
when: on_failure
# Tests seccomp filters under musl/Alpine to catch allocator/syscall gaps
seccomp/Alpine:
stage: testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$ALPINE_BUILD
script:
- apk add --no-cache bash
- chmod -R o-w tests/data/raddb
- git submodule update --init
- meson setup build -Dseccomp-trap=true -Dassume-glibc=false
- ninja -C build -j$JOBS
- >-
meson test -C build --no-rebuild --num-processes 1 --print-errorlogs
session-timeout traffic bandwidth
oc-aes256-gcm-cipher oc-aes128-gcm-cipher
ac-aes128-gcm-cipher ac-aes256-gcm-cipher
no-dtls-cipher
tags:
- saas-linux-medium-amd64
except:
- tags
- schedules
artifacts:
expire_in: 1 week
untracked: true
when: on_failure
# Tests per-worker RLIMIT_DATA by making setrlimit failures fatal
worker-memory-limit/Fedora:
stage: testing
+1
View File
@@ -362,6 +362,7 @@ cdata.set('PROC_FS_SUPPORTED', proc_fs)
cdata.set('SUPPORT_OIDC_AUTH', oidc_enabled)
cdata.set('TRY_SHA2_CRYPT', try_sha2_crypt)
cdata.set('USE_SECCOMP_TRAP', get_option('seccomp-trap'))
cdata.set('ASSUME_GLIBC', get_option('assume-glibc'))
cdata.set('WORKER_MEMORY_LIMIT_TEST', get_option('worker-memory-limit-test'))
# These three are used in #elif (not #ifdef), so they must be 1 or undef (not empty)
+1
View File
@@ -21,6 +21,7 @@ option('local-llhttp', type: 'boolean', value: true, description: 'Us
option('local-protobuf', type: 'boolean', value: false, description: 'Force use of bundled protobuf-c')
option('local-pcl', type: 'boolean', value: true, description: 'Use bundled PCL (default); false to require system pcl')
option('seccomp-trap', type: 'boolean', value: false, description: 'Filtered syscalls fail with a signal (for CI/testing)')
option('assume-glibc', type: 'boolean', value: true, description: 'Use glibc backtrace support for seccomp trap diagnostics')
option('worker-memory-limit-test', type: 'boolean', value: false, description: 'RLIMIT_DATA failures in worker are fatal (for CI/testing)')
option('root-tests', type: 'boolean', value: true, description: 'Enable tests requiring root/namespaces')
option('serial-heavy-tests', type: 'boolean', value: false, description: 'Run iperf3-heavy tests serially to avoid ASAN memory exhaustion under parallel load')
+15 -2
View File
@@ -40,14 +40,24 @@
#ifdef USE_SECCOMP_TRAP
#define _SECCOMP_ERR SCMP_ACT_TRAP
#ifdef ASSUME_GLIBC
#include <execinfo.h>
#include <signal.h>
#endif /* ASSUME_GLIBC */
void sigsys_action(int sig, siginfo_t *info, void *ucontext)
{
(void)sig;
(void)ucontext;
#ifdef ASSUME_GLIBC
char *call_addr = *backtrace_symbols(&info->si_call_addr, 1);
oc_syslog(LOG_ERR, "Function %s called disabled syscall %d", call_addr,
info->si_syscall);
#else
oc_syslog(LOG_ERR, "seccomp trap: syscall %d at %p", info->si_syscall,
info->si_call_addr);
#endif /* ASSUME_GLIBC */
exit(EXIT_FAILURE);
}
@@ -135,9 +145,12 @@ int disable_system_calls(struct worker_st *ws)
ADD_SYSCALL(setitimer, 0);
ADD_SYSCALL(getpid, 0);
/* memory allocation - both are used by different platforms */
/* memory allocations used by different platforms */
ADD_SYSCALL(brk, 0);
ADD_SYSCALL(mmap, 0);
ADD_SYSCALL(munmap, 0);
ADD_SYSCALL(mremap, 0);
ADD_SYSCALL(madvise, 0);
#if defined(SYS_getrandom) || defined(__NR_getrandom)
ADD_SYSCALL(getrandom, 0); /* used by gnutls 3.5.x */