Skip to content

Commit b8af417

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Daniel Borkmann says: ==================== pull-request: bpf-next 2021-02-16 The following pull-request contains BPF updates for your *net-next* tree. There's a small merge conflict between 7eeba17 ("tcp: Add receive timestamp support for receive zerocopy.") from net-next tree and 9cacf81 ("bpf: Remove extra lock_sock for TCP_ZEROCOPY_RECEIVE") from bpf-next tree. Resolve as follows: [...] lock_sock(sk); err = tcp_zerocopy_receive(sk, &zc, &tss); err = BPF_CGROUP_RUN_PROG_GETSOCKOPT_KERN(sk, level, optname, &zc, &len, err); release_sock(sk); [...] We've added 116 non-merge commits during the last 27 day(s) which contain a total of 156 files changed, 5662 insertions(+), 1489 deletions(-). The main changes are: 1) Adds support of pointers to types with known size among global function args to overcome the limit on max # of allowed args, from Dmitrii Banshchikov. 2) Add bpf_iter for task_vma which can be used to generate information similar to /proc/pid/maps, from Song Liu. 3) Enable bpf_{g,s}etsockopt() from all sock_addr related program hooks. Allow rewriting bind user ports from BPF side below the ip_unprivileged_port_start range, both from Stanislav Fomichev. 4) Prevent recursion on fentry/fexit & sleepable programs and allow map-in-map as well as per-cpu maps for the latter, from Alexei Starovoitov. 5) Add selftest script to run BPF CI locally. Also enable BPF ringbuffer for sleepable programs, both from KP Singh. 6) Extend verifier to enable variable offset read/write access to the BPF program stack, from Andrei Matei. 7) Improve tc & XDP MTU handling and add a new bpf_check_mtu() helper to query device MTU from programs, from Jesper Dangaard Brouer. 8) Allow bpf_get_socket_cookie() helper also be called from [sleepable] BPF tracing programs, from Florent Revest. 9) Extend x86 JIT to pad JMPs with NOPs for helping image to converge when otherwise too many passes are required, from Gary Lin. 10) Verifier fixes on atomics with BPF_FETCH as well as function-by-function verification both related to zero-extension handling, from Ilya Leoshkevich. 11) Better kernel build integration of resolve_btfids tool, from Jiri Olsa. 12) Batch of AF_XDP selftest cleanups and small performance improvement for libbpf's xsk map redirect for newer kernels, from Björn Töpel. 13) Follow-up BPF doc and verifier improvements around atomics with BPF_FETCH, from Brendan Jackman. 14) Permit zero-sized data sections e.g. if ELF .rodata section contains read-only data from local variables, from Yonghong Song. 15) veth driver skb bulk-allocation for ndo_xdp_xmit, from Lorenzo Bianconi. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 9ec5eea + 45159b2 commit b8af417

156 files changed

Lines changed: 5662 additions & 1489 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Documentation/bpf/bpf_design_QA.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ data structures and compile with kernel internal headers. Both of these
208208
kernel internals are subject to change and can break with newer kernels
209209
such that the program needs to be adapted accordingly.
210210

211+
Q: Are tracepoints part of the stable ABI?
212+
------------------------------------------
213+
A: NO. Tracepoints are tied to internal implementation details hence they are
214+
subject to change and can break with newer kernels. BPF programs need to change
215+
accordingly when this happens.
216+
211217
Q: How much stack space a BPF program uses?
212218
-------------------------------------------
213219
A: Currently all program types are limited to 512 bytes of stack

‎Documentation/bpf/bpf_devel_QA.rst‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,16 +501,19 @@ All LLVM releases can be found at: http://releases.llvm.org/
501501

502502
Q: Got it, so how do I build LLVM manually anyway?
503503
--------------------------------------------------
504-
A: You need cmake and gcc-c++ as build requisites for LLVM. Once you have
505-
that set up, proceed with building the latest LLVM and clang version
504+
A: We recommend that developers who want the fastest incremental builds
505+
use the Ninja build system, you can find it in your system's package
506+
manager, usually the package is ninja or ninja-build.
507+
508+
You need ninja, cmake and gcc-c++ as build requisites for LLVM. Once you
509+
have that set up, proceed with building the latest LLVM and clang version
506510
from the git repositories::
507511

508512
$ git clone https://github.com/llvm/llvm-project.git
509-
$ mkdir -p llvm-project/llvm/build/install
513+
$ mkdir -p llvm-project/llvm/build
510514
$ cd llvm-project/llvm/build
511515
$ cmake .. -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
512516
-DLLVM_ENABLE_PROJECTS="clang" \
513-
-DBUILD_SHARED_LIBS=OFF \
514517
-DCMAKE_BUILD_TYPE=Release \
515518
-DLLVM_BUILD_RUNTIME=OFF
516519
$ ninja

‎Documentation/networking/filter.rst‎

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,12 +1048,12 @@ Unlike classic BPF instruction set, eBPF has generic load/store operations::
10481048
Where size is one of: BPF_B or BPF_H or BPF_W or BPF_DW.
10491049

10501050
It also includes atomic operations, which use the immediate field for extra
1051-
encoding.
1051+
encoding::
10521052

10531053
.imm = BPF_ADD, .code = BPF_ATOMIC | BPF_W | BPF_STX: lock xadd *(u32 *)(dst_reg + off16) += src_reg
10541054
.imm = BPF_ADD, .code = BPF_ATOMIC | BPF_DW | BPF_STX: lock xadd *(u64 *)(dst_reg + off16) += src_reg
10551055
1056-
The basic atomic operations supported are:
1056+
The basic atomic operations supported are::
10571057

10581058
BPF_ADD
10591059
BPF_AND
@@ -1066,33 +1066,35 @@ memory location addresed by ``dst_reg + off`` is atomically modified, with
10661066
immediate, then these operations also overwrite ``src_reg`` with the
10671067
value that was in memory before it was modified.
10681068

1069-
The more special operations are:
1069+
The more special operations are::
10701070

10711071
BPF_XCHG
10721072

10731073
This atomically exchanges ``src_reg`` with the value addressed by ``dst_reg +
1074-
off``.
1074+
off``. ::
10751075

10761076
BPF_CMPXCHG
10771077

10781078
This atomically compares the value addressed by ``dst_reg + off`` with
1079-
``R0``. If they match it is replaced with ``src_reg``, The value that was there
1080-
before is loaded back to ``R0``.
1079+
``R0``. If they match it is replaced with ``src_reg``. In either case, the
1080+
value that was there before is zero-extended and loaded back to ``R0``.
10811081

10821082
Note that 1 and 2 byte atomic operations are not supported.
10831083

1084-
Except ``BPF_ADD`` _without_ ``BPF_FETCH`` (for legacy reasons), all 4 byte
1085-
atomic operations require alu32 mode. Clang enables this mode by default in
1086-
architecture v3 (``-mcpu=v3``). For older versions it can be enabled with
1084+
Clang can generate atomic instructions by default when ``-mcpu=v3`` is
1085+
enabled. If a lower version for ``-mcpu`` is set, the only atomic instruction
1086+
Clang can generate is ``BPF_ADD`` *without* ``BPF_FETCH``. If you need to enable
1087+
the atomics features, while keeping a lower ``-mcpu`` version, you can use
10871088
``-Xclang -target-feature -Xclang +alu32``.
10881089

1089-
You may encounter BPF_XADD - this is a legacy name for BPF_ATOMIC, referring to
1090-
the exclusive-add operation encoded when the immediate field is zero.
1090+
You may encounter ``BPF_XADD`` - this is a legacy name for ``BPF_ATOMIC``,
1091+
referring to the exclusive-add operation encoded when the immediate field is
1092+
zero.
10911093

1092-
eBPF has one 16-byte instruction: BPF_LD | BPF_DW | BPF_IMM which consists
1094+
eBPF has one 16-byte instruction: ``BPF_LD | BPF_DW | BPF_IMM`` which consists
10931095
of two consecutive ``struct bpf_insn`` 8-byte blocks and interpreted as single
10941096
instruction that loads 64-bit immediate value into a dst_reg.
1095-
Classic BPF has similar instruction: BPF_LD | BPF_W | BPF_IMM which loads
1097+
Classic BPF has similar instruction: ``BPF_LD | BPF_W | BPF_IMM`` which loads
10961098
32-bit immediate value into a register.
10971099

10981100
eBPF verifier

‎Makefile‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,17 @@ ifdef CONFIG_STACK_VALIDATION
10821082
endif
10831083
endif
10841084

1085+
PHONY += resolve_btfids_clean
1086+
1087+
resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids
1088+
1089+
# tools/bpf/resolve_btfids directory might not exist
1090+
# in output directory, skip its clean in that case
1091+
resolve_btfids_clean:
1092+
ifneq ($(wildcard $(resolve_btfids_O)),)
1093+
$(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean
1094+
endif
1095+
10851096
ifdef CONFIG_BPF
10861097
ifdef CONFIG_DEBUG_INFO_BTF
10871098
ifeq ($(has_libelf),1)
@@ -1491,7 +1502,7 @@ vmlinuxclean:
14911502
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
14921503
$(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
14931504

1494-
clean: archclean vmlinuxclean
1505+
clean: archclean vmlinuxclean resolve_btfids_clean
14951506

14961507
# mrproper - Delete all generated files, including .config
14971508
#

0 commit comments

Comments
 (0)