Skip to content

Commit

Permalink
fix(modern_bpf): fix args/env retrival in case of large args/env
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo authored and poiana committed Feb 1, 2024
1 parent 0e61a93 commit 41385b0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion driver/modern_bpf/helpers/store/auxmap_store_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,14 @@ static __always_inline void auxmap__store_execve_args(struct auxiliary_map *auxm
total_len += arg_len;
}
/* the sum of all env variables lengths should be `<= MAX_PROC_ARG_ENV` */
total_len = total_len & (MAX_PROC_ARG_ENV - 1);
if(total_len > MAX_PROC_ARG_ENV)
{
total_len = MAX_PROC_ARG_ENV;
}
else
{
total_len = total_len & (MAX_PROC_ARG_ENV - 1);
}
auxmap->payload_pos = initial_payload_pos + total_len;
push__param_len(auxmap->data, &auxmap->lengths_pos, total_len);
}
Expand Down

0 comments on commit 41385b0

Please sign in to comment.