Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.06 KB

bpf_task_acquire.md

File metadata and controls

54 lines (38 loc) · 2.06 KB
title description
KFunc 'bpf_task_acquire'
This page documents the 'bpf_task_acquire' eBPF kfunc, including its defintion, usage, program types that can use it, and examples.

KFunc bpf_task_acquire

:octicons-tag-24: v6.2

Acquire a reference to a task.

Definition

A task acquired by this kfunc which is not stored in a map as a kptr, must be released by callingbpf_task_release().

p: The task on which a reference is being acquired.

#!c struct task_struct *bpf_task_acquire(struct task_struct *p)

!!! note This kfunc returns a pointer to a refcounted object. The verifier will then ensure that the pointer to the object is eventually released using a release kfunc, or transferred to a map using a referenced kptr (by invoking bpf_kptr_xchg). If not, the verifier fails the loading of the BPF program until no lingering references remain in all possible explored states of the program.

!!! note The pointer returned by the kfunc may be NULL. Hence, it forces the user to do a NULL check on the pointer returned from the kfunc before making use of it (dereferencing or passing to another helper).

Usage

!!! example "Docs could be improved" This part of the docs is incomplete, contributions are very welcome

Program types

The following program types can make use of this kfunc:

Example

!!! example "Docs could be improved" This part of the docs is incomplete, contributions are very welcome