diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-05-19 16:53:53 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-05-19 17:59:10 +0200 |
commit | ea0bdcf104654ec45d4a32055a4fb2573613ea16 (patch) | |
tree | 9f8266b06808957fd10aad610bdd43a649f26c4f /cooker | |
parent | 1f487f5a95f3fc9e9e9f4681436bfc8011d738aa (diff) | |
download | seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.gz seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.bz2 seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.lz seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.xz seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.zst seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.zip |
filter: adjust filter build
Add filter_flush_args() to flush the arguments when finish to add the
syscall arguments.
Fixed test compilation after refactoring.
Diffstat (limited to 'cooker')
-rw-r--r-- | cooker/filter.c | 21 | ||||
-rw-r--r-- | cooker/filter.h | 3 |
2 files changed, 15 insertions, 9 deletions
diff --git a/cooker/filter.c b/cooker/filter.c index 9ca696b..ef76835 100644 --- a/cooker/filter.c +++ b/cooker/filter.c @@ -148,26 +148,31 @@ void filter_notify(long nr) { * filter_add_arg(): Add a new argument to the current syscall * @index: position of the argument * @arg: the argument to add - * @append: if it is the first element add to the syscall entry */ -void filter_add_arg(int index, struct bpf_arg arg, bool append) +void filter_add_arg(int index, struct bpf_arg arg) { struct filter_call_input *call = filter_input + current_nr; + struct bpf_entry *entry = &entries[index_entries]; - fprintf(stderr, "count=%d cmp=%d value=%X\n", call->count, arg.cmp, - arg.value.v32); /* If it reaches the maximum number of entries per syscall, then we simply * notify for all the arguments and ignore the other arguments. */ if (call->count >= MAX_ENTRIES_SYSCALL) { - set_no_args(&entries[call->entries[0]]); + call->ignore_args = true; return; } if(call->ignore_args) return; - if (!append) - call->entries[call->count++] = index_entries; - memcpy(&entries[index_entries++].args[index], &arg, sizeof(arg)); + + call->entries[call->count] = index_entries; + memcpy(&entry->args[index], &arg, sizeof(arg)); +} + +void filter_flush_args() +{ + struct filter_call_input *call = filter_input + current_nr; + call->count++; + index_entries++; } void filter_needs_deref(void) diff --git a/cooker/filter.h b/cooker/filter.h index a797e07..7f6ddfd 100644 --- a/cooker/filter.h +++ b/cooker/filter.h @@ -71,7 +71,8 @@ struct bpf_entry { void filter_notify(long nr); void filter_needs_deref(void); -void filter_add_arg(int index, struct bpf_arg arg, bool append); +void filter_add_arg(int index, struct bpf_arg arg); void filter_write(const char *path); +void filter_flush_args(); #endif |