Re: [PATCH bpf-next 2/2] selftests/bpf: Add tests for ldsx of pkt data/data_end/data_meta accesses

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

 



On Mon, 2024-07-15 at 13:18 -0700, Yonghong Song wrote:

[...]

> +SEC("xdp")
> +__description("LDSX, xdp s32 xdp_md->data")
> +__failure __msg("invalid bpf_context access")
> +__naked void ldsx_ctx_1(void)
> +{
> +        asm volatile (
> +        "r2 = *(s32 *)(r1 + %[xdp_md_data]);"

Nit: this test fails at the first instruction,
     hence there is no need to include it's tail.
     I think it would be good to keep these tests minimal.

> +        "r3 = *(u32 *)(r1 + %[xdp_md_data_end]);"
> +        "r1 = r2;"
> +        "r1 += 8;"
> +        "if r1 > r3 goto l0_%=;"
> +        "r0 = *(u64 *)(r1 - 8);"
> +"l0_%=:"
> +	"r0 = 0;"
> +        "exit;"
> +	:
> +        : __imm_const(xdp_md_data, offsetof(struct xdp_md, data)),
> +	  __imm_const(xdp_md_data_end, offsetof(struct xdp_md, data_end))
> +        : __clobber_all);
> +}

[...]





[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