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:   Tue, 26 Jan 2021 00:12:34 +0100
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Björn Töpel <bjorn.topel@...il.com>,
        ast@...nel.org, netdev@...r.kernel.org, bpf@...r.kernel.org
Cc:     Björn Töpel <bjorn.topel@...el.com>,
        magnus.karlsson@...el.com, maciej.fijalkowski@...el.com,
        kuba@...nel.org, jonathan.lemon@...il.com, maximmi@...dia.com,
        davem@...emloft.net, hawk@...nel.org, john.fastabend@...il.com,
        ciara.loftus@...el.com, weqaar.a.janjua@...el.com,
        andrii@...nel.org, Marek Majtyka <alardam@...il.com>
Subject: Re: [PATCH bpf-next 3/3] libbpf, xsk: select AF_XDP BPF program based
 on kernel version

On 1/22/21 11:53 AM, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@...el.com>
> 
> Add detection for kernel version, and adapt the BPF program based on
> kernel support. This way, users will get the best possible performance
> from the BPF program.
> 
> Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> Acked-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
> Signed-off-by: Marek Majtyka  <alardam@...il.com>
> ---
>   tools/lib/bpf/xsk.c | 82 +++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 79 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
> index e3e41ceeb1bc..1df8c133a5bc 100644
> --- a/tools/lib/bpf/xsk.c
> +++ b/tools/lib/bpf/xsk.c
> @@ -46,6 +46,11 @@
>    #define PF_XDP AF_XDP
>   #endif
>   
> +enum xsk_prog {
> +	XSK_PROG_FALLBACK,
> +	XSK_PROG_REDIRECT_FLAGS,
> +};
> +
>   struct xsk_umem {
>   	struct xsk_ring_prod *fill_save;
>   	struct xsk_ring_cons *comp_save;
> @@ -351,6 +356,55 @@ int xsk_umem__create_v0_0_2(struct xsk_umem **umem_ptr, void *umem_area,
>   COMPAT_VERSION(xsk_umem__create_v0_0_2, xsk_umem__create, LIBBPF_0.0.2)
>   DEFAULT_VERSION(xsk_umem__create_v0_0_4, xsk_umem__create, LIBBPF_0.0.4)
>   
> +

Fyi, removed this extra newline when I applied the series, thanks!

> +static enum xsk_prog get_xsk_prog(void)
> +{
> +	enum xsk_prog detected = XSK_PROG_FALLBACK;
> +	struct bpf_load_program_attr prog_attr;
> +	struct bpf_create_map_attr map_attr;
> +	__u32 size_out, retval, duration;
> +	char data_in = 0, data_out;
> +	struct bpf_insn insns[] = {
> +		BPF_LD_MAP_FD(BPF_REG_1, 0),
> +		BPF_MOV64_IMM(BPF_REG_2, 0),
> +		BPF_MOV64_IMM(BPF_REG_3, XDP_PASS),
> +		BPF_EMIT_CALL(BPF_FUNC_redirect_map),
> +		BPF_EXIT_INSN(),
[...]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ