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]
Message-ID: <20160920102943.24732097@brouer.com>
Date:   Tue, 20 Sep 2016 10:29:43 +0200
From:   Jesper Dangaard Brouer <netdev@...uer.com>
To:     Tariq Toukan <tariqt@...lanox.com>
Cc:     "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        Eran Ben Elisha <eranbe@...lanox.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        Rana Shahout <ranas@...lanox.com>
Subject: Re: [PATCH net-next 7/8] net/mlx5e: XDP TX forwarding support


On Mon, 19 Sep 2016 16:58:58 +0300 Tariq Toukan <tariqt@...lanox.com> wrote:

> +	act = bpf_prog_run_xdp(prog, &xdp);
> +	switch (act) {
> +	case XDP_PASS:
> +		return false;
> +	case XDP_TX:
> +		consumed = mlx5e_xmit_xdp_frame(&rq->channel->xdp_sq, di,
> +						MLX5_RX_HEADROOM,
> +						len);
> +		rq->stats.xdp_tx += consumed;
> +		return consumed;
> +	default:
> +		bpf_warn_invalid_xdp_action(act);
> +		return false;

This looks wrong.  According to the specification[1] and comment in the
code /include/uapi/linux/bpf.h: "Unknown return codes will result in
packet drop"

> +	case XDP_ABORTED:

It is not clearly defined, but I believe XDP_ABORTED should also result
in a warning (calling bpf_warn_invalid_xdp_action(act)).


> +	case XDP_DROP:
> +		rq->stats.xdp_drop++;
> +		mlx5e_page_release(rq, di, true);
> +		return true;
> +	}


I've started documenting XDP[2], as this patch clearly shows there is a
need to have a specification, given already the second driver
supporting XDP gets these details wrong.

[1] https://prototype-kernel.readthedocs.io/en/latest/networking/XDP/implementation/xdp_actions.html#xdp-aborted

[2] https://prototype-kernel.readthedocs.io/en/latest/networking/XDP/index.html

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  Author of http://www.iptv-analyzer.org
  LinkedIn: http://www.linkedin.com/in/brouer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ