Skip to content

Commit

Permalink
fix(driver-modern-bpf): fix USER vs MEMORY attribution in execve filler
Browse files Browse the repository at this point in the history
Collectively verified that this fixes issues in execve params 2, 3 and 16.

Co-authored-by: Andrea Terzolo <andrea.terzolo@polito.it>
Co-authored-by: Hendrik Brueckner <brueckner@de.ibm.com>
Signed-off-by: Melissa Kilby <melissa.kilby.oss@gmail.com>
  • Loading branch information
3 people authored and poiana committed Oct 13, 2022
1 parent 509b66a commit 6efefb9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ int BPF_PROG(execve_x,
/* We need to extract the len of `exe` arg so we can undestand
* the overall length of the remaining args.
*/
u16 exe_arg_len = auxmap__store_charbuf_param(auxmap, arg_start_pointer, KERNEL);
u16 exe_arg_len = auxmap__store_charbuf_param(auxmap, arg_start_pointer, USER);

/* Parameter 3: args (type: PT_CHARBUFARRAY) */
/* Here we read the whole array starting from the pointer to the first
* element. We could also read the array element per element but
* since we know the total len we read it as a `bytebuf`.
* The `\0` after every argument are preserved.
*/
auxmap__store_bytebuf_param(auxmap, arg_start_pointer + exe_arg_len, total_args_len - exe_arg_len, KERNEL);
auxmap__store_bytebuf_param(auxmap, arg_start_pointer + exe_arg_len, total_args_len - exe_arg_len, USER);
}
else
{
Expand Down Expand Up @@ -203,7 +203,7 @@ int BPF_PROG(t1_execve_x,
* since we know the total len we read it as a `bytebuf`.
* The `\0` after every argument are preserved.
*/
auxmap__store_bytebuf_param(auxmap, env_start_pointer, total_env_len, KERNEL);
auxmap__store_bytebuf_param(auxmap, env_start_pointer, total_env_len, USER);
}
else
{
Expand Down

0 comments on commit 6efefb9

Please sign in to comment.