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: <BYAPR21MB133640B374769CDF84685C03CA090@BYAPR21MB1336.namprd21.prod.outlook.com>
Date:   Wed, 15 May 2019 17:50:25 +0000
From:   Haiyang Zhang <haiyangz@...rosoft.com>
To:     Stephen Hemminger <stephen@...workplumber.org>,
        KY Srinivasan <kys@...rosoft.com>,
        "davem@...emloft.net" <davem@...emloft.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Stephen Hemminger <sthemmin@...rosoft.com>
Subject: RE: [RFC 1/2] netvsc: invoke xdp_generic from VF frame handler



> -----Original Message-----
> From: Stephen Hemminger <stephen@...workplumber.org>
> Sent: Wednesday, May 15, 2019 4:03 AM
> To: KY Srinivasan <kys@...rosoft.com>; Haiyang Zhang
> <haiyangz@...rosoft.com>; davem@...emloft.net
> Cc: netdev@...r.kernel.org; Stephen Hemminger <sthemmin@...rosoft.com>
> Subject: [RFC 1/2] netvsc: invoke xdp_generic from VF frame handler
> 
> XDP generic does not work correctly with the Hyper-V/Azure netvsc device
> because of packet processing order. Only packets on the synthetic path get
> seen by the XDP program. The VF device packets are not seen.
> 
> By the time the packets that arrive on the VF are handled by netvsc after the
> first pass of XDP generic (on the VF) has already been done.
> 
> A fix for the netvsc device is to do this in the VF packet handler.
> by directly calling do_xdp_generic() if XDP program is present on the parent
> device.
> 
> A riskier but maybe better alternative would be to do this netdev core code
> after the receive handler is invoked (if RX_HANDLER_ANOTHER is returned).
> 
> Fixes: 0c195567a8f6 ("netvsc: transparent VF management")
> Signed-off-by: Stephen Hemminger <sthemmin@...rosoft.com>
> ---
>  drivers/net/hyperv/netvsc_drv.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 06393b215102..bb0fc1869bde 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -1999,9 +1999,15 @@ static rx_handler_result_t
> netvsc_vf_handle_frame(struct sk_buff **pskb)
>  	struct net_device_context *ndev_ctx = netdev_priv(ndev);
>  	struct netvsc_vf_pcpu_stats *pcpu_stats
>  		 = this_cpu_ptr(ndev_ctx->vf_stats);
> +	struct bpf_prog *xdp_prog;
> 
>  	skb->dev = ndev;
> 
> +	xdp_prog = rcu_dereference(ndev->xdp_prog);
> +	if (xdp_prog &&
> +	    do_xdp_generic(xdp_prog, skb) != XDP_PASS)
> +		return RX_HANDLER_CONSUMED;

Looks fine overall.

The function do_xdp_generic() already checks NULL on xdp_prog,
so we don't need to check it in our code. 

int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb)
{
        if (xdp_prog) {

Thanks,
- Haiyang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ