lkml.org 
[lkml]   [2023]   [Jan]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH bpf-next 4/8] bpf: Enable cpumasks to be queried and used as kptrs
On Thu, Jan 19, 2023 at 05:58:29PM -0600, David Vernet wrote:
> silently check for and ignore these cases at runtime. When we have e.g.
> per-argument kfunc flags, it might be helpful to add another KF_CPU-type
> flag that specifies that the verifier should validate that it's a valid
> CPU.

...

> +void bpf_cpumask_set_cpu(u32 cpu, struct bpf_cpumask *cpumask)
> +{
> + if (!cpu_valid(cpu))
> + return;
> +
> + cpumask_set_cpu(cpu, (struct cpumask *)cpumask);
> +}

...

> +void bpf_cpumask_clear_cpu(u32 cpu, struct bpf_cpumask *cpumask)
> +{
> + if (!cpu_valid(cpu))
> + return;

I don't think we'll be able to get rid of this with KF_CPU or special suffix.
The argument might be a variable and not a constant at the verification time.
We would have to allow passing unknown vars otherwise the UX will be too restrictive,
so this run-time check would have to stay.

\
 
 \ /
  Last update: 2023-03-26 23:48    [W:0.148 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site