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, 11 Apr 2017 13:06:55 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Johannes Berg <johannes@...solutions.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...nel.org>
Subject: Re: eBPF - little-endian load instructions?

On 04/11/2017 12:38 PM, Johannes Berg wrote:
> Hi,
>
> Looking at (e)BPF for wifi, I notice that everything is big endian in
> loads from the frame - and wifi is all little endian.
>
> Obviously, this can be worked around by doing byte-loads and swapping
> in the program, but it'll be more efficient to not do that.
>
> Do you think it's possible to add little-endian load instructions? Or
> perhaps there should be a conversion function from BE to LE?

Are you working with an skb at that point in time in wifi? There are
3 different ways of accessing skb data, see [1] slide 7 - 10. The BPF
LD_ABS/IND instructions were carried over from cBPF and are the only
ones that convert to host endianess. It can be used in eBPF as well,
but there are more efficient ways like 'direct packet access' or
helpers such as bpf_skb_load_bytes() that load the raw buffers as-is,
which is probably what you want if I understand you correctly.

There are instructions to convert endianess, see __bpf_prog_run(), the
ALU_END_TO_BE, ALU_END_TO_LE labels for details. There's a BPF_ENDIAN()
macro used in the test suite and other places.

   [1] http://netdevconf.org/1.2/slides/oct7/07_advanced_programmability_and_recent_updates_with_tc_cls_bpf.pdf

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ