<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/bpf/offload.c, branch v6.3</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.3</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.3'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-02-03T04:26:12Z</updated>
<entry>
<title>bpf: Drop always true do_idr_lock parameter to bpf_map_free_id</title>
<updated>2023-02-03T04:26:12Z</updated>
<author>
<name>Tobias Klauser</name>
<email>tklauser@distanz.ch</email>
</author>
<published>2023-02-02T14:19:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=158e5e9eeaa0d7a86f2278313746ef6c8521790d'/>
<id>urn:sha1:158e5e9eeaa0d7a86f2278313746ef6c8521790d</id>
<content type='text'>
The do_idr_lock parameter to bpf_map_free_id was introduced by commit
bd5f5f4ecb78 ("bpf: Add BPF_MAP_GET_FD_BY_ID"). However, all callers set
do_idr_lock = true since commit 1e0bd5a091e5 ("bpf: Switch bpf_map ref
counter to atomic64_t so bpf_map_inc() never fails").

While at it also inline __bpf_map_put into its only caller bpf_map_put
now that do_idr_lock can be dropped from its signature.

Signed-off-by: Tobias Klauser &lt;tklauser@distanz.ch&gt;
Link: https://lore.kernel.org/r/20230202141921.4424-1-tklauser@distanz.ch
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next</title>
<updated>2023-01-28T08:00:14Z</updated>
<author>
<name>Jakub Kicinski</name>
<email>kuba@kernel.org</email>
</author>
<published>2023-01-28T07:59:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2d104c390f0d3901c4915dcb141cb96da96cffe7'/>
<id>urn:sha1:2d104c390f0d3901c4915dcb141cb96da96cffe7</id>
<content type='text'>
Daniel Borkmann says:

====================
bpf-next 2023-01-28

We've added 124 non-merge commits during the last 22 day(s) which contain
a total of 124 files changed, 6386 insertions(+), 1827 deletions(-).

The main changes are:

1) Implement XDP hints via kfuncs with initial support for RX hash and
   timestamp metadata kfuncs, from Stanislav Fomichev and
   Toke Høiland-Jørgensen.
   Measurements on overhead: https://lore.kernel.org/bpf/875yellcx6.fsf@toke.dk

2) Extend libbpf's bpf_tracing.h support for tracing arguments of
   kprobes/uprobes and syscall as a special case, from Andrii Nakryiko.

3) Significantly reduce the search time for module symbols by livepatch
   and BPF, from Jiri Olsa and Zhen Lei.

4) Enable cpumasks to be used as kptrs, which is useful for tracing
   programs tracking which tasks end up running on which CPUs
   in different time intervals, from David Vernet.

5) Fix several issues in the dynptr processing such as stack slot liveness
   propagation, missing checks for PTR_TO_STACK variable offset, etc,
   from Kumar Kartikeya Dwivedi.

6) Various performance improvements, fixes, and introduction of more
   than just one XDP program to XSK selftests, from Magnus Karlsson.

7) Big batch to BPF samples to reduce deprecated functionality,
   from Daniel T. Lee.

8) Enable struct_ops programs to be sleepable in verifier,
   from David Vernet.

9) Reduce pr_warn() noise on BTF mismatches when they are expected under
   the CONFIG_MODULE_ALLOW_BTF_MISMATCH config anyway, from Connor O'Brien.

10) Describe modulo and division by zero behavior of the BPF runtime
    in BPF's instruction specification document, from Dave Thaler.

11) Several improvements to libbpf API documentation in libbpf.h,
    from Grant Seltzer.

12) Improve resolve_btfids header dependencies related to subcmd and add
    proper support for HOSTCC, from Ian Rogers.

13) Add ipip6 and ip6ip decapsulation support for bpf_skb_adjust_room()
    helper along with BPF selftests, from Ziyang Xuan.

14) Simplify the parsing logic of structure parameters for BPF trampoline
    in the x86-64 JIT compiler, from Pu Lehui.

15) Get BTF working for kernels with CONFIG_RUST enabled by excluding
    Rust compilation units with pahole, from Martin Rodriguez Reboredo.

16) Get bpf_setsockopt() working for kTLS on top of TCP sockets,
    from Kui-Feng Lee.

17) Disable stack protection for BPF objects in bpftool given BPF backends
    don't support it, from Holger Hoffstätte.

* tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next: (124 commits)
  selftest/bpf: Make crashes more debuggable in test_progs
  libbpf: Add documentation to map pinning API functions
  libbpf: Fix malformed documentation formatting
  selftests/bpf: Properly enable hwtstamp in xdp_hw_metadata
  selftests/bpf: Calls bpf_setsockopt() on a ktls enabled socket.
  bpf: Check the protocol of a sock to agree the calls to bpf_setsockopt().
  bpf/selftests: Verify struct_ops prog sleepable behavior
  bpf: Pass const struct bpf_prog * to .check_member
  libbpf: Support sleepable struct_ops.s section
  bpf: Allow BPF_PROG_TYPE_STRUCT_OPS programs to be sleepable
  selftests/bpf: Fix vmtest static compilation error
  tools/resolve_btfids: Alter how HOSTCC is forced
  tools/resolve_btfids: Install subcmd headers
  bpf/docs: Document the nocast aliasing behavior of ___init
  bpf/docs: Document how nested trusted fields may be defined
  bpf/docs: Document cpumask kfuncs in a new file
  selftests/bpf: Add selftest suite for cpumask kfuncs
  selftests/bpf: Add nested trust selftests suite
  bpf: Enable cpumasks to be queried and used as kptrs
  bpf: Disallow NULLable pointers for trusted kfuncs
  ...
====================

Link: https://lore.kernel.org/r/20230128004827.21371-1-daniel@iogearbox.net
Signed-off-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Support consuming XDP HW metadata from fext programs</title>
<updated>2023-01-23T17:38:11Z</updated>
<author>
<name>Toke Høiland-Jørgensen</name>
<email>toke@redhat.com</email>
</author>
<published>2023-01-19T22:15:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fd7c211d6875013f81acc09868effe199b5d2c0c'/>
<id>urn:sha1:fd7c211d6875013f81acc09868effe199b5d2c0c</id>
<content type='text'>
Instead of rejecting the attaching of PROG_TYPE_EXT programs to XDP
programs that consume HW metadata, implement support for propagating the
offload information. The extension program doesn't need to set a flag or
ifindex, these will just be propagated from the target by the verifier.
We need to create a separate offload object for the extension program,
though, since it can be reattached to a different program later (which
means we can't just inherit the offload information from the target).

An additional check is added on attach that the new target is compatible
with the offload information in the extension prog.

Signed-off-by: Toke Høiland-Jørgensen &lt;toke@redhat.com&gt;
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230119221536.3349901-9-sdf@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: XDP metadata RX kfuncs</title>
<updated>2023-01-23T17:38:11Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2023-01-19T22:15:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=3d76a4d3d4e591af3e789698affaad88a5a8e8ab'/>
<id>urn:sha1:3d76a4d3d4e591af3e789698affaad88a5a8e8ab</id>
<content type='text'>
Define a new kfunc set (xdp_metadata_kfunc_ids) which implements all possible
XDP metatada kfuncs. Not all devices have to implement them. If kfunc is not
supported by the target device, the default implementation is called instead.
The verifier, at load time, replaces a call to the generic kfunc with a call
to the per-device one. Per-device kfunc pointers are stored in separate
struct xdp_metadata_ops.

Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Martin KaFai Lau &lt;martin.lau@linux.dev&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Cc: Anatoly Burakov &lt;anatoly.burakov@intel.com&gt;
Cc: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@gmail.com&gt;
Cc: Maryam Tahhan &lt;mtahhan@redhat.com&gt;
Cc: xdp-hints@xdp-project.net
Cc: netdev@vger.kernel.org
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230119221536.3349901-8-sdf@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Introduce device-bound XDP programs</title>
<updated>2023-01-23T17:38:10Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2023-01-19T22:15:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2b3486bc2d237ec345b3942b7be5deabf8c8fed1'/>
<id>urn:sha1:2b3486bc2d237ec345b3942b7be5deabf8c8fed1</id>
<content type='text'>
New flag BPF_F_XDP_DEV_BOUND_ONLY plus all the infra to have a way
to associate a netdev with a BPF program at load time.

netdevsim checks are dropped in favor of generic check in dev_xdp_attach.

Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Martin KaFai Lau &lt;martin.lau@linux.dev&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Cc: Anatoly Burakov &lt;anatoly.burakov@intel.com&gt;
Cc: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@gmail.com&gt;
Cc: Maryam Tahhan &lt;mtahhan@redhat.com&gt;
Cc: xdp-hints@xdp-project.net
Cc: netdev@vger.kernel.org
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230119221536.3349901-6-sdf@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Reshuffle some parts of bpf/offload.c</title>
<updated>2023-01-23T17:38:10Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2023-01-19T22:15:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=89bbc53a4dbbbdd65962d4bbaeba6c7775ea0bf7'/>
<id>urn:sha1:89bbc53a4dbbbdd65962d4bbaeba6c7775ea0bf7</id>
<content type='text'>
To avoid adding forward declarations in the main patch, shuffle
some code around. No functional changes.

Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Martin KaFai Lau &lt;martin.lau@linux.dev&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Cc: Anatoly Burakov &lt;anatoly.burakov@intel.com&gt;
Cc: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@gmail.com&gt;
Cc: Maryam Tahhan &lt;mtahhan@redhat.com&gt;
Cc: xdp-hints@xdp-project.net
Cc: netdev@vger.kernel.org
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230119221536.3349901-5-sdf@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Move offload initialization into late_initcall</title>
<updated>2023-01-23T17:38:10Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2023-01-19T22:15:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f1fc43d03946d6a2f3dcb05e8c0b874bdf1333c5'/>
<id>urn:sha1:f1fc43d03946d6a2f3dcb05e8c0b874bdf1333c5</id>
<content type='text'>
So we don't have to initialize it manually from several paths.

Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Martin KaFai Lau &lt;martin.lau@linux.dev&gt;
Cc: Jakub Kicinski &lt;kuba@kernel.org&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Cc: Anatoly Burakov &lt;anatoly.burakov@intel.com&gt;
Cc: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@gmail.com&gt;
Cc: Maryam Tahhan &lt;mtahhan@redhat.com&gt;
Cc: xdp-hints@xdp-project.net
Cc: netdev@vger.kernel.org
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230119221536.3349901-4-sdf@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Rename bpf_{prog,map}_is_dev_bound to is_offloaded</title>
<updated>2023-01-23T17:38:10Z</updated>
<author>
<name>Stanislav Fomichev</name>
<email>sdf@google.com</email>
</author>
<published>2023-01-19T22:15:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9d03ebc71a027ca495c60f6e94d3cda81921791f'/>
<id>urn:sha1:9d03ebc71a027ca495c60f6e94d3cda81921791f</id>
<content type='text'>
BPF offloading infra will be reused to implement
bound-but-not-offloaded bpf programs. Rename existing
helpers for clarity. No functional changes.

Cc: John Fastabend &lt;john.fastabend@gmail.com&gt;
Cc: David Ahern &lt;dsahern@gmail.com&gt;
Cc: Martin KaFai Lau &lt;martin.lau@linux.dev&gt;
Cc: Willem de Bruijn &lt;willemb@google.com&gt;
Cc: Jesper Dangaard Brouer &lt;brouer@redhat.com&gt;
Cc: Anatoly Burakov &lt;anatoly.burakov@intel.com&gt;
Cc: Alexander Lobakin &lt;alexandr.lobakin@intel.com&gt;
Cc: Magnus Karlsson &lt;magnus.karlsson@gmail.com&gt;
Cc: Maryam Tahhan &lt;mtahhan@redhat.com&gt;
Cc: xdp-hints@xdp-project.net
Cc: netdev@vger.kernel.org
Reviewed-by: Jakub Kicinski &lt;kuba@kernel.org&gt;
Signed-off-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230119221536.3349901-3-sdf@google.com
Signed-off-by: Martin KaFai Lau &lt;martin.lau@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: restore the ebpf program ID for BPF_AUDIT_UNLOAD and PERF_BPF_EVENT_PROG_UNLOAD</title>
<updated>2023-01-10T03:47:58Z</updated>
<author>
<name>Paul Moore</name>
<email>paul@paul-moore.com</email>
</author>
<published>2023-01-06T15:43:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ef01f4e25c1760920e2c94f1c232350277ace69b'/>
<id>urn:sha1:ef01f4e25c1760920e2c94f1c232350277ace69b</id>
<content type='text'>
When changing the ebpf program put() routines to support being called
from within IRQ context the program ID was reset to zero prior to
calling the perf event and audit UNLOAD record generators, which
resulted in problems as the ebpf program ID was bogus (always zero).
This patch addresses this problem by removing an unnecessary call to
bpf_prog_free_id() in __bpf_prog_offload_destroy() and adjusting
__bpf_prog_put() to only call bpf_prog_free_id() after audit and perf
have finished their bpf program unload tasks in
bpf_prog_put_deferred().  For the record, no one can determine, or
remember, why it was necessary to free the program ID, and remove it
from the IDR, prior to executing bpf_prog_put_deferred();
regardless, both Stanislav and Alexei agree that the approach in this
patch should be safe.

It is worth noting that when moving the bpf_prog_free_id() call, the
do_idr_lock parameter was forced to true as the ebpf devs determined
this was the correct as the do_idr_lock should always be true.  The
do_idr_lock parameter will be removed in a follow-up patch, but it
was kept here to keep the patch small in an effort to ease any stable
backports.

I also modified the bpf_audit_prog() logic used to associate the
AUDIT_BPF record with other associated records, e.g. @ctx != NULL.
Instead of keying off the operation, it now keys off the execution
context, e.g. '!in_irg &amp;&amp; !irqs_disabled()', which is much more
appropriate and should help better connect the UNLOAD operations with
the associated audit state (other audit records).

Cc: stable@vger.kernel.org
Fixes: d809e134be7a ("bpf: Prepare bpf_prog_put() to be called from irq context.")
Reported-by: Burn Alting &lt;burn.alting@iinet.net.au&gt;
Reported-by: Jiri Olsa &lt;olsajiri@gmail.com&gt;
Suggested-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Suggested-by: Alexei Starovoitov &lt;alexei.starovoitov@gmail.com&gt;
Signed-off-by: Paul Moore &lt;paul@paul-moore.com&gt;
Acked-by: Stanislav Fomichev &lt;sdf@google.com&gt;
Link: https://lore.kernel.org/r/20230106154400.74211-1-paul@paul-moore.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>bpf: Use bpf_map_area_alloc consistently on bpf map creation</title>
<updated>2022-08-10T18:50:43Z</updated>
<author>
<name>Yafang Shao</name>
<email>laoar.shao@gmail.com</email>
</author>
<published>2022-08-10T15:18:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=73cf09a36bf7bfb3e5a3ff23755c36d49137c44d'/>
<id>urn:sha1:73cf09a36bf7bfb3e5a3ff23755c36d49137c44d</id>
<content type='text'>
Let's use the generic helper bpf_map_area_alloc() instead of the
open-coded kzalloc helpers in bpf maps creation path.

Signed-off-by: Yafang Shao &lt;laoar.shao@gmail.com&gt;
Link: https://lore.kernel.org/r/20220810151840.16394-5-laoar.shao@gmail.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
</feed>
