Skip to content

Commit 440b652

Browse files
committed
Merge tag 'bpf-next-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
Pull bpf updates from Alexei Starovoitov: - Introduce '__attribute__((bpf_fastcall))' for helpers and kfuncs with corresponding support in LLVM. It is similar to existing 'no_caller_saved_registers' attribute in GCC/LLVM with a provision for backward compatibility. It allows compilers generate more efficient BPF code assuming the verifier or JITs will inline or partially inline a helper/kfunc with such attribute. bpf_cast_to_kern_ctx, bpf_rdonly_cast, bpf_get_smp_processor_id are the first set of such helpers. - Harden and extend ELF build ID parsing logic. When called from sleepable context the relevants parts of ELF file will be read to find and fetch .note.gnu.build-id information. Also harden the logic to avoid TOCTOU, overflow, out-of-bounds problems. - Improvements and fixes for sched-ext: - Allow passing BPF iterators as kfunc arguments - Make the pointer returned from iter_next method trusted - Fix x86 JIT convergence issue due to growing/shrinking conditional jumps in variable length encoding - BPF_LSM related: - Introduce few VFS kfuncs and consolidate them in fs/bpf_fs_kfuncs.c - Enforce correct range of return values from certain LSM hooks - Disallow attaching to other LSM hooks - Prerequisite work for upcoming Qdisc in BPF: - Allow kptrs in program provided structs - Support for gen_epilogue in verifier_ops - Important fixes: - Fix uprobe multi pid filter check - Fix bpf_strtol and bpf_strtoul helpers - Track equal scalars history on per-instruction level - Fix tailcall hierarchy on x86 and arm64 - Fix signed division overflow to prevent INT_MIN/-1 trap on x86 - Fix get kernel stack in BPF progs attached to tracepoint:syscall - Selftests: - Add uprobe bench/stress tool - Generate file dependencies to drastically improve re-build time - Match JIT-ed and BPF asm with __xlated/__jited keywords - Convert older tests to test_progs framework - Add support for RISC-V - Few fixes when BPF programs are compiled with GCC-BPF backend (support for GCC-BPF in BPF CI is ongoing in parallel) - Add traffic monitor - Enable cross compile and musl libc * tag 'bpf-next-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (260 commits) btf: require pahole 1.21+ for DEBUG_INFO_BTF with default DWARF version btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh bpf: Call the missed kfree() when there is no special field in btf bpf: Call the missed btf_record_free() when map creation fails selftests/bpf: Add a test case to write mtu result into .rodata selftests/bpf: Add a test case to write strtol result into .rodata selftests/bpf: Rename ARG_PTR_TO_LONG test description selftests/bpf: Fix ARG_PTR_TO_LONG {half-,}uninitialized test bpf: Zero former ARG_PTR_TO_{LONG,INT} args in case of error bpf: Improve check_raw_mode_ok test for MEM_UNINIT-tagged types bpf: Fix helper writes to read-only maps bpf: Remove truncation test in bpf_strtol and bpf_strtoul helpers bpf: Fix bpf_strtol and bpf_strtoul helpers for 32bit selftests/bpf: Add tests for sdiv/smod overflow cases bpf: Fix a sdiv overflow issue libbpf: Add bpf_object__token_fd accessor docs/bpf: Add missing BPF program types to docs docs/bpf: Add constant values for linkages bpf: Use fake pt_regs when doing bpf syscall tracepoint tracing ...
2 parents 1ec6d09 + 5277d13 commit 440b652

File tree

249 files changed

+11430
-3048
lines changed

Some content is hidden

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

249 files changed

+11430
-3048
lines changed

Documentation/bpf/btf.rst

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ No additional type data follow ``btf_type``.
368368
* ``info.kind_flag``: 0
369369
* ``info.kind``: BTF_KIND_FUNC
370370
* ``info.vlen``: linkage information (BTF_FUNC_STATIC, BTF_FUNC_GLOBAL
371-
or BTF_FUNC_EXTERN)
371+
or BTF_FUNC_EXTERN - see :ref:`BTF_Function_Linkage_Constants`)
372372
* ``type``: a BTF_KIND_FUNC_PROTO type
373373

374374
No additional type data follow ``btf_type``.
@@ -424,9 +424,8 @@ following data::
424424
__u32 linkage;
425425
};
426426

427-
``struct btf_var`` encoding:
428-
* ``linkage``: currently only static variable 0, or globally allocated
429-
variable in ELF sections 1
427+
``btf_var.linkage`` may take the values: BTF_VAR_STATIC, BTF_VAR_GLOBAL_ALLOCATED or BTF_VAR_GLOBAL_EXTERN -
428+
see :ref:`BTF_Var_Linkage_Constants`.
430429

431430
Not all type of global variables are supported by LLVM at this point.
432431
The following is currently available:
@@ -549,6 +548,38 @@ The ``btf_enum64`` encoding:
549548
If the original enum value is signed and the size is less than 8,
550549
that value will be sign extended into 8 bytes.
551550

551+
2.3 Constant Values
552+
-------------------
553+
554+
.. _BTF_Function_Linkage_Constants:
555+
556+
2.3.1 Function Linkage Constant Values
557+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
558+
.. table:: Function Linkage Values and Meanings
559+
560+
=================== ===== ===========
561+
kind value description
562+
=================== ===== ===========
563+
``BTF_FUNC_STATIC`` 0x0 definition of subprogram not visible outside containing compilation unit
564+
``BTF_FUNC_GLOBAL`` 0x1 definition of subprogram visible outside containing compilation unit
565+
``BTF_FUNC_EXTERN`` 0x2 declaration of a subprogram whose definition is outside the containing compilation unit
566+
=================== ===== ===========
567+
568+
569+
.. _BTF_Var_Linkage_Constants:
570+
571+
2.3.2 Variable Linkage Constant Values
572+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
573+
.. table:: Variable Linkage Values and Meanings
574+
575+
============================ ===== ===========
576+
kind value description
577+
============================ ===== ===========
578+
``BTF_VAR_STATIC`` 0x0 definition of global variable not visible outside containing compilation unit
579+
``BTF_VAR_GLOBAL_ALLOCATED`` 0x1 definition of global variable visible outside containing compilation unit
580+
``BTF_VAR_GLOBAL_EXTERN`` 0x2 declaration of global variable whose definition is outside the containing compilation unit
581+
============================ ===== ===========
582+
552583
3. BTF Kernel API
553584
=================
554585

Documentation/bpf/libbpf/program_types.rst

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ described in more detail in the footnotes.
121121
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
122122
| ``BPF_PROG_TYPE_LWT_XMIT`` | | ``lwt_xmit`` | |
123123
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
124+
| ``BPF_PROG_TYPE_NETFILTER`` | | ``netfilter`` | |
125+
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
124126
| ``BPF_PROG_TYPE_PERF_EVENT`` | | ``perf_event`` | |
125127
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
126128
| ``BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE`` | | ``raw_tp.w+`` [#rawtp]_ | |
@@ -131,11 +133,23 @@ described in more detail in the footnotes.
131133
+ + +----------------------------------+-----------+
132134
| | | ``raw_tracepoint+`` | |
133135
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
134-
| ``BPF_PROG_TYPE_SCHED_ACT`` | | ``action`` | |
136+
| ``BPF_PROG_TYPE_SCHED_ACT`` | | ``action`` [#tc_legacy]_ | |
135137
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
136-
| ``BPF_PROG_TYPE_SCHED_CLS`` | | ``classifier`` | |
138+
| ``BPF_PROG_TYPE_SCHED_CLS`` | | ``classifier`` [#tc_legacy]_ | |
137139
+ + +----------------------------------+-----------+
138-
| | | ``tc`` | |
140+
| | | ``tc`` [#tc_legacy]_ | |
141+
+ +----------------------------------------+----------------------------------+-----------+
142+
| | ``BPF_NETKIT_PRIMARY`` | ``netkit/primary`` | |
143+
+ +----------------------------------------+----------------------------------+-----------+
144+
| | ``BPF_NETKIT_PEER`` | ``netkit/peer`` | |
145+
+ +----------------------------------------+----------------------------------+-----------+
146+
| | ``BPF_TCX_INGRESS`` | ``tc/ingress`` | |
147+
+ +----------------------------------------+----------------------------------+-----------+
148+
| | ``BPF_TCX_EGRESS`` | ``tc/egress`` | |
149+
+ +----------------------------------------+----------------------------------+-----------+
150+
| | ``BPF_TCX_INGRESS`` | ``tcx/ingress`` | |
151+
+ +----------------------------------------+----------------------------------+-----------+
152+
| | ``BPF_TCX_EGRESS`` | ``tcx/egress`` | |
139153
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
140154
| ``BPF_PROG_TYPE_SK_LOOKUP`` | ``BPF_SK_LOOKUP`` | ``sk_lookup`` | |
141155
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
@@ -155,7 +169,9 @@ described in more detail in the footnotes.
155169
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
156170
| ``BPF_PROG_TYPE_SOCK_OPS`` | ``BPF_CGROUP_SOCK_OPS`` | ``sockops`` | |
157171
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
158-
| ``BPF_PROG_TYPE_STRUCT_OPS`` | | ``struct_ops+`` | |
172+
| ``BPF_PROG_TYPE_STRUCT_OPS`` | | ``struct_ops+`` [#struct_ops]_ | |
173+
+ + +----------------------------------+-----------+
174+
| | | ``struct_ops.s+`` [#struct_ops]_ | Yes |
159175
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
160176
| ``BPF_PROG_TYPE_SYSCALL`` | | ``syscall`` | Yes |
161177
+-------------------------------------------+----------------------------------------+----------------------------------+-----------+
@@ -209,5 +225,11 @@ described in more detail in the footnotes.
209225
``a-zA-Z0-9_.*?``.
210226
.. [#lsm] The ``lsm`` attachment format is ``lsm[.s]/<hook>``.
211227
.. [#rawtp] The ``raw_tp`` attach format is ``raw_tracepoint[.w]/<tracepoint>``.
228+
.. [#tc_legacy] The ``tc``, ``classifier`` and ``action`` attach types are deprecated, use
229+
``tcx/*`` instead.
230+
.. [#struct_ops] The ``struct_ops`` attach format supports ``struct_ops[.s]/<name>`` convention,
231+
but ``name`` is ignored and it is recommended to just use plain
232+
``SEC("struct_ops[.s]")``. The attachments are defined in a struct initializer
233+
that is tagged with ``SEC(".struct_ops[.link]")``.
212234
.. [#tp] The ``tracepoint`` attach format is ``tracepoint/<category>/<name>``.
213235
.. [#iter] The ``iter`` attach format is ``iter[.s]/<struct-name>``.

Documentation/bpf/verifier.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ The rules for correspondence between registers / stack slots are as follows:
418418
linked to the registers and stack slots of the parent state with the same
419419
indices.
420420

421-
* For the outer stack frames, only caller saved registers (r6-r9) and stack
421+
* For the outer stack frames, only callee saved registers (r6-r9) and stack
422422
slots are linked to the registers and stack slots of the parent state with the
423423
same indices.
424424

MAINTAINERS

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3997,7 +3997,7 @@ F: Documentation/devicetree/bindings/iio/imu/bosch,bmi323.yaml
39973997
F: drivers/iio/imu/bmi323/
39983998

39993999
BPF JIT for ARC
4000-
M: Shahab Vahedi <shahab@synopsys.com>
4000+
M: Shahab Vahedi <list+bpf@vahedi.org>
40014001
L: bpf@vger.kernel.org
40024002
S: Maintained
40034003
F: arch/arc/net/
@@ -4164,6 +4164,7 @@ F: include/uapi/linux/btf*
41644164
F: include/uapi/linux/filter.h
41654165
F: kernel/bpf/
41664166
F: kernel/trace/bpf_trace.c
4167+
F: lib/buildid.c
41674168
F: lib/test_bpf.c
41684169
F: net/bpf/
41694170
F: net/core/filter.c
@@ -4284,6 +4285,7 @@ L: bpf@vger.kernel.org
42844285
S: Maintained
42854286
F: kernel/bpf/stackmap.c
42864287
F: kernel/trace/bpf_trace.c
4288+
F: lib/buildid.c
42874289

42884290
BROADCOM ASP 2.0 ETHERNET DRIVER
42894291
M: Justin Chen <justin.chen@broadcom.com>

0 commit comments

Comments
 (0)