aboutsummaryrefslogtreecommitdiff
path: root/frida_mode/src/seccomp/seccomp_atomic.c
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-08-27 18:38:22 +0100
committerYour Name <you@example.com>2021-08-27 18:38:58 +0100
commit5559dd9c244848a1dbb19981f0295774f4e176d9 (patch)
tree95b66fa3fe4afde786a7ec7567388a53eccccaaa /frida_mode/src/seccomp/seccomp_atomic.c
parent7a2f81e0d992cf0f20d8d2fed26310c03c8b4fa9 (diff)
downloadafl++-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.c28
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))
+ ;
+
+}
+