Re: [PATCH bpf-next] selftests/bpf: Remove two infinite loop bound check cases

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

 



On Sun, Mar 26, 2023 at 7:45 PM Xu Kuohai <xukuohai@xxxxxxxxxxxxxxx> wrote:
>
> From: Xu Kuohai <xukuohai@xxxxxxxxxx>
>
> The two infinite loop bound check cases added by commit
> 1a3148fc171f ("selftests/bpf: Check when bounds are not in the 32-bit range")
> take a long time to execute but don't add much value.
>
> Remove them to reduce run time of test_verifier.

Summary: 2042 PASSED, 0 SKIPPED, 1 FAILED

real    0m4.780s
user    0m0.458s
sys     0m3.871s


5 seconds isn't such a long time, especially when we compare it to
test_progs (even with parallelization).

>
> Fixes: 1a3148fc171f ("selftests/bpf: Check when bounds are not in the 32-bit range")
> Signed-off-by: Xu Kuohai <xukuohai@xxxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/verifier/bounds.c | 50 -------------------
>  1 file changed, 50 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/verifier/bounds.c b/tools/testing/selftests/bpf/verifier/bounds.c
> index 74b1917d4208..515a8222f08f 100644
> --- a/tools/testing/selftests/bpf/verifier/bounds.c
> +++ b/tools/testing/selftests/bpf/verifier/bounds.c
> @@ -777,31 +777,6 @@
>         .result = ACCEPT,
>         .prog_type = BPF_PROG_TYPE_XDP,
>  },
> -{
> -       "bound check with JMP_JSLT for crossing 64-bit signed boundary",
> -       .insns = {
> -       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)),
> -       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data_end)),
> -       BPF_MOV64_REG(BPF_REG_1, BPF_REG_2),
> -       BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 1),
> -       BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 8),
> -
> -       BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_2, 0),
> -       BPF_LD_IMM64(BPF_REG_0, 0x7fffffffffffff10),
> -       BPF_ALU64_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
> -
> -       BPF_LD_IMM64(BPF_REG_0, 0x8000000000000000),
> -       BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 1),
> -       /* r1 signed range is [S64_MIN, S64_MAX] */
> -       BPF_JMP_REG(BPF_JSLT, BPF_REG_0, BPF_REG_1, -2),
> -
> -       BPF_MOV64_IMM(BPF_REG_0, 0),
> -       BPF_EXIT_INSN(),
> -       },
> -       .errstr = "BPF program is too large",
> -       .result = REJECT,
> -       .prog_type = BPF_PROG_TYPE_XDP,
> -},
>  {
>         "bound check for loop upper bound greater than U32_MAX",
>         .insns = {
> @@ -849,28 +824,3 @@
>         .result = ACCEPT,
>         .prog_type = BPF_PROG_TYPE_XDP,
>  },
> -{
> -       "bound check with JMP32_JSLT for crossing 32-bit signed boundary",
> -       .insns = {
> -       BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data)),
> -       BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data_end)),
> -       BPF_MOV64_REG(BPF_REG_1, BPF_REG_2),
> -       BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, 1),
> -       BPF_JMP_REG(BPF_JGT, BPF_REG_1, BPF_REG_3, 6),
> -
> -       BPF_LDX_MEM(BPF_B, BPF_REG_1, BPF_REG_2, 0),
> -       BPF_MOV32_IMM(BPF_REG_0, 0x7fffff10),
> -       BPF_ALU32_REG(BPF_ADD, BPF_REG_1, BPF_REG_0),
> -
> -       BPF_MOV32_IMM(BPF_REG_0, 0x80000000),
> -       BPF_ALU32_IMM(BPF_ADD, BPF_REG_0, 1),
> -       /* r1 signed range is [S32_MIN, S32_MAX] */
> -       BPF_JMP32_REG(BPF_JSLT, BPF_REG_0, BPF_REG_1, -2),
> -
> -       BPF_MOV64_IMM(BPF_REG_0, 0),
> -       BPF_EXIT_INSN(),
> -       },
> -       .errstr = "BPF program is too large",
> -       .result = REJECT,
> -       .prog_type = BPF_PROG_TYPE_XDP,
> -},
> --
> 2.30.2
>




[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