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:   Sun, 05 Dec 2021 19:18:03 -0800
From:   John Fastabend <john.fastabend@...il.com>
To:     Lorenzo Bianconi <lorenzo@...nel.org>, bpf@...r.kernel.org,
        netdev@...r.kernel.org
Cc:     lorenzo.bianconi@...hat.com, davem@...emloft.net, kuba@...nel.org,
        ast@...nel.org, daniel@...earbox.net, shayagr@...zon.com,
        john.fastabend@...il.com, dsahern@...nel.org, brouer@...hat.com,
        echaudro@...hat.com, jasowang@...hat.com,
        alexander.duyck@...il.com, saeed@...nel.org,
        maciej.fijalkowski@...el.com, magnus.karlsson@...el.com,
        tirthendu.sarkar@...el.com, toke@...hat.com
Subject: RE: [PATCH v19 bpf-next 10/23] net: mvneta: enable jumbo frames if
 the loaded XDP program support mb

Lorenzo Bianconi wrote:
> Enable the capability to receive jumbo frames even if the interface is
> running in XDP mode if the loaded program declare to properly support
> xdp multi-buff. At same time reject a xdp program not supporting xdp
> multi-buffer if the driver is running in xdp multi-buffer mode.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@...nel.org>
> ---

Allow me to enumerate the cases as a sanity check.

 mb prog on driver w/out mb support:

    The program will never receive a non-linear buffer so no
    trouble here. If user tries to configure MTU >1500 an error
    will be thrown by driver same as always.
  
 !mb prog on driver w/out mb support.

    This is the normal case, no change.

 mb prog on driver with mb support.

    Allowed and user may now set MTU >1500.    

 !mb prog on driver with mb support

    Allowed and now driver must throw an error on MTU >1500

OK works for me. Thanks.

Acked-by: John Fastabend <john.fastabend@...il.com>

>  drivers/net/ethernet/marvell/mvneta.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
> index 332699960b53..98db3d03116a 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -3750,6 +3750,7 @@ static void mvneta_percpu_disable(void *arg)
>  static int mvneta_change_mtu(struct net_device *dev, int mtu)
>  {
>  	struct mvneta_port *pp = netdev_priv(dev);
> +	struct bpf_prog *prog = pp->xdp_prog;
>  	int ret;
>  
>  	if (!IS_ALIGNED(MVNETA_RX_PKT_SIZE(mtu), 8)) {
> @@ -3758,8 +3759,11 @@ static int mvneta_change_mtu(struct net_device *dev, int mtu)
>  		mtu = ALIGN(MVNETA_RX_PKT_SIZE(mtu), 8);
>  	}
>  
> -	if (pp->xdp_prog && mtu > MVNETA_MAX_RX_BUF_SIZE) {
> -		netdev_info(dev, "Illegal MTU value %d for XDP mode\n", mtu);
> +	if (prog && !prog->aux->xdp_mb && mtu > MVNETA_MAX_RX_BUF_SIZE) {
> +		netdev_info(dev,
> +			    "Illegal MTU %d for XDP prog without multi-buf\n",
> +			    mtu);
> +
>  		return -EINVAL;
>  	}
>  
> @@ -4428,8 +4432,9 @@ static int mvneta_xdp_setup(struct net_device *dev, struct bpf_prog *prog,
>  	struct mvneta_port *pp = netdev_priv(dev);
>  	struct bpf_prog *old_prog;
>  
> -	if (prog && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
> -		NL_SET_ERR_MSG_MOD(extack, "MTU too large for XDP");
> +	if (prog && !prog->aux->xdp_mb && dev->mtu > MVNETA_MAX_RX_BUF_SIZE) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "prog does not support XDP multi-buff");
>  		return -EOPNOTSUPP;
>  	}
>  
> -- 
> 2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ