Re: [PATCH bpf-next 3/4] bpf: verifier: remove redundant opcode checks

From: Alexei Starovoitov
Date: Fri May 20 2022 - 18:47:00 EST


On Fri, May 20, 2022 at 4:38 AM Shung-Hsi Yu <shung-hsi.yu@xxxxxxxx> wrote:
>
> The introduction of opcode validation with bpf_opcode_in_insntable() in
> commit 5e581dad4fec ("bpf: make unknown opcode handling more robust")
> has made opcode checks done in do_check_common() and its callees
> redundant, so either remove them entirely, or turn them into comments in
> places where the redundancy may not be clear.

I prefer to keep the existing checks.
They help readability on what is actually expected at this point.
These checks cost close to nothing in run-time.