Re: [PATCH bpf 09/12] selftests/bpf: test widening for iterating callbacks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2023-11-17 at 11:47 -0500, Andrii Nakryiko wrote:
> On Wed, Nov 15, 2023 at 9:18 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
> > 
> > A test case to verify that imprecise scalars widening is applied to
> > callback bodies on repetative iteration.
> 
> typo: repetitive? repeating? successive? subsequent?

I'll configure spell-checking, I promise.

[...]
> > +static int widening_cb(__u32 idx, struct num_context *ctx)
> > +{
> > +       ++ctx->i;
> > +       return 0;
> > +}
> > +
> > +SEC("?raw_tp")
> > +__success
> > +int widening(void *unused)
> > +{
> > +       struct num_context loop_ctx = { .i = 0, .j = 1 };
> > +
> > +       bpf_loop(100, widening_cb, &loop_ctx, 0);
> > +       /* loop_ctx.j is not changed during callback iteration,
> > +        * verifier should not apply widening to it.
> > +        */
> > +       return choice_arr[loop_ctx.j];
> 
> would the test be a bit more interesting if you use loop_ctx.i here?
> `return choice_arr[loop_ctx.i & 1];` ? 

It would force precision for 'loop_ctx.i', precise values are not widened.

> 
> > +}
> > +







[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux