Skip to content

KFunc bpf_path_d_path

v6.12

This function resolve the path name for the supplied path.

Definition

Resolve the path name for the supplied path and store it in buf. This BPF kfunc is the safer variant of the legacy bpf_d_path helper and should be used in place of bpf_d_path whenever possible. It enforces KF_TRUSTED_ARGS semantics, meaning that the supplied path must itself hold a valid reference, or else the BPF program will be outright rejected by the BPF verifier.

This BPF kfunc may only be called from BPF LSM programs.

Parameters

path: path to resolve the pathname for

buf: buffer to return the resolved path name in

buf__sz: length of the supplied buffer

Returns

A positive integer corresponding to the length of the resolved path name in buf, including the NULL termination character. On error, a negative integer is returned.

Signature

int bpf_path_d_path(struct path *path, char *buf, size_t buf__sz)

Usage

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

Docs could be improved

This part of the docs is incomplete, contributions are very welcome