[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <74e72059-7961-a65d-5a8c-5c50c7a4a453@gmail.com>
Date: Fri, 4 Oct 2019 23:03:06 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Alexei Starovoitov <ast@...nel.org>, davem@...emloft.net
Cc: daniel@...earbox.net, x86@...nel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH bpf-next 07/10] bpf: add support for BTF pointers to x86
JIT
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)
Powered by blists - more mailing lists