sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget/translations/zh_CN/bpf/kfuncsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/zh_TW/bpf/kfuncsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/it_IT/bpf/kfuncsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ja_JP/bpf/kfuncsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ko_KR/bpf/kfuncsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/pt_BR/bpf/kfuncsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/sp_SP/bpf/kfuncsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh8/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs.rsthKubhtarget)}(h.. _kfuncs-header-label:h]h}(h]h ]h"]h$]h&]refidkfuncs-header-labeluh1hhKhhhhhhubhsection)}(hhh](htitle)}(hBPF Kernel Functions (kfuncs)h]hBPF Kernel Functions (kfuncs)}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h1. Introductionh]h1. Introduction}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh paragraph)}(hXBPF Kernel Functions or more commonly known as kfuncs are functions in the Linux kernel which are exposed for use by BPF programs. Unlike normal BPF helpers, kfuncs do not have a stable interface and can change from one kernel release to another. Hence, BPF programs need to be updated in response to changes in the kernel. See :ref:`BPF_kfunc_lifecycle_expectations` for more information.h](hXHBPF Kernel Functions or more commonly known as kfuncs are functions in the Linux kernel which are exposed for use by BPF programs. Unlike normal BPF helpers, kfuncs do not have a stable interface and can change from one kernel release to another. Hence, BPF programs need to be updated in response to changes in the kernel. See }(hhhhhNhNubh)}(h':ref:`BPF_kfunc_lifecycle_expectations`h]hinline)}(hjh]h BPF_kfunc_lifecycle_expectations}(hj hhhNhNubah}(h]h ](xrefstdstd-refeh"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&]refdoc bpf/kfuncs refdomainjreftyperef refexplicitrefwarn reftarget bpf_kfunc_lifecycle_expectationsuh1hhhhK hhubh for more information.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK hhhhubeh}(h] introductionah ]h"]1. introductionah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(h2. Defining a kfunch]h2. Defining a kfunc}(hj@hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj=hhhhhKubh)}(hX8There are two ways to expose a kernel function to BPF programs, either make an existing function in the kernel visible, or add a new wrapper for BPF. In both cases, care must be taken that BPF program can only call such function in a valid context. To enforce this, visibility of a kfunc can be per program type.h]hX8There are two ways to expose a kernel function to BPF programs, either make an existing function in the kernel visible, or add a new wrapper for BPF. In both cases, care must be taken that BPF program can only call such function in a valid context. To enforce this, visibility of a kfunc can be per program type.}(hjNhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj=hhubh)}(hiIf you are not creating a BPF wrapper for existing kernel function, skip ahead to :ref:`BPF_kfunc_nodef`.h](hRIf you are not creating a BPF wrapper for existing kernel function, skip ahead to }(hj\hhhNhNubh)}(h:ref:`BPF_kfunc_nodef`h]j )}(hjfh]hBPF_kfunc_nodef}(hjhhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j hjdubah}(h]h ]h"]h$]h&]refdocj# refdomainjrreftyperef refexplicitrefwarnj)bpf_kfunc_nodefuh1hhhhKhj\ubh.}(hj\hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj=hhubh)}(hhh](h)}(h2.1 Creating a wrapper kfunch]h2.1 Creating a wrapper kfunc}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hXWhen defining a wrapper kfunc, the wrapper function should have extern linkage. This prevents the compiler from optimizing away dead code, as this wrapper kfunc is not invoked anywhere in the kernel itself. It is not necessary to provide a prototype in a header for the wrapper kfunc.h]hXWhen defining a wrapper kfunc, the wrapper function should have extern linkage. This prevents the compiler from optimizing away dead code, as this wrapper kfunc is not invoked anywhere in the kernel itself. It is not necessary to provide a prototype in a header for the wrapper kfunc.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjhhubh)}(hAn example is given below::h]hAn example is given below:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjhhubh literal_block)}(h/* Disables missing prototype warnings */ __bpf_kfunc_start_defs(); __bpf_kfunc struct task_struct *bpf_find_get_task_by_vpid(pid_t nr) { return find_get_task_by_vpid(nr); } __bpf_kfunc_end_defs();h]h/* Disables missing prototype warnings */ __bpf_kfunc_start_defs(); __bpf_kfunc struct task_struct *bpf_find_get_task_by_vpid(pid_t nr) { return find_get_task_by_vpid(nr); } __bpf_kfunc_end_defs();}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK'hjhhubh)}(hA wrapper kfunc is often needed when we need to annotate parameters of the kfunc. Otherwise one may directly make the kfunc visible to the BPF program by registering it with the BPF subsystem. See :ref:`BPF_kfunc_nodef`.h](hA wrapper kfunc is often needed when we need to annotate parameters of the kfunc. Otherwise one may directly make the kfunc visible to the BPF program by registering it with the BPF subsystem. See }(hjhhhNhNubh)}(h:ref:`BPF_kfunc_nodef`h]j )}(hjh]hBPF_kfunc_nodef}(hjhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&]refdocj# refdomainjreftyperef refexplicitrefwarnj)bpf_kfunc_nodefuh1hhhhK1hjubh.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK1hjhhubeh}(h]creating-a-wrapper-kfuncah ]h"]2.1 creating a wrapper kfuncah$]h&]uh1hhj=hhhhhKubh)}(hhh](h)}(h2.2 kfunc Parametersh]h2.2 kfunc Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK6ubh)}(hX%All kfuncs now require trusted arguments by default. This means that all pointer arguments must be valid, and all pointers to BTF objects must be passed in their unmodified form (at a zero offset, and without having been obtained from walking another pointer, with exceptions described below).h]hX%All kfuncs now require trusted arguments by default. This means that all pointer arguments must be valid, and all pointers to BTF objects must be passed in their unmodified form (at a zero offset, and without having been obtained from walking another pointer, with exceptions described below).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hjhhubh)}(hQThere are two types of pointers to kernel objects which are considered "trusted":h]hUThere are two types of pointers to kernel objects which are considered “trusted”:}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjhhubhenumerated_list)}(hhh](h list_item)}(hIPointers which are passed as tracepoint or struct_ops callback arguments.h]h)}(hj;h]hIPointers which are passed as tracepoint or struct_ops callback arguments.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK?hj9ubah}(h]h ]h"]h$]h&]uh1j7hj4hhhhhNubj8)}(h6Pointers which were returned from a KF_ACQUIRE kfunc. h]h)}(h5Pointers which were returned from a KF_ACQUIRE kfunc.h]h5Pointers which were returned from a KF_ACQUIRE kfunc.}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK@hjPubah}(h]h ]h"]h$]h&]uh1j7hj4hhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1j2hjhhhhhK?ubh)}(hpPointers to non-BTF objects (e.g. scalar pointers) may also be passed to kfuncs, and may have a non-zero offset.h]hpPointers to non-BTF objects (e.g. scalar pointers) may also be passed to kfuncs, and may have a non-zero offset.}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKBhjhhubh)}(htThe definition of "valid" pointers is subject to change at any time, and has absolutely no ABI stability guarantees.h]hxThe definition of “valid” pointers is subject to change at any time, and has absolutely no ABI stability guarantees.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKEhjhhubh)}(hXMAs mentioned above, a nested pointer obtained from walking a trusted pointer is no longer trusted, with one exception. If a struct type has a field that is guaranteed to be valid (trusted or rcu, as in KF_RCU description below) as long as its parent pointer is valid, the following macros can be used to express that to the verifier:h]hXMAs mentioned above, a nested pointer obtained from walking a trusted pointer is no longer trusted, with one exception. If a struct type has a field that is guaranteed to be valid (trusted or rcu, as in KF_RCU description below) as long as its parent pointer is valid, the following macros can be used to express that to the verifier:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKHhjhhubh bullet_list)}(hhh](j8)}(h``BTF_TYPE_SAFE_TRUSTED``h]h)}(hjh]hliteral)}(hjh]hBTF_TYPE_SAFE_TRUSTED}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1j7hjhhhhhNubj8)}(h``BTF_TYPE_SAFE_RCU``h]h)}(hjh]j)}(hjh]hBTF_TYPE_SAFE_RCU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKOhjubah}(h]h ]h"]h$]h&]uh1j7hjhhhhhNubj8)}(h``BTF_TYPE_SAFE_RCU_OR_NULL`` h]h)}(h``BTF_TYPE_SAFE_RCU_OR_NULL``h]j)}(hjh]hBTF_TYPE_SAFE_RCU_OR_NULL}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhhhKPhjubah}(h]h ]h"]h$]h&]uh1j7hjhhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhKNhjhhubh)}(h For example,h]h For example,}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjhhubj)}(hBBTF_TYPE_SAFE_TRUSTED(struct socket) { struct sock *sk; };h]hBBTF_TYPE_SAFE_TRUSTED(struct socket) { struct sock *sk; };}hjsbah}(h]h ]h"]h$]h&]hhƌforcelanguagechighlight_args}uh1jhhhKThjhhubh)}(horh]hor}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKZhjhhubj)}(hBTF_TYPE_SAFE_RCU(struct task_struct) { const cpumask_t *cpus_ptr; struct css_set __rcu *cgroups; struct task_struct __rcu *real_parent; struct task_struct *group_leader; };h]hBTF_TYPE_SAFE_RCU(struct task_struct) { const cpumask_t *cpus_ptr; struct css_set __rcu *cgroups; struct task_struct __rcu *real_parent; struct task_struct *group_leader; };}hj<sbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhK\hjhhubh)}(hIn other words, you must:h]hIn other words, you must:}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKehjhhubj3)}(hhh](j8)}(hhhhhhM.ubh)}(hThe KF_SLEEPABLE flag is used for kfuncs that may sleep. Such kfuncs can only be called by sleepable BPF programs (BPF_F_SLEEPABLE).h]hThe KF_SLEEPABLE flag is used for kfuncs that may sleep. Such kfuncs can only be called by sleepable BPF programs (BPF_F_SLEEPABLE).}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM0hj>hhubeh}(h]kf-sleepable-flagah ]h"]2.5.4 kf_sleepable flagah$]h&]uh1hhj=hhhhhM.ubh)}(hhh](h)}(h2.5.5 KF_DESTRUCTIVE flagh]h2.5.5 KF_DESTRUCTIVE flag}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjehhhhhM4ubh)}(hX6The KF_DESTRUCTIVE flag is used to indicate functions calling which is destructive to the system. For example such a call can result in system rebooting or panicking. Due to this additional restrictions apply to these calls. At the moment they only require CAP_SYS_BOOT capability, but more can be added later.h]hX6The KF_DESTRUCTIVE flag is used to indicate functions calling which is destructive to the system. For example such a call can result in system rebooting or panicking. Due to this additional restrictions apply to these calls. At the moment they only require CAP_SYS_BOOT capability, but more can be added later.}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hjehhubeh}(h]kf-destructive-flagah ]h"]2.5.5 kf_destructive flagah$]h&]uh1hhj=hhhhhM4ubh)}(hhh](h)}(h2.5.6 KF_RCU flagh]h2.5.6 KF_RCU flag}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM=ubh)}(hX0The KF_RCU flag allows kfuncs to opt out of the default trusted args requirement and accept RCU pointers with weaker guarantees. The kfuncs marked with KF_RCU expect either PTR_TRUSTED or MEM_RCU arguments. The verifier guarantees that the objects are valid and there is no use-after-free. The pointers are not NULL, but the object's refcount could have reached zero. The kfuncs need to consider doing refcnt != 0 check, especially when returning a KF_ACQUIRE pointer. Note as well that a KF_ACQUIRE kfunc that is KF_RCU should very likely also be KF_RET_NULL.h]hX2The KF_RCU flag allows kfuncs to opt out of the default trusted args requirement and accept RCU pointers with weaker guarantees. The kfuncs marked with KF_RCU expect either PTR_TRUSTED or MEM_RCU arguments. The verifier guarantees that the objects are valid and there is no use-after-free. The pointers are not NULL, but the object’s refcount could have reached zero. The kfuncs need to consider doing refcnt != 0 check, especially when returning a KF_ACQUIRE pointer. Note as well that a KF_ACQUIRE kfunc that is KF_RCU should very likely also be KF_RET_NULL.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hjhhubeh}(h] kf-rcu-flagah ]h"]2.5.6 kf_rcu flagah$]h&]uh1hhj=hhhhhM=ubh)}(hhh](h)}(h2.5.7 KF_RCU_PROTECTED flagh]h2.5.7 KF_RCU_PROTECTED flag}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMIubh)}(hThe KF_RCU_PROTECTED flag is used to indicate that the kfunc must be invoked in an RCU critical section. This is assumed by default in non-sleepable programs, and must be explicitly ensured by calling ``bpf_rcu_read_lock`` for sleepable ones.h](hThe KF_RCU_PROTECTED flag is used to indicate that the kfunc must be invoked in an RCU critical section. This is assumed by default in non-sleepable programs, and must be explicitly ensured by calling }(hjhhhNhNubj)}(h``bpf_rcu_read_lock``h]hbpf_rcu_read_lock}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh for sleepable ones.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMKhjhhubh)}(hIf the kfunc returns a pointer value, this flag also enforces that the returned pointer is RCU protected, and can only be used while the RCU critical section is active.h]hIf the kfunc returns a pointer value, this flag also enforces that the returned pointer is RCU protected, and can only be used while the RCU critical section is active.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMPhjhhubh)}(hX#The flag is distinct from the ``KF_RCU`` flag, which only ensures that its arguments are at least RCU protected pointers. This may transitively imply that RCU protection is ensured, but it does not work in cases of kfuncs which require RCU protection but do not take RCU protected arguments.h](hThe flag is distinct from the }(hjhhhNhNubj)}(h ``KF_RCU``h]hKF_RCU}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh flag, which only ensures that its arguments are at least RCU protected pointers. This may transitively imply that RCU protection is ensured, but it does not work in cases of kfuncs which require RCU protection but do not take RCU protected arguments.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMThjhhubh)}(h.. _KF_deprecated_flag:h]h}(h]h ]h"]h$]h&]hԌkf-deprecated-flaguh1hhMYhjhhhhubeh}(h]kf-rcu-protected-flagah ]h"]2.5.7 kf_rcu_protected flagah$]h&]uh1hhj=hhhhhMIubh)}(hhh](h)}(h2.5.8 KF_DEPRECATED flagh]h2.5.8 KF_DEPRECATED flag}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%hhhhhM\ubh)}(hXThe KF_DEPRECATED flag is used for kfuncs which are scheduled to be changed or removed in a subsequent kernel release. A kfunc that is marked with KF_DEPRECATED should also have any relevant information captured in its kernel doc. Such information typically includes the kfunc's expected remaining lifespan, a recommendation for new functionality that can replace it if any is available, and possibly a rationale for why it is being removed.h]hXThe KF_DEPRECATED flag is used for kfuncs which are scheduled to be changed or removed in a subsequent kernel release. A kfunc that is marked with KF_DEPRECATED should also have any relevant information captured in its kernel doc. Such information typically includes the kfunc’s expected remaining lifespan, a recommendation for new functionality that can replace it if any is available, and possibly a rationale for why it is being removed.}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM^hj%hhubh)}(hXGNote that while on some occasions, a KF_DEPRECATED kfunc may continue to be supported and have its KF_DEPRECATED flag removed, it is likely to be far more difficult to remove a KF_DEPRECATED flag after it's been added than it is to prevent it from being added in the first place. As described in :ref:`BPF_kfunc_lifecycle_expectations`, users that rely on specific kfuncs are encouraged to make their use-cases known as early as possible, and participate in upstream discussions regarding whether to keep, change, deprecate, or remove those kfuncs if and when such discussions occur.h](hX*Note that while on some occasions, a KF_DEPRECATED kfunc may continue to be supported and have its KF_DEPRECATED flag removed, it is likely to be far more difficult to remove a KF_DEPRECATED flag after it’s been added than it is to prevent it from being added in the first place. As described in }(hjDhhhNhNubh)}(h':ref:`BPF_kfunc_lifecycle_expectations`h]j )}(hjNh]h BPF_kfunc_lifecycle_expectations}(hjPhhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j hjLubah}(h]h ]h"]h$]h&]refdocj# refdomainjZreftyperef refexplicitrefwarnj) bpf_kfunc_lifecycle_expectationsuh1hhhhMfhjDubh, users that rely on specific kfuncs are encouraged to make their use-cases known as early as possible, and participate in upstream discussions regarding whether to keep, change, deprecate, or remove those kfuncs if and when such discussions occur.}(hjDhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMfhj%hhubeh}(h](jid1eh ]h"](2.5.8 kf_deprecated flagkf_deprecated_flageh$]h&]uh1hhj=hhhhhM\jT}j|jsjV}jjsubh)}(hhh](h)}(h2.5.9 KF_IMPLICIT_ARGS flagh]h2.5.9 KF_IMPLICIT_ARGS flag}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMpubh)}(hThe KF_IMPLICIT_ARGS flag is used to indicate that the BPF signature of the kfunc is different from it's kernel signature, and the values for implicit arguments are provided at load time by the verifier.h]hThe KF_IMPLICIT_ARGS flag is used to indicate that the BPF signature of the kfunc is different from it’s kernel signature, and the values for implicit arguments are provided at load time by the verifier.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMrhjhhubh)}(hjOnly arguments of specific types are implicit. Currently only ``struct bpf_prog_aux *`` type is supported.h](h>Only arguments of specific types are implicit. Currently only }(hjhhhNhNubj)}(h``struct bpf_prog_aux *``h]hstruct bpf_prog_aux *}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh type is supported.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMvhjhhubh)}(hA kfunc with KF_IMPLICIT_ARGS flag therefore has two types in BTF: one function matching the kernel declaration (with _impl suffix in the name by convention), and another matching the intended BPF API.h]hA kfunc with KF_IMPLICIT_ARGS flag therefore has two types in BTF: one function matching the kernel declaration (with _impl suffix in the name by convention), and another matching the intended BPF API.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMyhjhhubh)}(huVerifier only allows calls to the non-_impl version of a kfunc, that uses a signature without the implicit arguments.h]huVerifier only allows calls to the non-_impl version of a kfunc, that uses a signature without the implicit arguments.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM}hjhhubh)}(hExample declaration:h]hExample declaration:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hX__bpf_kfunc int bpf_task_work_schedule_signal(struct task_struct *task, struct bpf_task_work *tw, void *map__map, bpf_task_work_callback_t callback, struct bpf_prog_aux *aux) { ... }h]hX__bpf_kfunc int bpf_task_work_schedule_signal(struct task_struct *task, struct bpf_task_work *tw, void *map__map, bpf_task_work_callback_t callback, struct bpf_prog_aux *aux) { ... }}hjsbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMhjhhubh)}(hExample usage in BPF program:h]hExample usage in BPF program:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj)}(hy/* note that the last argument is omitted */ bpf_task_work_schedule_signal(task, &work->tw, &arrmap, task_work_callback);h]hy/* note that the last argument is omitted */ bpf_task_work_schedule_signal(task, &work->tw, &arrmap, task_work_callback);}hj sbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMhjhhubeh}(h]kf-implicit-args-flagah ]h"]2.5.9 kf_implicit_args flagah$]h&]uh1hhj=hhhhhMpubh)}(hhh](h)}(h2.6 Registering the kfuncsh]h2.6 Registering the kfuncs}(hj! hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hOnce the kfunc is prepared for use, the final step to making it visible is registering it with the BPF subsystem. Registration is done per BPF program type. An example is shown below::h]hOnce the kfunc is prepared for use, the final step to making it visible is registering it with the BPF subsystem. Registration is done per BPF program type. An example is shown below:}(hj/ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj)}(hXBTF_KFUNCS_START(bpf_task_set) BTF_ID_FLAGS(func, bpf_get_task_pid, KF_ACQUIRE | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_put_pid, KF_RELEASE) BTF_KFUNCS_END(bpf_task_set) static const struct btf_kfunc_id_set bpf_task_kfunc_set = { .owner = THIS_MODULE, .set = &bpf_task_set, }; static int init_subsystem(void) { return register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &bpf_task_kfunc_set); } late_initcall(init_subsystem);h]hXBTF_KFUNCS_START(bpf_task_set) BTF_ID_FLAGS(func, bpf_get_task_pid, KF_ACQUIRE | KF_RET_NULL) BTF_ID_FLAGS(func, bpf_put_pid, KF_RELEASE) BTF_KFUNCS_END(bpf_task_set) static const struct btf_kfunc_id_set bpf_task_kfunc_set = { .owner = THIS_MODULE, .set = &bpf_task_set, }; static int init_subsystem(void) { return register_btf_kfunc_id_set(BPF_PROG_TYPE_TRACING, &bpf_task_kfunc_set); } late_initcall(init_subsystem);}hj= sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj hhubeh}(h]registering-the-kfuncsah ]h"]2.6 registering the kfuncsah$]h&]uh1hhj=hhhhhMubh)}(hhh](h)}(h,2.7 Specifying no-cast aliases with ___inith]h,2.7 Specifying no-cast aliases with ___init}(hjV hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjS hhhhhMubh)}(hX=The verifier will always enforce that the BTF type of a pointer passed to a kfunc by a BPF program, matches the type of pointer specified in the kfunc definition. The verifier, does, however, allow types that are equivalent according to the C standard to be passed to the same kfunc arg, even if their BTF_IDs differ.h]hX=The verifier will always enforce that the BTF type of a pointer passed to a kfunc by a BPF program, matches the type of pointer specified in the kfunc definition. The verifier, does, however, allow types that are equivalent according to the C standard to be passed to the same kfunc arg, even if their BTF_IDs differ.}(hjd hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjS hhubh)}(h/For example, for the following type definition:h]h/For example, for the following type definition:}(hjr hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjS hhubj)}(hLstruct bpf_cpumask { cpumask_t cpumask; refcount_t usage; };h]hLstruct bpf_cpumask { cpumask_t cpumask; refcount_t usage; };}hj sbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMhjS hhubh)}(hXThe verifier would allow a ``struct bpf_cpumask *`` to be passed to a kfunc taking a ``cpumask_t *`` (which is a typedef of ``struct cpumask *``). For instance, both ``struct cpumask *`` and ``struct bpf_cpmuask *`` can be passed to bpf_cpumask_test_cpu().h](hThe verifier would allow a }(hj hhhNhNubj)}(h``struct bpf_cpumask *``h]hstruct bpf_cpumask *}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh" to be passed to a kfunc taking a }(hj hhhNhNubj)}(h``cpumask_t *``h]h cpumask_t *}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh (which is a typedef of }(hj hhhNhNubj)}(h``struct cpumask *``h]hstruct cpumask *}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh). For instance, both }(hj hhhNhNubj)}(h``struct cpumask *``h]hstruct cpumask *}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh and }(hj hhhNhNubj)}(h``struct bpf_cpmuask *``h]hstruct bpf_cpmuask *}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh) can be passed to bpf_cpumask_test_cpu().}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjS hhubh)}(hiIn some cases, this type-aliasing behavior is not desired. ``struct nf_conn___init`` is one such example:h](h;In some cases, this type-aliasing behavior is not desired. }(hj hhhNhNubj)}(h``struct nf_conn___init``h]hstruct nf_conn___init}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh is one such example:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjS hhubj)}(h5struct nf_conn___init { struct nf_conn ct; };h]h5struct nf_conn___init { struct nf_conn ct; };}hj sbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMhjS hhubh)}(hXThe C standard would consider these types to be equivalent, but it would not always be safe to pass either type to a trusted kfunc. ``struct nf_conn___init`` represents an allocated ``struct nf_conn`` object that has *not yet been initialized*, so it would therefore be unsafe to pass a ``struct nf_conn___init *`` to a kfunc that's expecting a fully initialized ``struct nf_conn *`` (e.g. ``bpf_ct_change_timeout()``).h](hThe C standard would consider these types to be equivalent, but it would not always be safe to pass either type to a trusted kfunc. }(hj& hhhNhNubj)}(h``struct nf_conn___init``h]hstruct nf_conn___init}(hj. hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj& ubh represents an allocated }(hj& hhhNhNubj)}(h``struct nf_conn``h]hstruct nf_conn}(hj@ hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj& ubh object that has }(hj& hhhNhNubhemphasis)}(h*not yet been initialized*h]hnot yet been initialized}(hjT hhhNhNubah}(h]h ]h"]h$]h&]uh1jR hj& ubh,, so it would therefore be unsafe to pass a }(hj& hhhNhNubj)}(h``struct nf_conn___init *``h]hstruct nf_conn___init *}(hjf hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj& ubh3 to a kfunc that’s expecting a fully initialized }(hj& hhhNhNubj)}(h``struct nf_conn *``h]hstruct nf_conn *}(hjx hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj& ubh (e.g. }(hj& hhhNhNubj)}(h``bpf_ct_change_timeout()``h]hbpf_ct_change_timeout()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj& ubh).}(hj& hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjS hhubh)}(hIn order to accommodate such requirements, the verifier will enforce strict PTR_TO_BTF_ID type matching if two types have the exact same name, with one being suffixed with ``___init``.h](hIn order to accommodate such requirements, the verifier will enforce strict PTR_TO_BTF_ID type matching if two types have the exact same name, with one being suffixed with }(hj hhhNhNubj)}(h ``___init``h]h___init}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjS hhubh)}(h%.. _BPF_kfunc_lifecycle_expectations:h]h}(h]h ]h"]h$]h&]hԌ bpf-kfunc-lifecycle-expectationsuh1hhMhjS hhhhubeh}(h]$specifying-no-cast-aliases-with-initah ]h"]+2.7 specifying no-cast aliases with ___initah$]h&]uh1hhj=hhhhhMubeh}(h]defining-a-kfuncah ]h"]2. defining a kfuncah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h3. kfunc lifecycle expectationsh]h3. kfunc lifecycle expectations}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMubh)}(hXMkfuncs provide a kernel <-> kernel API, and thus are not bound by any of the strict stability restrictions associated with kernel <-> user UAPIs. This means they can be thought of as similar to EXPORT_SYMBOL_GPL, and can therefore be modified or removed by a maintainer of the subsystem they're defined in when it's deemed necessary.h]hXQkfuncs provide a kernel <-> kernel API, and thus are not bound by any of the strict stability restrictions associated with kernel <-> user UAPIs. This means they can be thought of as similar to EXPORT_SYMBOL_GPL, and can therefore be modified or removed by a maintainer of the subsystem they’re defined in when it’s deemed necessary.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hXLike any other change to the kernel, maintainers will not change or remove a kfunc without having a reasonable justification. Whether or not they'll choose to change a kfunc will ultimately depend on a variety of factors, such as how widely used the kfunc is, how long the kfunc has been in the kernel, whether an alternative kfunc exists, what the norm is in terms of stability for the subsystem in question, and of course what the technical cost is of continuing to support the kfunc.h]hXLike any other change to the kernel, maintainers will not change or remove a kfunc without having a reasonable justification. Whether or not they’ll choose to change a kfunc will ultimately depend on a variety of factors, such as how widely used the kfunc is, how long the kfunc has been in the kernel, whether an alternative kfunc exists, what the norm is in terms of stability for the subsystem in question, and of course what the technical cost is of continuing to support the kfunc.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(h'There are several implications of this:h]h'There are several implications of this:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubj3)}(hhh](j8)}(hX<kfuncs that are widely used or have been in the kernel for a long time will be more difficult to justify being changed or removed by a maintainer. In other words, kfuncs that are known to have a lot of users and provide significant value provide stronger incentives for maintainers to invest the time and complexity in supporting them. It is therefore important for developers that are using kfuncs in their BPF programs to communicate and explain how and why those kfuncs are being used, and to participate in discussions regarding those kfuncs when they occur upstream. h]h)}(hX;kfuncs that are widely used or have been in the kernel for a long time will be more difficult to justify being changed or removed by a maintainer. In other words, kfuncs that are known to have a lot of users and provide significant value provide stronger incentives for maintainers to invest the time and complexity in supporting them. It is therefore important for developers that are using kfuncs in their BPF programs to communicate and explain how and why those kfuncs are being used, and to participate in discussions regarding those kfuncs when they occur upstream.h]hX;kfuncs that are widely used or have been in the kernel for a long time will be more difficult to justify being changed or removed by a maintainer. In other words, kfuncs that are known to have a lot of users and provide significant value provide stronger incentives for maintainers to invest the time and complexity in supporting them. It is therefore important for developers that are using kfuncs in their BPF programs to communicate and explain how and why those kfuncs are being used, and to participate in discussions regarding those kfuncs when they occur upstream.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubj8)}(hXUnlike regular kernel symbols marked with EXPORT_SYMBOL_GPL, BPF programs that call kfuncs are generally not part of the kernel tree. This means that refactoring cannot typically change callers in-place when a kfunc changes, as is done for e.g. an upstreamed driver being updated in place when a kernel symbol is changed. Unlike with regular kernel symbols, this is expected behavior for BPF symbols, and out-of-tree BPF programs that use kfuncs should be considered relevant to discussions and decisions around modifying and removing those kfuncs. The BPF community will take an active role in participating in upstream discussions when necessary to ensure that the perspectives of such users are taken into account. h](h)}(hXAUnlike regular kernel symbols marked with EXPORT_SYMBOL_GPL, BPF programs that call kfuncs are generally not part of the kernel tree. This means that refactoring cannot typically change callers in-place when a kfunc changes, as is done for e.g. an upstreamed driver being updated in place when a kernel symbol is changed.h]hXAUnlike regular kernel symbols marked with EXPORT_SYMBOL_GPL, BPF programs that call kfuncs are generally not part of the kernel tree. This means that refactoring cannot typically change callers in-place when a kfunc changes, as is done for e.g. an upstreamed driver being updated in place when a kernel symbol is changed.}(hj7 hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj3 ubh)}(hXUnlike with regular kernel symbols, this is expected behavior for BPF symbols, and out-of-tree BPF programs that use kfuncs should be considered relevant to discussions and decisions around modifying and removing those kfuncs. The BPF community will take an active role in participating in upstream discussions when necessary to ensure that the perspectives of such users are taken into account.h]hXUnlike with regular kernel symbols, this is expected behavior for BPF symbols, and out-of-tree BPF programs that use kfuncs should be considered relevant to discussions and decisions around modifying and removing those kfuncs. The BPF community will take an active role in participating in upstream discussions when necessary to ensure that the perspectives of such users are taken into account.}(hjE hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj3 ubeh}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubj8)}(hXA kfunc will never have any hard stability guarantees. BPF APIs cannot and will not ever hard-block a change in the kernel purely for stability reasons. That being said, kfuncs are features that are meant to solve problems and provide value to users. The decision of whether to change or remove a kfunc is a multivariate technical decision that is made on a case-by-case basis, and which is informed by data points such as those mentioned above. It is expected that a kfunc being removed or changed with no warning will not be a common occurrence or take place without sound justification, but it is a possibility that must be accepted if one is to use kfuncs. h]h)}(hXA kfunc will never have any hard stability guarantees. BPF APIs cannot and will not ever hard-block a change in the kernel purely for stability reasons. That being said, kfuncs are features that are meant to solve problems and provide value to users. The decision of whether to change or remove a kfunc is a multivariate technical decision that is made on a case-by-case basis, and which is informed by data points such as those mentioned above. It is expected that a kfunc being removed or changed with no warning will not be a common occurrence or take place without sound justification, but it is a possibility that must be accepted if one is to use kfuncs.h]hXA kfunc will never have any hard stability guarantees. BPF APIs cannot and will not ever hard-block a change in the kernel purely for stability reasons. That being said, kfuncs are features that are meant to solve problems and provide value to users. The decision of whether to change or remove a kfunc is a multivariate technical decision that is made on a case-by-case basis, and which is informed by data points such as those mentioned above. It is expected that a kfunc being removed or changed with no warning will not be a common occurrence or take place without sound justification, but it is a possibility that must be accepted if one is to use kfuncs.}(hj] hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjY ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubeh}(h]h ]h"]h$]h&]jn loweralphajphjq)uh1j2hj hhhhhMubh)}(hhh](h)}(h3.1 kfunc deprecationh]h3.1 kfunc deprecation}(hj| hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjy hhhhhMubh)}(hXAs described above, while sometimes a maintainer may find that a kfunc must be changed or removed immediately to accommodate some changes in their subsystem, usually kfuncs will be able to accommodate a longer and more measured deprecation process. For example, if a new kfunc comes along which provides superior functionality to an existing kfunc, the existing kfunc may be deprecated for some period of time to allow users to migrate their BPF programs to use the new one. Or, if a kfunc has no known users, a decision may be made to remove the kfunc (without providing an alternative API) after some deprecation period so as to provide users with a window to notify the kfunc maintainer if it turns out that the kfunc is actually being used.h]hXAs described above, while sometimes a maintainer may find that a kfunc must be changed or removed immediately to accommodate some changes in their subsystem, usually kfuncs will be able to accommodate a longer and more measured deprecation process. For example, if a new kfunc comes along which provides superior functionality to an existing kfunc, the existing kfunc may be deprecated for some period of time to allow users to migrate their BPF programs to use the new one. Or, if a kfunc has no known users, a decision may be made to remove the kfunc (without providing an alternative API) after some deprecation period so as to provide users with a window to notify the kfunc maintainer if it turns out that the kfunc is actually being used.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjy hhubh)}(hXIt's expected that the common case will be that kfuncs will go through a deprecation period rather than being changed or removed without warning. As described in :ref:`KF_deprecated_flag`, the kfunc framework provides the KF_DEPRECATED flag to kfunc developers to signal to users that a kfunc has been deprecated. Once a kfunc has been marked with KF_DEPRECATED, the following procedure is followed for removal:h](hIt’s expected that the common case will be that kfuncs will go through a deprecation period rather than being changed or removed without warning. As described in }(hj hhhNhNubh)}(h:ref:`KF_deprecated_flag`h]j )}(hj h]hKF_deprecated_flag}(hj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]refdocj# refdomainj reftyperef refexplicitrefwarnj)kf_deprecated_flaguh1hhhhMhj ubh, the kfunc framework provides the KF_DEPRECATED flag to kfunc developers to signal to users that a kfunc has been deprecated. Once a kfunc has been marked with KF_DEPRECATED, the following procedure is followed for removal:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjy hhubj3)}(hhh](j8)}(hXHAny relevant information for deprecated kfuncs is documented in the kfunc's kernel docs. This documentation will typically include the kfunc's expected remaining lifespan, a recommendation for new functionality that can replace the usage of the deprecated function (or an explanation as to why no such replacement exists), etc. h]h)}(hXGAny relevant information for deprecated kfuncs is documented in the kfunc's kernel docs. This documentation will typically include the kfunc's expected remaining lifespan, a recommendation for new functionality that can replace the usage of the deprecated function (or an explanation as to why no such replacement exists), etc.h]hXKAny relevant information for deprecated kfuncs is documented in the kfunc’s kernel docs. This documentation will typically include the kfunc’s expected remaining lifespan, a recommendation for new functionality that can replace the usage of the deprecated function (or an explanation as to why no such replacement exists), etc.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubj8)}(hX!The deprecated kfunc is kept in the kernel for some period of time after it was first marked as deprecated. This time period will be chosen on a case-by-case basis, and will typically depend on how widespread the use of the kfunc is, how long it has been in the kernel, and how hard it is to move to alternatives. This deprecation time period is "best effort", and as described :ref:`above`, circumstances may sometimes dictate that the kfunc be removed before the full intended deprecation period has elapsed. h]h)}(hX The deprecated kfunc is kept in the kernel for some period of time after it was first marked as deprecated. This time period will be chosen on a case-by-case basis, and will typically depend on how widespread the use of the kfunc is, how long it has been in the kernel, and how hard it is to move to alternatives. This deprecation time period is "best effort", and as described :ref:`above`, circumstances may sometimes dictate that the kfunc be removed before the full intended deprecation period has elapsed.h](hX~The deprecated kfunc is kept in the kernel for some period of time after it was first marked as deprecated. This time period will be chosen on a case-by-case basis, and will typically depend on how widespread the use of the kfunc is, how long it has been in the kernel, and how hard it is to move to alternatives. This deprecation time period is “best effort”, and as described }(hj hhhNhNubh)}(h.:ref:`above`h]j )}(hj h]habove}(hj hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]refdocj# refdomainj reftyperef refexplicitrefwarnj) bpf_kfunc_lifecycle_expectationsuh1hhhhM"hj ubhx, circumstances may sometimes dictate that the kfunc be removed before the full intended deprecation period has elapsed.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM"hj ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubj8)}(hAfter the deprecation period the kfunc will be removed. At this point, BPF programs calling the kfunc will be rejected by the verifier. h]h)}(hAfter the deprecation period the kfunc will be removed. At this point, BPF programs calling the kfunc will be rejected by the verifier.h]hAfter the deprecation period the kfunc will be removed. At this point, BPF programs calling the kfunc will be rejected by the verifier.}(hj% hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM+hj! ubah}(h]h ]h"]h$]h&]uh1j7hj hhhhhNubeh}(h]h ]h"]h$]h&]jnjojphjqjruh1j2hjy hhhhhMubeh}(h]kfunc-deprecationah ]h"]3.1 kfunc deprecationah$]h&]uh1hhj hhhhhMubeh}(h](kfunc-lifecycle-expectationsj eh ]h"](3. kfunc lifecycle expectations bpf_kfunc_lifecycle_expectationseh$]h&]uh1hhhhhhhhMjT}jM j sjV}j j subh)}(hhh](h)}(h4. Core kfuncsh]h4. Core kfuncs}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjR hhhhhM/ubh)}(hThe BPF subsystem provides a number of "core" kfuncs that are potentially applicable to a wide variety of different possible use cases and programs. Those kfuncs are documented here.h]hThe BPF subsystem provides a number of “core” kfuncs that are potentially applicable to a wide variety of different possible use cases and programs. Those kfuncs are documented here.}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM1hjR hhubh)}(hhh](h)}(h4.1 struct task_struct * kfuncsh]h4.1 struct task_struct * kfuncs}(hjt hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjq hhhhhM6ubh)}(h]There are a number of kfuncs that allow ``struct task_struct *`` objects to be used as kptrs:h](h(There are a number of kfuncs that allow }(hj hhhNhNubj)}(h``struct task_struct *``h]hstruct task_struct *}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj ubh objects to be used as kptrs:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM8hjq hhubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](singlebpf_task_acquire (C function)c.bpf_task_acquirehNtauh1j hjq hhhNhNubhdesc)}(hhh](hdesc_signature)}(hI__bpf_kfunc struct task_struct * bpf_task_acquire (struct task_struct *p)h]hdesc_signature_line)}(hG__bpf_kfunc struct task_struct *bpf_task_acquire(struct task_struct *p)h](h __bpf_kfunc}(hj hhhNhNubhdesc_sig_space)}(h h]h }(hj hhhNhNubah}(h]h ]wah"]h$]h&]uh1j hj hhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM ubhdesc_sig_keyword)}(hstructh]hstruct}(hj hhhNhNubah}(h]h ]kah"]h$]h&]uh1j hj hhhj hM ubj )}(h h]h }(hj hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj hhhj hM ubh)}(hhh]h desc_sig_name)}(h task_structh]h task_struct}(hj hhhNhNubah}(h]h ]nah"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&] refdomainj+reftype identifier reftargetj modnameN classnameN c:parent_keysphinx.domains.c LookupKey)}data]j ASTIdentifier)}j bpf_task_acquiresbc.bpf_task_acquireasbuh1hhj hhhj hM ubj )}(h h]h }(hj( hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj hhhj hM ubhdesc_sig_punctuation)}(hj h]h*}(hj8 hhhNhNubah}(h]h ]pah"]h$]h&]uh1j6 hj hhhj hM ubh desc_name)}(hbpf_task_acquireh]j )}(hj% h]hbpf_task_acquire}(hjL hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjH ubah}(h]h ](sig-namedescnameeh"]h$]h&]hhuh1jF hj hhhj hM ubhdesc_parameterlist)}(h(struct task_struct *p)h]hdesc_parameter)}(hstruct task_struct *ph](j )}(hj h]hstruct}(hjm hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hji ubj )}(h h]h }(hjz hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hji ubh)}(hhh]j )}(h task_structh]h task_struct}(hj hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetj modnameN classnameNj j )}j ]j# c.bpf_task_acquireasbuh1hhji ubj )}(h h]h }(hj hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hji ubj7 )}(hj h]h*}(hj hhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hji ubj )}(hjB h]hp}(hj hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hji ubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hjc ubah}(h]h ]h"]h$]h&]hhuh1ja hj hhhj hM ubeh}(h]h ]h"]h$]h&]hhƌ add_permalinkuh1j sphinx_line_type declaratorhj hhhj hM ubah}(h]j ah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1j hj hM hj hhubh desc_content)}(hhh]h)}(hAcquire a reference to a task. A task acquired by this kfunc which is not stored in a map as a kptr, must be released by calling bpf_task_release().h]hAcquire a reference to a task. A task acquired by this kfunc which is not stored in a map as a kptr, must be released by calling bpf_task_release().}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hj hhubah}(h]h ]h"]h$]h&]uh1j hj hhhj hM ubeh}(h]h ](j+functioneh"]h$]h&]domainj+objtypejdesctypejnoindex noindexentrynocontentsentryuh1j hhhjq hNhNubh container)}(h\**Parameters** ``struct task_struct *p`` The task on which a reference is being acquired.h](h)}(h**Parameters**h]hstrong)}(hj!h]h Parameters}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1j#hjubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hjubhdefinition_list)}(hhh]hdefinition_list_item)}(hJ``struct task_struct *p`` The task on which a reference is being acquired.h](hterm)}(h``struct task_struct *p``h]j)}(hjHh]hstruct task_struct *p}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjFubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hj@ubh definition)}(hhh]h)}(h0The task on which a reference is being acquired.h]h0The task on which a reference is being acquired.}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hj`ubah}(h]h ]h"]h$]h&]uh1j^hj@ubeh}(h]h ]h"]h$]h&]uh1j>hj]hM hj;ubah}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjq hhhNhNubj )}(hhh]h}(h]h ]h"]h$]h&]entries](j bpf_task_release (C function)c.bpf_task_releasehNtauh1j hjq hhhNhNubj )}(hhh](j )}(h9__bpf_kfunc void bpf_task_release (struct task_struct *p)h]j )}(h8__bpf_kfunc void bpf_task_release(struct task_struct *p)h](h __bpf_kfunc}(hjhhhNhNubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM ubhdesc_sig_keyword_type)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]ktah"]h$]h&]uh1jhjhhhjhM ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubjG )}(hbpf_task_releaseh]j )}(hbpf_task_releaseh]hbpf_task_release}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ](j\ j] eh"]h$]h&]hhuh1jF hjhhhjhM ubjb )}(h(struct task_struct *p)h]jh )}(hstruct task_struct *ph](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubh)}(hhh]j )}(h task_structh]h task_struct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]j" )}j jsbc.bpf_task_releaseasbuh1hhjubj )}(h h]h }(hj4hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubj7 )}(hj h]h*}(hjBhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjubj )}(hjB h]hp}(hjOhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hjubah}(h]h ]h"]h$]h&]hhuh1ja hjhhhjhM ubeh}(h]h ]h"]h$]h&]hhj uh1j j j hjhhhjhM ubah}(h]jah ](j j eh"]h$]h&]j j )j huh1j hjhM hjhhubj )}(hhh]h)}(h)Release the reference acquired on a task.h]h)Release the reference acquired on a task.}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hjuhhubah}(h]h ]h"]h$]h&]uh1j hjhhhjhM ubeh}(h]h ](j+functioneh"]h$]h&]jj+jjjjjjjuh1j hhhjq hNhNubj)}(h\**Parameters** ``struct task_struct *p`` The task on which a reference is being released.h](h)}(h**Parameters**h]j$)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j#hjubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hjubj:)}(hhh]j?)}(hJ``struct task_struct *p`` The task on which a reference is being released.h](jE)}(h``struct task_struct *p``h]j)}(hjh]hstruct task_struct *p}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hjubj_)}(hhh]h)}(h0The task on which a reference is being released.h]h0The task on which a reference is being released.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:571: ./kernel/bpf/helpers.chM hjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1j>hjhM hjubah}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjq hhhNhNubh)}(hThese kfuncs are useful when you want to acquire or release a reference to a ``struct task_struct *`` that was passed as e.g. a tracepoint arg, or a struct_ops callback arg. For example:h](hMThese kfuncs are useful when you want to acquire or release a reference to a }(hjhhhNhNubj)}(h``struct task_struct *``h]hstruct task_struct *}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhU that was passed as e.g. a tracepoint arg, or a struct_ops callback arg. For example:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM>hjq hhubj)}(hX/** * A trivial example tracepoint program that shows how to * acquire and release a struct task_struct * pointer. */ SEC("tp_btf/task_newtask") int BPF_PROG(task_acquire_release_example, struct task_struct *task, u64 clone_flags) { struct task_struct *acquired; acquired = bpf_task_acquire(task); if (acquired) /* * In a typical program you'd do something like store * the task in a map, and the map will automatically * release it later. Here, we release it manually. */ bpf_task_release(acquired); return 0; }h]hX/** * A trivial example tracepoint program that shows how to * acquire and release a struct task_struct * pointer. */ SEC("tp_btf/task_newtask") int BPF_PROG(task_acquire_release_example, struct task_struct *task, u64 clone_flags) { struct task_struct *acquired; acquired = bpf_task_acquire(task); if (acquired) /* * In a typical program you'd do something like store * the task in a map, and the map will automatically * release it later. Here, we release it manually. */ bpf_task_release(acquired); return 0; }}hjsbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMBhjq hhubh)}(hReferences acquired on ``struct task_struct *`` objects are RCU protected. Therefore, when in an RCU read region, you can obtain a pointer to a task embedded in a map value without having to acquire a reference:h](hReferences acquired on }(hj)hhhNhNubj)}(h``struct task_struct *``h]hstruct task_struct *}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj)ubh objects are RCU protected. Therefore, when in an RCU read region, you can obtain a pointer to a task embedded in a map value without having to acquire a reference:}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMYhjq hhubj)}(hX#define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8))) private(TASK) static struct task_struct *global; /** * A trivial example showing how to access a task stored * in a map using RCU. */ SEC("tp_btf/task_newtask") int BPF_PROG(task_rcu_read_example, struct task_struct *task, u64 clone_flags) { struct task_struct *local_copy; bpf_rcu_read_lock(); local_copy = global; if (local_copy) /* * We could also pass local_copy to kfuncs or helper functions here, * as we're guaranteed that local_copy will be valid until we exit * the RCU read region below. */ bpf_printk("Global task %s is valid", local_copy->comm); else bpf_printk("No global task found"); bpf_rcu_read_unlock(); /* At this point we can no longer reference local_copy. */ return 0; }h]hX#define private(name) SEC(".data." #name) __hidden __attribute__((aligned(8))) private(TASK) static struct task_struct *global; /** * A trivial example showing how to access a task stored * in a map using RCU. */ SEC("tp_btf/task_newtask") int BPF_PROG(task_rcu_read_example, struct task_struct *task, u64 clone_flags) { struct task_struct *local_copy; bpf_rcu_read_lock(); local_copy = global; if (local_copy) /* * We could also pass local_copy to kfuncs or helper functions here, * as we're guaranteed that local_copy will be valid until we exit * the RCU read region below. */ bpf_printk("Global task %s is valid", local_copy->comm); else bpf_printk("No global task found"); bpf_rcu_read_unlock(); /* At this point we can no longer reference local_copy. */ return 0; }}hjIsbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhM]hjq hhubh transition)}(h----h]h}(h]h ]h"]h$]h&]uh1jXhhhM}hjq hhubh)}(hA BPF program can also look up a task from a pid. This can be useful if the caller doesn't have a trusted pointer to a ``struct task_struct *`` object that it can acquire a reference on with bpf_task_acquire().h](hyA BPF program can also look up a task from a pid. This can be useful if the caller doesn’t have a trusted pointer to a }(hjdhhhNhNubj)}(h``struct task_struct *``h]hstruct task_struct *}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjdubhC object that it can acquire a reference on with bpf_task_acquire().}(hjdhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjq hhubj )}(hhh]h}(h]h ]h"]h$]h&]entries](j bpf_task_from_pid (C function)c.bpf_task_from_pidhNtauh1j hjq hhhNhNubj )}(hhh](j )}(h<__bpf_kfunc struct task_struct * bpf_task_from_pid (s32 pid)h]j )}(h:__bpf_kfunc struct task_struct *bpf_task_from_pid(s32 pid)h](h __bpf_kfunc}(hjhhhNhNubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:643: ./kernel/bpf/helpers.chMG ubj )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhMG ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhMG ubh)}(hhh]j )}(h task_structh]h task_struct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]j" )}j bpf_task_from_pidsbc.bpf_task_from_pidasbuh1hhjhhhjhMG ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhMG ubj7 )}(hj h]h*}(hjhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjhhhjhMG ubjG )}(hbpf_task_from_pidh]j )}(hjh]hbpf_task_from_pid}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj ubah}(h]h ](j\ j] eh"]h$]h&]hhuh1jF hjhhhjhMG ubjb )}(h (s32 pid)h]jh )}(hs32 pidh](h)}(hhh]j )}(hs32h]hs32}(hj,hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj)ubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetj.modnameN classnameNj j )}j ]jc.bpf_task_from_pidasbuh1hhj%ubj )}(h h]h }(hjJhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj%ubj )}(hpidh]hpid}(hjXhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj%ubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hj!ubah}(h]h ]h"]h$]h&]hhuh1ja hjhhhjhMG ubeh}(h]h ]h"]h$]h&]hhj uh1j j j hjhhhjhMG ubah}(h]jah ](j j eh"]h$]h&]j j )j huh1j hjhMG hjhhubj )}(hhh]h)}(hFind a struct task_struct from its pid by looking it up in the root pid namespace idr. If a task is returned, it must either be stored in a map, or released with bpf_task_release().h]hFind a struct task_struct from its pid by looking it up in the root pid namespace idr. If a task is returned, it must either be stored in a map, or released with bpf_task_release().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:643: ./kernel/bpf/helpers.chMG hjhhubah}(h]h ]h"]h$]h&]uh1j hjhhhjhMG ubeh}(h]h ](j+functioneh"]h$]h&]jj+jjjjjjjuh1j hhhjq hNhNubj)}(hB**Parameters** ``s32 pid`` The pid of the task being looked up.h](h)}(h**Parameters**h]j$)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j#hjubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:643: ./kernel/bpf/helpers.chMK hjubj:)}(hhh]j?)}(h0``s32 pid`` The pid of the task being looked up.h](jE)}(h ``s32 pid``h]j)}(hjh]hs32 pid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:643: ./kernel/bpf/helpers.chMM hjubj_)}(hhh]h)}(h$The pid of the task being looked up.h]h$The pid of the task being looked up.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:643: ./kernel/bpf/helpers.chMJ hjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1j>hjhMM hjubah}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjq hhhNhNubh)}(h$Here is an example of it being used:h]h$Here is an example of it being used:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjq hhubj)}(hXSEC("tp_btf/task_newtask") int BPF_PROG(task_get_pid_example, struct task_struct *task, u64 clone_flags) { struct task_struct *lookup; lookup = bpf_task_from_pid(task->pid); if (!lookup) /* A task should always be found, as %task is a tracepoint arg. */ return -ENOENT; if (lookup->pid != task->pid) { /* bpf_task_from_pid() looks up the task via its * globally-unique pid from the init_pid_ns. Thus, * the pid of the lookup task should always be the * same as the input task. */ bpf_task_release(lookup); return -EINVAL; } /* bpf_task_from_pid() returns an acquired reference, * so it must be dropped before returning from the * tracepoint handler. */ bpf_task_release(lookup); return 0; }h]hXSEC("tp_btf/task_newtask") int BPF_PROG(task_get_pid_example, struct task_struct *task, u64 clone_flags) { struct task_struct *lookup; lookup = bpf_task_from_pid(task->pid); if (!lookup) /* A task should always be found, as %task is a tracepoint arg. */ return -ENOENT; if (lookup->pid != task->pid) { /* bpf_task_from_pid() looks up the task via its * globally-unique pid from the init_pid_ns. Thus, * the pid of the lookup task should always be the * same as the input task. */ bpf_task_release(lookup); return -EINVAL; } /* bpf_task_from_pid() returns an acquired reference, * so it must be dropped before returning from the * tracepoint handler. */ bpf_task_release(lookup); return 0; }}hjsbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMhjq hhubeh}(h]struct-task-struct-kfuncsah ]h"]4.1 struct task_struct * kfuncsah$]h&]uh1hhjR hhhhhM6ubh)}(hhh](h)}(h4.2 struct cgroup * kfuncsh]h4.2 struct cgroup * kfuncs}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj)hhhhhMubh)}(hD``struct cgroup *`` objects also have acquire and release functions:h](j)}(h``struct cgroup *``h]hstruct cgroup *}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj:ubh1 objects also have acquire and release functions:}(hj:hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj)hhubj )}(hhh]h}(h]h ]h"]h$]h&]entries](j bpf_cgroup_acquire (C function)c.bpf_cgroup_acquirehNtauh1j hj)hhhNhNubj )}(hhh](j )}(hD__bpf_kfunc struct cgroup * bpf_cgroup_acquire (struct cgroup *cgrp)h]j )}(hB__bpf_kfunc struct cgroup *bpf_cgroup_acquire(struct cgroup *cgrp)h](h __bpf_kfunc}(hjkhhhNhNubj )}(h h]h }(hjshhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjkhhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM ubj )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjkhhhjhM ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjkhhhjhM ubh)}(hhh]j )}(hcgrouph]hcgroup}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]j" )}j bpf_cgroup_acquiresbc.bpf_cgroup_acquireasbuh1hhjkhhhjhM ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjkhhhjhM ubj7 )}(hj h]h*}(hjhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjkhhhjhM ubjG )}(hbpf_cgroup_acquireh]j )}(hjh]hbpf_cgroup_acquire}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ](j\ j] eh"]h$]h&]hhuh1jF hjkhhhjhM ubjb )}(h(struct cgroup *cgrp)h]jh )}(hstruct cgroup *cgrph](j )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubh)}(hhh]j )}(hcgrouph]hcgroup}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]jc.bpf_cgroup_acquireasbuh1hhjubj )}(h h]h }(hj7hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubj7 )}(hj h]h*}(hjEhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjubj )}(hcgrph]hcgrp}(hjRhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hjubah}(h]h ]h"]h$]h&]hhuh1ja hjkhhhjhM ubeh}(h]h ]h"]h$]h&]hhj uh1j j j hjghhhjhM ubah}(h]jbah ](j j eh"]h$]h&]j j )j huh1j hjhM hjdhhubj )}(hhh]h)}(hAcquire a reference to a cgroup. A cgroup acquired by this kfunc which is not stored in a map as a kptr, must be released by calling bpf_cgroup_release().h]hAcquire a reference to a cgroup. A cgroup acquired by this kfunc which is not stored in a map as a kptr, must be released by calling bpf_cgroup_release().}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hjyhhubah}(h]h ]h"]h$]h&]uh1j hjdhhhjhM ubeh}(h]h ](j+functioneh"]h$]h&]jj+jjjjjjjuh1j hhhj)hNhNubj)}(h\**Parameters** ``struct cgroup *cgrp`` The cgroup on which a reference is being acquired.h](h)}(h**Parameters**h]j$)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j#hjubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hjubj:)}(hhh]j?)}(hJ``struct cgroup *cgrp`` The cgroup on which a reference is being acquired.h](jE)}(h``struct cgroup *cgrp``h]j)}(hjh]hstruct cgroup *cgrp}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hjubj_)}(hhh]h)}(h2The cgroup on which a reference is being acquired.h]h2The cgroup on which a reference is being acquired.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1j>hjhM hjubah}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj)hhhNhNubj )}(hhh]h}(h]h ]h"]h$]h&]entries](j bpf_cgroup_release (C function)c.bpf_cgroup_releasehNtauh1j hj)hhhNhNubj )}(hhh](j )}(h9__bpf_kfunc void bpf_cgroup_release (struct cgroup *cgrp)h]j )}(h8__bpf_kfunc void bpf_cgroup_release(struct cgroup *cgrp)h](h __bpf_kfunc}(hjhhhNhNubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM ubj)}(hvoidh]hvoid}(hj*hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhj)hM ubj )}(h h]h }(hj8hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhj)hM ubjG )}(hbpf_cgroup_releaseh]j )}(hbpf_cgroup_releaseh]hbpf_cgroup_release}(hjJhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjFubah}(h]h ](j\ j] eh"]h$]h&]hhuh1jF hjhhhj)hM ubjb )}(h(struct cgroup *cgrp)h]jh )}(hstruct cgroup *cgrph](j )}(hj h]hstruct}(hjfhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjbubj )}(h h]h }(hjshhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjbubh)}(hhh]j )}(hcgrouph]hcgroup}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]j" )}j jLsbc.bpf_cgroup_releaseasbuh1hhjbubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjbubj7 )}(hj h]h*}(hjhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjbubj )}(hcgrph]hcgrp}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjbubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hj^ubah}(h]h ]h"]h$]h&]hhuh1ja hjhhhj)hM ubeh}(h]h ]h"]h$]h&]hhj uh1j j j hjhhhj)hM ubah}(h]j ah ](j j eh"]h$]h&]j j )j huh1j hj)hM hj hhubj )}(hhh]h)}(hRelease the reference acquired on a cgroup. If this kfunc is invoked in an RCU read region, the cgroup is guaranteed to not be freed until the current grace period has ended, even if its refcount drops to 0.h]hRelease the reference acquired on a cgroup. If this kfunc is invoked in an RCU read region, the cgroup is guaranteed to not be freed until the current grace period has ended, even if its refcount drops to 0.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hjhhubah}(h]h ]h"]h$]h&]uh1j hj hhhj)hM ubeh}(h]h ](j+functioneh"]h$]h&]jj+jjjjjjjuh1j hhhj)hNhNubj)}(h\**Parameters** ``struct cgroup *cgrp`` The cgroup on which a reference is being released.h](h)}(h**Parameters**h]j$)}(hj h]h Parameters}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j#hj ubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hjubj:)}(hhh]j?)}(hJ``struct cgroup *cgrp`` The cgroup on which a reference is being released.h](jE)}(h``struct cgroup *cgrp``h]j)}(hj*h]hstruct cgroup *cgrp}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj(ubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hj$ubj_)}(hhh]h)}(h2The cgroup on which a reference is being released.h]h2The cgroup on which a reference is being released.}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:683: ./kernel/bpf/helpers.chM hj@ubah}(h]h ]h"]h$]h&]uh1j^hj$ubeh}(h]h ]h"]h$]h&]uh1j>hj?hM hj!ubah}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj)hhhNhNubh)}(hThese kfuncs are used in exactly the same manner as bpf_task_acquire() and bpf_task_release() respectively, so we won't provide examples for them.h]hThese kfuncs are used in exactly the same manner as bpf_task_acquire() and bpf_task_release() respectively, so we won’t provide examples for them.}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)hhubjY)}(h----h]h}(h]h ]h"]h$]h&]uh1jXhhhMhj)hhubh)}(hOther kfuncs available for interacting with ``struct cgroup *`` objects are bpf_cgroup_ancestor() and bpf_cgroup_from_id(), allowing callers to access the ancestor of a cgroup and find a cgroup by its ID, respectively. Both return a cgroup kptr.h](h,Other kfuncs available for interacting with }(hjhhhNhNubj)}(h``struct cgroup *``h]hstruct cgroup *}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh objects are bpf_cgroup_ancestor() and bpf_cgroup_from_id(), allowing callers to access the ancestor of a cgroup and find a cgroup by its ID, respectively. Both return a cgroup kptr.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj)hhubj )}(hhh]h}(h]h ]h"]h$]h&]entries](j bpf_cgroup_ancestor (C function)c.bpf_cgroup_ancestorhNtauh1j hj)hhhNhNubj )}(hhh](j )}(hP__bpf_kfunc struct cgroup * bpf_cgroup_ancestor (struct cgroup *cgrp, int level)h]j )}(hN__bpf_kfunc struct cgroup *bpf_cgroup_ancestor(struct cgroup *cgrp, int level)h](h __bpf_kfunc}(hjhhhNhNubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:696: ./kernel/bpf/helpers.chM ubj )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubh)}(hhh]j )}(hcgrouph]hcgroup}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]j" )}j bpf_cgroup_ancestorsbc.bpf_cgroup_ancestorasbuh1hhjhhhjhM ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubj7 )}(hj h]h*}(hjhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjhhhjhM ubjG )}(hbpf_cgroup_ancestorh]j )}(hj h]hbpf_cgroup_ancestor}(hj-hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj)ubah}(h]h ](j\ j] eh"]h$]h&]hhuh1jF hjhhhjhM ubjb )}(h (struct cgroup *cgrp, int level)h](jh )}(hstruct cgroup *cgrph](j )}(hj h]hstruct}(hjHhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjDubj )}(h h]h }(hjUhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjDubh)}(hhh]j )}(hcgrouph]hcgroup}(hjfhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjcubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjhmodnameN classnameNj j )}j ]j c.bpf_cgroup_ancestorasbuh1hhjDubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjDubj7 )}(hj h]h*}(hjhhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjDubj )}(hcgrph]hcgrp}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjDubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hj@ubjh )}(h int levelh](j)}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubj )}(hlevelh]hlevel}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hj@ubeh}(h]h ]h"]h$]h&]hhuh1ja hjhhhjhM ubeh}(h]h ]h"]h$]h&]hhj uh1j j j hjhhhjhM ubah}(h]jah ](j j eh"]h$]h&]j j )j huh1j hjhM hjhhubj )}(hhh]h)}(hPerform a lookup on an entry in a cgroup's ancestor array. A cgroup returned by this kfunc which is not subsequently stored in a map, must be released by calling bpf_cgroup_release().h]hPerform a lookup on an entry in a cgroup’s ancestor array. A cgroup returned by this kfunc which is not subsequently stored in a map, must be released by calling bpf_cgroup_release().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:696: ./kernel/bpf/helpers.chM hjhhubah}(h]h ]h"]h$]h&]uh1j hjhhhjhM ubeh}(h]h ](j+functioneh"]h$]h&]jj+jjjjjjjuh1j hhhj)hNhNubj)}(h**Parameters** ``struct cgroup *cgrp`` The cgroup for which we're performing a lookup. ``int level`` The level of ancestor to look up.h](h)}(h**Parameters**h]j$)}(hj h]h Parameters}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1j#hjubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:696: ./kernel/bpf/helpers.chM hjubj:)}(hhh](j?)}(hH``struct cgroup *cgrp`` The cgroup for which we're performing a lookup. h](jE)}(h``struct cgroup *cgrp``h]j)}(hj?h]hstruct cgroup *cgrp}(hjAhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj=ubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:696: ./kernel/bpf/helpers.chM hj9ubj_)}(hhh]h)}(h/The cgroup for which we're performing a lookup.h]h1The cgroup for which we’re performing a lookup.}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjThM hjUubah}(h]h ]h"]h$]h&]uh1j^hj9ubeh}(h]h ]h"]h$]h&]uh1j>hjThM hj6ubj?)}(h/``int level`` The level of ancestor to look up.h](jE)}(h ``int level``h]j)}(hjxh]h int level}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjvubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:696: ./kernel/bpf/helpers.chM hjrubj_)}(hhh]h)}(h!The level of ancestor to look up.h]h!The level of ancestor to look up.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:696: ./kernel/bpf/helpers.chM hjubah}(h]h ]h"]h$]h&]uh1j^hjrubeh}(h]h ]h"]h$]h&]uh1j>hjhM hj6ubeh}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj)hhhNhNubj )}(hhh]h}(h]h ]h"]h$]h&]entries](j bpf_cgroup_from_id (C function)c.bpf_cgroup_from_idhNtauh1j hj)hhhNhNubj )}(hhh](j )}(h9__bpf_kfunc struct cgroup * bpf_cgroup_from_id (u64 cgid)h]j )}(h7__bpf_kfunc struct cgroup *bpf_cgroup_from_id(u64 cgid)h](h __bpf_kfunc}(hjhhhNhNubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:699: ./kernel/bpf/helpers.chM ubj )}(hj h]hstruct}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubh)}(hhh]j )}(hcgrouph]hcgroup}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjmodnameN classnameNj j )}j ]j" )}j bpf_cgroup_from_idsbc.bpf_cgroup_from_idasbuh1hhjhhhjhM ubj )}(h h]h }(hj$hhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjhhhjhM ubj7 )}(hj h]h*}(hj2hhhNhNubah}(h]h ]jB ah"]h$]h&]uh1j6 hjhhhjhM ubjG )}(hbpf_cgroup_from_idh]j )}(hj!h]hbpf_cgroup_from_id}(hjChhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj?ubah}(h]h ](j\ j] eh"]h$]h&]hhuh1jF hjhhhjhM ubjb )}(h (u64 cgid)h]jh )}(hu64 cgidh](h)}(hhh]j )}(hu64h]hu64}(hjahhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hj^ubah}(h]h ]h"]h$]h&] refdomainj+reftypej reftargetjcmodnameN classnameNj j )}j ]jc.bpf_cgroup_from_idasbuh1hhjZubj )}(h h]h }(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjZubj )}(hcgidh]hcgid}(hjhhhNhNubah}(h]h ]j ah"]h$]h&]uh1j hjZubeh}(h]h ]h"]h$]h&]noemphhhuh1jg hjVubah}(h]h ]h"]h$]h&]hhuh1ja hjhhhjhM ubeh}(h]h ]h"]h$]h&]hhj uh1j j j hjhhhjhM ubah}(h]jah ](j j eh"]h$]h&]j j )j huh1j hjhM hjhhubj )}(hhh]h)}(hFind a cgroup from its ID. A cgroup returned by this kfunc which is not subsequently stored in a map, must be released by calling bpf_cgroup_release().h]hFind a cgroup from its ID. A cgroup returned by this kfunc which is not subsequently stored in a map, must be released by calling bpf_cgroup_release().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:699: ./kernel/bpf/helpers.chM hjhhubah}(h]h ]h"]h$]h&]uh1j hjhhhjhM ubeh}(h]h ](j+functioneh"]h$]h&]jj+jjjjjjjuh1j hhhj)hNhNubj)}(h)**Parameters** ``u64 cgid`` cgroup id.h](h)}(h**Parameters**h]j$)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j#hjubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:699: ./kernel/bpf/helpers.chM hjubj:)}(hhh]j?)}(h``u64 cgid`` cgroup id.h](jE)}(h ``u64 cgid``h]j)}(hjh]hu64 cgid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jDhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:699: ./kernel/bpf/helpers.chM hjubj_)}(hhh]h)}(h cgroup id.h]h cgroup id.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhP/var/lib/git/docbuild/linux/Documentation/bpf/kfuncs:699: ./kernel/bpf/helpers.chM hjubah}(h]h ]h"]h$]h&]uh1j^hjubeh}(h]h ]h"]h$]h&]uh1j>hj hM hjubah}(h]h ]h"]h$]h&]uh1j9hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhj)hhhNhNubh)}(hEventually, BPF should be updated to allow this to happen with a normal memory load in the program itself. This is currently not possible without more work in the verifier. bpf_cgroup_ancestor() can be used as follows:h]hEventually, BPF should be updated to allow this to happen with a normal memory load in the program itself. This is currently not possible without more work in the verifier. bpf_cgroup_ancestor() can be used as follows:}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj)hhubj)}(hX/** * Simple tracepoint example that illustrates how a cgroup's * ancestor can be accessed using bpf_cgroup_ancestor(). */ SEC("tp_btf/cgroup_mkdir") int BPF_PROG(cgrp_ancestor_example, struct cgroup *cgrp, const char *path) { struct cgroup *parent; /* The parent cgroup resides at the level before the current cgroup's level. */ parent = bpf_cgroup_ancestor(cgrp, cgrp->level - 1); if (!parent) return -ENOENT; bpf_printk("Parent id is %d", parent->self.id); /* Return the parent cgroup that was acquired above. */ bpf_cgroup_release(parent); return 0; }h]hX/** * Simple tracepoint example that illustrates how a cgroup's * ancestor can be accessed using bpf_cgroup_ancestor(). */ SEC("tp_btf/cgroup_mkdir") int BPF_PROG(cgrp_ancestor_example, struct cgroup *cgrp, const char *path) { struct cgroup *parent; /* The parent cgroup resides at the level before the current cgroup's level. */ parent = bpf_cgroup_ancestor(cgrp, cgrp->level - 1); if (!parent) return -ENOENT; bpf_printk("Parent id is %d", parent->self.id); /* Return the parent cgroup that was acquired above. */ bpf_cgroup_release(parent); return 0; }}hjGsbah}(h]h ]h"]h$]h&]hhj)j*j+j,}uh1jhhhMhj)hhubeh}(h]struct-cgroup-kfuncsah ]h"]4.2 struct cgroup * kfuncsah$]h&]uh1hhjR hhhhhMubh)}(hhh](h)}(h4.3 struct cpumask * kfuncsh]h4.3 struct cpumask * kfuncs}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhj^hhhhhMubh)}(hBPF provides a set of kfuncs that can be used to query, allocate, mutate, and destroy struct cpumask * objects. Please refer to :ref:`cpumasks-header-label` for more details.h](hBPF provides a set of kfuncs that can be used to query, allocate, mutate, and destroy struct cpumask * objects. Please refer to }(hjohhhNhNubh)}(h:ref:`cpumasks-header-label`h]j )}(hjyh]hcpumasks-header-label}(hj{hhhNhNubah}(h]h ](jstdstd-refeh"]h$]h&]uh1j hjwubah}(h]h ]h"]h$]h&]refdocj# refdomainjreftyperef refexplicitrefwarnj)cpumasks-header-labeluh1hhhhMhjoubh for more details.}(hjohhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj^hhubeh}(h]struct-cpumask-kfuncsah ]h"]4.3 struct cpumask * kfuncsah$]h&]uh1hhjR hhhhhMubeh}(h] core-kfuncsah ]h"]4. core kfuncsah$]h&]uh1hhhhhhhhM/ubeh}(h](bpf-kernel-functions-kfuncsheh ]h"](bpf kernel functions (kfuncs)kfuncs-header-labeleh$]h&]uh1hhhhhhhhKjT}jhsjV}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}(h]haj#]jaj]jaj ]j aunameids}(jhjjj:j7j j jjjjj#j jfjcjjjjjjj)j&jQj#jPjMjjjjjjj;j8jbj_jjjjj"jj|jj{jxj j jP jM j j jM j jL jI jD jA jjj&j#j[jXjju nametypes}(jjj:j jjj#jfjjjj)jQjPjjjj;jbjjj"j|j{j jP j jM jL jD jj&j[juh}(hhjhj7hj j=jjjjj jjcj&jjijjjjj&jj#j,jMj,jjXjjjjj8jj_j>jjejjjjjj%jxj%j jjM j j jS j j jI j jA jy jjR j#jq j j jjjjjXj)jbjgj jjjjjjj^u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages]transform_messages](hsystem_message)}(hhh]h)}(hhh]h9Hyperlink target "kfuncs-header-label" is not referenced.}hjLsbah}(h]h ]h"]h$]h&]uh1hhjIubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehnjlineKuh1jGubjH)}(hhh]h)}(hhh]h5Hyperlink target "bpf-kfunc-nodef" is not referenced.}hjgsbah}(h]h ]h"]h$]h&]uh1hhjdubah}(h]h ]h"]h$]h&]levelKtypejasourcehnjlineKuh1jGubjH)}(hhh]h)}(hhh]h8Hyperlink target "kf-deprecated-flag" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhj~ubah}(h]h ]h"]h$]h&]levelKtypejasourcehnjlineMYuh1jGubjH)}(hhh]h)}(hhh]hFHyperlink target "bpf-kfunc-lifecycle-expectations" is not referenced.}hjsbah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypejasourcehnjlineMuh1jGube transformerN include_log] decorationNhhub.