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: <20191216153501.0c5c036a@carbon>
Date:   Mon, 16 Dec 2019 15:35:01 +0100
From:   Jesper Dangaard Brouer <brouer@...hat.com>
To:     Toke Høiland-Jørgensen <toke@...hat.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
        bpf@...r.kernel.org, David Ahern <dsahern@...il.com>,
        brouer@...hat.com
Subject: Re: [PATCH bpf-next] samples/bpf: Attach XDP programs in driver
 mode by default

On Mon, 16 Dec 2019 12:07:42 +0100
Toke Høiland-Jørgensen <toke@...hat.com> wrote:

> When attaching XDP programs, userspace can set flags to request the attach
> mode (generic/SKB mode, driver mode or hw offloaded mode). If no such flags
> are requested, the kernel will attempt to attach in driver mode, and then
> silently fall back to SKB mode if this fails.
> 
> The silent fallback is a major source of user confusion, as users will try
> to load a program on a device without XDP support, and instead of an error
> they will get the silent fallback behaviour, not notice, and then wonder
> why performance is not what they were expecting.
> 
> In an attempt to combat this, let's switch all the samples to default to
> explicitly requesting driver-mode attach. As part of this, ensure that all
> the userspace utilities have a switch to enable SKB mode. For those that
> have a switch to request driver mode, keep it but turn it into a no-op.
> 
> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
> ---

I agree, that this is a good way forward.

What is the observed behavior / error-message after this change?

I wanted to test this myself, but compiling samples/bpf/ is breaking
(again) on my system...

> diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
> index 3e553eed95a7..38a8852cb57f 100644
> --- a/samples/bpf/xdp1_user.c
> +++ b/samples/bpf/xdp1_user.c
> @@ -98,7 +98,7 @@ int main(int argc, char **argv)
>  			xdp_flags |= XDP_FLAGS_SKB_MODE;
>  			break;
>  		case 'N':
> -			xdp_flags |= XDP_FLAGS_DRV_MODE;
> +			/* default, set below */
>  			break;
>  		case 'F':
>  			xdp_flags &= ~XDP_FLAGS_UPDATE_IF_NOEXIST;
> @@ -109,6 +109,9 @@ int main(int argc, char **argv)
>  		}
>  	}
>  
> +	if (!(xdp_flags & XDP_FLAGS_SKB_MODE))
> +		xdp_flags |= XDP_FLAGS_DRV_MODE;
> +
>  	if (optind == argc) {
>  		usage(basename(argv[0]));
>  		return 1;


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ