Introduce common generic header file
[librseq.git] / tests / disable-rseq-syscall.c
1 // SPDX-License-Identifier: MIT
2 // SPDX-FileCopyrightText: 2024 Michael Jeanson <mjeanson@efficios.com>
3
4 #include <errno.h>
5 #include <seccomp.h>
6
7 /*
8 * Library constructor.
9 *
10 * Apply a seccomp policy that blocks access to the rseq syscall and returns
11 * ENOSYS.
12 */
13 static __attribute__((constructor))
14 void disable_rseq_syscall(void)
15 {
16 scmp_filter_ctx ctx;
17
18 ctx = seccomp_init(SCMP_ACT_ALLOW);
19 seccomp_rule_add(ctx, SCMP_ACT_ERRNO(ENOSYS), SCMP_SYS(rseq), 0);
20 seccomp_load(ctx);
21 }
This page took 0.124977 seconds and 4 git commands to generate.