From b2e31a6e7493c56f923cb7d86f7a8a32940393ec Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Wed, 7 Jun 2023 14:07:23 +0200 Subject: seitan,cooker: op_resolvefd ops: - update resolvefd with the description - add debug prints cooker: - add emit_resolvefd when match has type FDPATH --- cooker/match.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'cooker/match.c') diff --git a/cooker/match.c b/cooker/match.c index e9aed16..3c7650c 100644 --- a/cooker/match.c +++ b/cooker/match.c @@ -78,13 +78,14 @@ static union value parse_field(struct gluten_ctx *g, enum op_cmp_type cmp, enum jump_type jump, int index, struct field *f, JSON_Value *jvalue) { - struct gluten_offset const_offset, mask_offset, data_offset; + struct gluten_offset const_offset, mask_offset, data_offset, seccomp_offset; union value v = { .v_num = 0 }; struct field *f_inner; const char *tag_name; JSON_Object *tmp; JSON_Array *set; JSON_Value *sel; + size_t size; if (f->name) debug(" parsing field name %s", f->name); @@ -202,6 +203,16 @@ xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx emit_cmp(g, CMP_NE, offset, const_offset, strlen(v.v_str) + 1, JUMP_NEXT_BLOCK); break; + case FDPATH: + v.v_str = json_value_get_string(jvalue); + size = strlen(v.v_str) + 1; + offset = gluten_rw_alloc(g, size); + const_offset = emit_data(g, STRING, size, &v); + seccomp_offset = emit_seccomp_data(index); + emit_resolvefd(g, seccomp_offset, offset, size); + emit_cmp(g, CMP_NE, offset, const_offset, size, + JUMP_NEXT_BLOCK); + break; case STRUCT: for (f_inner = f->desc.d_struct; f_inner->name; f_inner++) { JSON_Value *field_value; -- cgit v1.2.3