diff options
| author | Your Name <you@example.com> | 2021-08-27 18:38:22 +0100 |
|---|---|---|
| committer | Your Name <you@example.com> | 2021-08-27 18:38:58 +0100 |
| commit | 5559dd9c244848a1dbb19981f0295774f4e176d9 (patch) | |
| tree | 95b66fa3fe4afde786a7ec7567388a53eccccaaa /frida_mode/src/seccomp/seccomp_atomic.c | |
| parent | 7a2f81e0d992cf0f20d8d2fed26310c03c8b4fa9 (diff) | |
| download | afl++-5559dd9c244848a1dbb19981f0295774f4e176d9.tar.gz | |
Added seccomp support
Diffstat (limited to 'frida_mode/src/seccomp/seccomp_atomic.c')
| -rw-r--r-- | frida_mode/src/seccomp/seccomp_atomic.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/frida_mode/src/seccomp/seccomp_atomic.c b/frida_mode/src/seccomp/seccomp_atomic.c new file mode 100644 index 00000000..1720a726 --- /dev/null +++ b/frida_mode/src/seccomp/seccomp_atomic.c @@ -0,0 +1,28 @@ +#include <stdbool.h> +#include <stdio.h> + +#include "debug.h" + +void seccomp_atomic_set(volatile bool *ptr, bool val) { + + if (!__sync_bool_compare_and_swap(ptr, !val, val)) { + + FATAL("Failed to set event"); + + } + +} + +bool seccomp_atomic_try_set(volatile bool *ptr, bool val) { + + return __sync_bool_compare_and_swap(ptr, !val, val); + +} + +void seccomp_atomic_wait(volatile bool *ptr, bool val) { + + while (!__sync_bool_compare_and_swap(ptr, val, !val)) + ; + +} + |
