aboutgitcodelistschat:MatrixIRC
path: root/operations.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-05-19 14:57:50 +0200
committerAlice Frosi <afrosi@redhat.com>2023-05-19 14:57:50 +0200
commitf07f9a28e6466b72918777fb0aff047d683b3130 (patch)
tree70e76b31b4d6c3a3df724aa04ed564fdd7c9b92e /operations.c
parentfbc205bab17a25ae3dabef5a2ad97edcfcef9eef (diff)
downloadseitan-f07f9a28e6466b72918777fb0aff047d683b3130.tar
seitan-f07f9a28e6466b72918777fb0aff047d683b3130.tar.gz
seitan-f07f9a28e6466b72918777fb0aff047d683b3130.tar.bz2
seitan-f07f9a28e6466b72918777fb0aff047d683b3130.tar.lz
seitan-f07f9a28e6466b72918777fb0aff047d683b3130.tar.xz
seitan-f07f9a28e6466b72918777fb0aff047d683b3130.tar.zst
seitan-f07f9a28e6466b72918777fb0aff047d683b3130.zip
ops: fix op_cmp and test
Diffstat (limited to 'operations.c')
-rw-r--r--operations.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/operations.c b/operations.c
index 8d8b926..c751919 100644
--- a/operations.c
+++ b/operations.c
@@ -345,6 +345,7 @@ int op_cmp(const struct seccomp_notif *req, int notifier, struct gluten *g,
const void *py = gluten_ptr(&req->data, g, op->y);
enum op_cmp_type cmp = op->cmp;
int res;
+ int jmp;
(void)notifier;
@@ -357,10 +358,15 @@ int op_cmp(const struct seccomp_notif *req, int notifier, struct gluten *g,
if ((res == 0 && (cmp == CMP_EQ || cmp == CMP_LE || cmp == CMP_GE)) ||
(res < 0 && (cmp == CMP_LT || cmp == CMP_LE)) ||
(res > 0 && (cmp == CMP_GT || cmp == CMP_GE)) ||
- (res != 0 && (cmp == CMP_NE)))
+ (res != 0 && (cmp == CMP_NE))) {
+ debug(" execute op_cmp: successful comparison");
return 0;
+ }
- return op->jmp.offset;
+ if (gluten_read(NULL, g, &jmp, op->jmp, sizeof(jmp)) == -1)
+ return -1;
+ debug(" execute op_cmp: jump to %d", jmp);
+ return jmp;
}
int op_resolve_fd(const struct seccomp_notif *req, int notifier,