On Fri, Jul 27, 2018 at 12:21 AM, Y Song <ys114...@gmail.com> wrote:
> The SMIN/UMIN still should be 0 since there is no negative here due to
> smaller width?

Yes that makes sense.

> We can do better than unbounded for dst register of mov32, which is
> the code already
> doing?

coerce_reg_to_size() will preserve the bounds if they fit in a u32,
which is better than setting the bounds to [0, 2^32-1].
mark_reg_unknown() is called before for mov32 though, resetting the bounds.
Consequently using mov32 always results in the bounds being [0, 2^32-1].

> Could you explain (and add to the commit messages eventually) what
> are these unexpected errors?

A good example is:

        BPF_MOV32_IMM(BPF_REG_2, 0),
        BPF_MOV32_REG(BPF_REG_2, BPF_REG_2),
        BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_2),
        BPF_MOV64_IMM(BPF_REG_0, 0),
        BPF_EXIT_INSN(),

The 3rd instruction results in:

       math between ctx pointer and register with unbounded min value
is not allowed

Reply via email to