Re: [PATCH bpf-next v3 09/12] selftests/bpf: Add dynptr pruning tests

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

 



On Fri, Jan 20, 2023 at 09:13:11AM +0530, Kumar Kartikeya Dwivedi wrote:
> +
> +SEC("?tc")
> +__failure __msg("cannot overwrite referenced dynptr") __log_level(2)
> +int dynptr_pruning_overwrite(struct __sk_buff *ctx)
> +{
> +	asm volatile (
> +		"r9 = 0xeB9F;"
> +		"r6 = %[ringbuf] ll;"
> +		"r1 = r6;"
> +		"r2 = 8;"
> +		"r3 = 0;"
> +		"r4 = r10;"
> +		"r4 += -16;"
> +		"call %[bpf_ringbuf_reserve_dynptr];"
> +		"if r0 == 0 goto pjmp1;"
> +		"goto pjmp2;"
> +	"pjmp1:"
> +		"*(u64 *)(r10 - 16) = r9;"
> +	"pjmp2:"
> +		"r1 = r10;"
> +		"r1 += -16;"
> +		"r2 = 0;"
> +		"call %[bpf_ringbuf_discard_dynptr];"

It should still work if we remove "" from every line, right?
Would it be easier to read?



[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