Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Apr 4, 2024
1 parent 95da480 commit f8baf2e
Showing 1 changed file with 30 additions and 29 deletions.
59 changes: 30 additions & 29 deletions driver/bpf/fillers.h
Original file line number Diff line number Diff line change
Expand Up @@ -2381,44 +2381,45 @@ FILLER(proc_startupdate, true)
args_len = 0;
}

if (args_len > 0) {
int exe_len;
int exe_len;

exe_len = bpf_probe_read_kernel_str(&data->buf[data->state->tail_ctx.curoff & SCRATCH_SIZE_HALF],
SCRATCH_SIZE_HALF,
&data->buf[data->state->tail_ctx.curoff & SCRATCH_SIZE_HALF]);
exe_len = bpf_probe_read_kernel_str(&data->buf[data->state->tail_ctx.curoff & SCRATCH_SIZE_HALF],
SCRATCH_SIZE_HALF,
&data->buf[data->state->tail_ctx.curoff & SCRATCH_SIZE_HALF]);

if (exe_len < 0)
return PPM_FAILURE_INVALID_USER_MEMORY;
if (exe_len < 0)
{
return PPM_FAILURE_INVALID_USER_MEMORY;
}

/*
* exe
*/
/*
* exe
*/
if (exe_len == 0)
{
res = bpf_push_empty_param(data);
}
else
{
data->curarg_already_on_frame = true;
res = __bpf_val_to_ring(data, 0, exe_len, PT_CHARBUF, -1, false, KERNEL);
CHECK_RES(res);
}
CHECK_RES(res);

args_len -= exe_len;
if (args_len < 0)
return PPM_FAILURE_INVALID_USER_MEMORY;
args_len -= exe_len;

/*
* Args
*/
data->curarg_already_on_frame = true;
res = __bpf_val_to_ring(data, 0, args_len, PT_BYTEBUF, -1, false, KERNEL);
CHECK_RES(res);
} else {
/*
* exe
*/
/*
* Args
*/
if(args_len <= 0)
{
res = bpf_push_empty_param(data);
CHECK_RES(res);

/*
* Args
*/
res = bpf_push_empty_param(data);
}
else
{
data->curarg_already_on_frame = true;
res = __bpf_val_to_ring(data, 0, args_len, PT_BYTEBUF, -1, false, KERNEL);
CHECK_RES(res);
}

Expand Down

0 comments on commit f8baf2e

Please sign in to comment.