Skip to content

Commit

Permalink
fix(kmod): standardize some enter fillers
Browse files Browse the repository at this point in the history
Signed-off-by: Roberto Scolaro <[email protected]>
  • Loading branch information
therealbobo committed Jul 16, 2024
1 parent 9bdc01e commit fc618da
Showing 1 changed file with 4 additions and 28 deletions.
32 changes: 4 additions & 28 deletions driver/ppm_fillers.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,13 @@ int f_sys_open_e(struct event_filler_arguments *args)
unsigned long val;
unsigned long flags;
unsigned long modes;
char *name = NULL;
int res;

/*
* name
*/
syscall_get_arguments_deprecated(args, 0, 1, &val);
if(likely(ppm_strncpy_from_user(args->str_storage, (const void __user *)val, PPM_MAX_PATH_SIZE) >= 0))
{
name = args->str_storage;
name[PPM_MAX_PATH_SIZE - 1] = '\0';
}
res = val_to_ring(args, (int64_t)(long)name, 0, false, 0);
res = val_to_ring(args, val, 0, true, 0);
CHECK_RES(res);

/*
Expand Down Expand Up @@ -2947,19 +2941,13 @@ int f_sys_creat_e(struct event_filler_arguments *args)
{
unsigned long val;
unsigned long modes;
char *name = NULL;
int res;

/*
* name
*/
syscall_get_arguments_deprecated(args, 0, 1, &val);
if(likely(ppm_strncpy_from_user(args->str_storage, (const void __user *)val, PPM_MAX_PATH_SIZE) >= 0))
{
name = args->str_storage;
name[PPM_MAX_PATH_SIZE - 1] = '\0';
}
res = val_to_ring(args, (int64_t)(long)name, 0, false, 0);
res = val_to_ring(args, val, 0, true, 0);
CHECK_RES(res);

/*
Expand Down Expand Up @@ -3500,7 +3488,6 @@ int f_sys_openat_e(struct event_filler_arguments *args)
unsigned long flags;
unsigned long modes;
int32_t fd;
char *name = NULL;
int res;

/*
Expand All @@ -3518,12 +3505,7 @@ int f_sys_openat_e(struct event_filler_arguments *args)
* name
*/
syscall_get_arguments_deprecated(args, 1, 1, &val);
if(likely(ppm_strncpy_from_user(args->str_storage, (const void __user *)val, PPM_MAX_PATH_SIZE) >= 0))
{
name = args->str_storage;
name[PPM_MAX_PATH_SIZE - 1] = '\0';
}
res = val_to_ring(args, (int64_t)(long)name, 0, false, 0);
res = val_to_ring(args, val, 0, true, 0);
CHECK_RES(res);
/*
* Flags
Expand Down Expand Up @@ -4900,7 +4882,6 @@ int f_sys_openat2_e(struct event_filler_arguments *args)
unsigned long flags;
unsigned long val;
unsigned long mode;
char *name = NULL;
int32_t fd;
int res;
#ifdef __NR_openat2
Expand All @@ -4922,12 +4903,7 @@ int f_sys_openat2_e(struct event_filler_arguments *args)
* name
*/
syscall_get_arguments_deprecated(args, 1, 1, &val);
if(likely(ppm_strncpy_from_user(args->str_storage, (const void __user *)val, PPM_MAX_PATH_SIZE) >= 0))
{
name = args->str_storage;
name[PPM_MAX_PATH_SIZE - 1] = '\0';
}
res = val_to_ring(args, (int64_t)(long)name, 0, false, 0);
res = val_to_ring(args, val, 0, true, 0);
CHECK_RES(res);


Expand Down

0 comments on commit fc618da

Please sign in to comment.