Re: [PATCH bpf-next 07/10] bpf: add support for BTF pointers to x86 JIT

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

 




On 10/4/19 10:03 PM, Alexei Starovoitov wrote:
> Pointer to BTF object is a pointer to kernel object or NULL.
> Such pointers can only be used by BPF_LDX instructions.
> The verifier changed their opcode from LDX|MEM|size
> to LDX|PROBE_MEM|size to make JITing easier.
> The number of entries in extable is the number of BPF_LDX insns
> that access kernel memory via "pointer to BTF type".

...

>  		}
>  		if (proglen == oldproglen) {
> -			header = bpf_jit_binary_alloc(proglen, &image,
> -						      1, jit_fill_hole);
> +			/*
> +			 * The number of entries in extable is the number of BPF_LDX
> +			 * insns that access kernel memory via "pointer to BTF type".
> +			 * The verifier changed their opcode from LDX|MEM|size
> +			 * to LDX|PROBE_MEM|size to make JITing easier.
> +			 */
> +			u32 extable_size = prog->aux->num_exentries *
> +				sizeof(struct exception_table_entry);
> +
> +			/* allocate module memory for x86 insns and extable */
> +			header = bpf_jit_binary_alloc(proglen + extable_size,
> +						      &image, 1, jit_fill_hole);
>  			if (!header) {
>  				prog = orig_prog;
>  				goto out_addrs;
>  			}
> +			prog->aux->extable = (void *) image + proglen;

You might want to align ->extable to __alignof__(struct exception_table_entry) (4 bytes currently)




[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