aboutgitcodelistschat:MatrixIRC
path: root/cooker/filter.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-05-17 13:20:13 +0200
committerAlice Frosi <afrosi@redhat.com>2023-05-17 13:20:13 +0200
commit1e78526693d22abe24c98291a782998573f6b01d (patch)
tree9ee8bf1a813e73d63962357fdd2318bd390d3bc0 /cooker/filter.c
parent504d9e38a528ca8bf6f658223a1935e9bc537d8a (diff)
downloadseitan-1e78526693d22abe24c98291a782998573f6b01d.tar
seitan-1e78526693d22abe24c98291a782998573f6b01d.tar.gz
seitan-1e78526693d22abe24c98291a782998573f6b01d.tar.bz2
seitan-1e78526693d22abe24c98291a782998573f6b01d.tar.lz
seitan-1e78526693d22abe24c98291a782998573f6b01d.tar.xz
seitan-1e78526693d22abe24c98291a782998573f6b01d.tar.zst
seitan-1e78526693d22abe24c98291a782998573f6b01d.zip
Minor fixes for the filter and the eater
Add: - ignore_args field for the filter. - use MAX_FILTER to define the filter size in the eater
Diffstat (limited to 'cooker/filter.c')
-rw-r--r--cooker/filter.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/cooker/filter.c b/cooker/filter.c
index dcd04bf..9ca696b 100644
--- a/cooker/filter.c
+++ b/cooker/filter.c
@@ -25,6 +25,7 @@ static unsigned int index_entries = 0;
* @entries: Index for the arguments for every entry
*/
struct filter_call_input {
+ bool ignore_args;
bool notify;
unsigned int count;
int entries[MAX_ENTRIES_SYSCALL];
@@ -59,6 +60,8 @@ static bool has_args(long nr)
if (call-> count < 1)
return false;
+ if(call-> ignore_args)
+ return false;
/* Check if the first entry has some arguments */
return need_check_arg(&entries[call->entries[0]]);
@@ -160,6 +163,8 @@ void filter_add_arg(int index, struct bpf_arg arg, bool append)
set_no_args(&entries[call->entries[0]]);
return;
}
+ if(call->ignore_args)
+ return;
if (!append)
call->entries[call->count++] = index_entries;
memcpy(&entries[index_entries++].args[index], &arg, sizeof(arg));
@@ -169,8 +174,8 @@ void filter_needs_deref(void)
{
struct filter_call_input *call = filter_input + current_nr;
- call->count = MAX_ENTRIES_SYSCALL;
- set_no_args(&entries[call->entries[0]]);
+ call->ignore_args = true;
+ call->count = 0;
}
static int table[N_SYSCALL];
@@ -564,7 +569,6 @@ void filter_write(const char *path)
n = create_table_syscall();
n = filter_build(filter, n);
-
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC,
S_IRUSR | S_IWUSR);
write(fd, filter, sizeof(struct sock_filter) * n);