Re: [PATCH 5/5] sysctl: pass kernel pointers to ->proc_handler
From: Andrey Ignatov
Date: Fri Apr 24 2020 - 15:07:21 EST
Christoph Hellwig <hch@xxxxxx> [Thu, 2020-04-23 23:44 -0700]:
> Instead of having all the sysctl handlers deal with user pointers, which
> is rather hairy in terms of the BPF interaction, copy the input to and
> from userspace in common code. This also means that the strings are
> always NUL-terminated by the common code, making the API a little bit
> safer.
>
> As most handler just pass through the data to one of the common handlers
> a lot of the changes are mechnical.
>
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Acked-by: Andrey Ignatov <rdna@xxxxxx>
...
> @@ -72,33 +70,21 @@ extern unsigned int sysctl_sched_autogroup_enabled;
> extern int sysctl_sched_rr_timeslice;
> extern int sched_rr_timeslice;
>
> -extern int sched_rr_handler(struct ctl_table *table, int write,
> - void __user *buffer, size_t *lenp,
> - loff_t *ppos);
> -
> -extern int sched_rt_handler(struct ctl_table *table, int write,
> - void __user *buffer, size_t *lenp,
> - loff_t *ppos);
> -
> -#ifdef CONFIG_UCLAMP_TASK
Decided to skim through the patch one last time to double-check the fix
from previous iteration and found that this ifdef got lost below.
> -extern int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
> - void __user *buffer, size_t *lenp,
> - loff_t *ppos);
> -#endif
> -
> -extern int sysctl_numa_balancing(struct ctl_table *table, int write,
> - void __user *buffer, size_t *lenp,
> - loff_t *ppos);
> -
> -extern int sysctl_schedstats(struct ctl_table *table, int write,
> - void __user *buffer, size_t *lenp,
> - loff_t *ppos);
> +int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
> + size_t *lenp, loff_t *ppos);
> +int sched_rt_handler(struct ctl_table *table, int write, void *buffer,
> + size_t *lenp, loff_t *ppos);
> +int sysctl_sched_uclamp_handler(struct ctl_table *table, int write,
> + void *buffer, size_t *lenp, loff_t *ppos);
Here ^^
--
Andrey Ignatov