aboutgitcodelistschat:MatrixIRC
path: root/cooker/filter.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-05-19 16:53:53 +0200
committerAlice Frosi <afrosi@redhat.com>2023-05-19 17:59:10 +0200
commitea0bdcf104654ec45d4a32055a4fb2573613ea16 (patch)
tree9f8266b06808957fd10aad610bdd43a649f26c4f /cooker/filter.c
parent1f487f5a95f3fc9e9e9f4681436bfc8011d738aa (diff)
downloadseitan-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/filter.c')
-rw-r--r--cooker/filter.c21
1 files changed, 13 insertions, 8 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)