lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ