PROTOCOLS
ProgramLinker
Defined in fuchsia.ebpf/ebpf.fidl
Protocol used by a target process to link and compile a verified eBPF program with its local process addresses (maps, helpers, and struct mappings).
Link
Links the program using the provided linkage info, returning either an
executable VMO containing JIT-compiled machine code or linked bytecode
for interpreter execution.
This is a one-shot method; the server closes the channel after sending the response.
Request
| Name | Type |
|---|---|
payload |
ProgramLinkageInfo
|
Response
| Name | Type |
|---|---|
payload |
ProgramLinker_Link_Result
|
STRUCTS
Bytecode
Defined in fuchsia.ebpf/ebpf.fidl
Linked eBPF bytecode for interpreter execution.
| Field | Type | Description | Default |
|---|---|---|---|
instructions |
vector<uint64>:4096
|
Program instructions. |
No default |
HelperLinkage
Defined in fuchsia.ebpf/ebpf.fidl
Relocation info for an eBPF helper function in a target process.
| Field | Type | Description | Default |
|---|---|---|---|
id |
uint32
|
Helper function ID. |
No default |
fn_addr |
uint64
|
Function address in the target process. Must be a non-zero address of a function using the platform C calling
convention ( where |
No default |
MapLinkage
Defined in fuchsia.ebpf/ebpf.fidl
Relocation info for an eBPF map in a target process.
| Field | Type | Description | Default |
|---|---|---|---|
map_addr |
uint64
|
Address of the map object in the target process. |
No default |
data_addr |
uint64
|
Address of the map's data buffer in the target process for eBPF array maps, or 0 if not applicable. |
No default |
MapSchema
Defined in fuchsia.ebpf/ebpf.fidl
Schema of an eBPF map.
| Field | Type | Description | Default |
|---|---|---|---|
type |
MapType
|
Map type. |
No default |
key_size |
uint32
|
Key size in bytes. |
No default |
value_size |
uint32
|
Value size in bytes. |
No default |
max_entries |
uint32
|
Maximum number of entries in the map. |
No default |
flags |
MapFlags
|
Map flags. |
No default |
ProgramHandle resource
Defined in fuchsia.ebpf/ebpf.fidl
A handle of an eBPF program.
| Field | Type | Description | Default |
|---|---|---|---|
handle |
handle<eventpair>
|
No default |
ProgramId
Defined in fuchsia.ebpf/ebpf.fidl
An ID used to uniquely identify an eBPF program. The ID is the KOID of the ProgramHandle.
| Field | Type | Description | Default |
|---|---|---|---|
id |
zx/Koid
|
No default |
ProgramLinker_Link_Response resource
Defined in fuchsia.ebpf/ebpf.fidl
| Field | Type | Description | Default |
|---|---|---|---|
program |
LinkedProgram
|
No default |
StructFieldMapping
Defined in fuchsia.ebpf/ebpf.fidl
Relocation info for a struct field offset mapping.
| Field | Type | Description | Default |
|---|---|---|---|
struct_id |
StructId
|
Identifier of the struct being remapped. |
No default |
source_offset |
uint64
|
Offset of the field in the UAPI struct. |
No default |
target_offset |
uint64
|
Offset of the field in the host struct. |
No default |
ENUMS
LinkError flexible
Type: uint32
Defined in fuchsia.ebpf/ebpf.fidl
Error returned by ProgramLinker.Link.
| Name | Value | Description |
|---|---|---|
INVALID_STRUCT_MAPPING |
1 |
A struct field mapping has an unknown StructId, an out-of-range offset, or a required 32-bit pointer field is not mapped. |
INVALID_MAP_LINKAGE |
2 |
ProgramLinkageInfo.maps does not match VerifiedProgram.maps, is
missing |
MISSING_HELPER |
3 |
The program calls a helper function that is missing from
ProgramLinkageInfo.helpers or has a zero |
MISSING_PACKET_LOAD_FN |
4 |
The program contains packet access instructions ( |
INVALID_PROGRAM |
5 |
The program contains a malformed instruction that cannot be linked. |
MapType strict
Type: uint32
Defined in fuchsia.ebpf/ebpf.fidl
Type of an eBPF maps.
| Name | Value | Description |
|---|---|---|
ARRAY |
1 |
An array map. Equivalent to |
HASH_MAP |
2 |
A hash map. Equivalent to |
RING_BUFFER |
3 |
A hash map. Equivalent to |
PERCPU_ARRAY |
4 |
A per-CPU array. Equivalent to |
PERCPU_HASH |
5 |
A per-CPU hash map. Equivalent to |
DEVMAP_HASH |
6 |
A device-map that holds references to network devices. Equivalent to
|
LPM_TRIE |
7 |
A longest prefix match trie. Equivalent to |
LRU_HASH |
8 |
A LRU hash map. Equivalent to |
SK_STORAGE |
9 |
A socket storage map. Equivalent to |
StructId flexible
Type: uint32
Defined in fuchsia.ebpf/ebpf.fidl
An identifier of a struct that may be passed to an eBPF program.
| Name | Value | Description |
|---|---|---|
SK_BUFF |
1 |
|
XDP_MD |
2 |
|
BPF_USER_PT_REGS |
3 |
|
BPF_SOCK |
4 |
|
BPF_SOCK_OPT |
5 |
|
BPF_SOCK_ADDR |
6 |
TABLES
Map resource
Defined in fuchsia.ebpf/ebpf.fidl
A representation of eBPF map that can be shared between processes.
| Ordinal | Field | Type | Description |
|---|---|---|---|
1 |
schema |
MapSchema
|
Map schema. |
2 |
vmo |
handle<vmo>
|
VMO used to store the map data. The layout of the data stored in the
VMO depends on the |
ProgramLinkageInfo
Defined in fuchsia.ebpf/ebpf.fidl
Target-process linkage information required to link and compile an eBPF program.
| Ordinal | Field | Type | Description |
|---|---|---|---|
1 |
struct_mappings |
vector<StructFieldMapping>:256
|
Struct field offset mappings for the program's context arguments. |
2 |
helpers |
vector<HelperLinkage>:256
|
Helper function addresses in the target process. |
3 |
maps |
vector<MapLinkage>:4096
|
Map addresses in the target process. Must have the same length as VerifiedProgram.maps and a one-to-one mapping with the maps in VerifiedProgram.maps. |
4 |
packet_load_fn_addr |
uint64
|
Address of the packet-load trampoline function in the target process. Required if the eBPF program contains legacy packet access instructions
( When provided, must be the address of a function in the target process
using the platform C calling convention ( where |
VerifiedProgram resource
Defined in fuchsia.ebpf/ebpf.fidl
A verified eBPF program.
| Ordinal | Field | Type | Description |
|---|---|---|---|
1 |
linker |
client_end:ProgramLinker
|
Linker channel for linking and compiling the program. |
2 |
maps |
vector<Map>:4096
|
List of the maps used by the program. The program may reference these maps by their index in this array. |
UNIONS
LinkedProgram flexible resource
Defined in fuchsia.ebpf/ebpf.fidl
Result of linking an eBPF program via ProgramLinker.Link.
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
compiled_program |
handle<vmo>
|
Executable VMO containing JIT-compiled machine code. |
2 |
bytecode |
Bytecode
|
Linked bytecode for interpreter execution when the producer does not use JIT compilation. |
ProgramLinker_Link_Result strict resource
Defined in fuchsia.ebpf/ebpf.fidl
| Ordinal | Variant | Type | Description |
|---|---|---|---|
1 |
response |
ProgramLinker_Link_Response
|
|
2 |
err |
LinkError
|
BITS
MapFlags flexible
Type: uint32
Defined in fuchsia.ebpf/ebpf.fidl
Map flags.
| Name | Value | Description |
|---|---|---|
NO_PREALLOC |
1 | Memory is not pre-allocated. |
SYSCALL_READ_ONLY |
2 |
|
SYSCALL_WRITE_ONLY |
4 |
|
MMAPABLE |
8 | The map can be mapped in a Starnix process's address space. |
CLONE |
16 | Clones the storage when the parent socket is cloned. Equivalent to |
PROG_READ_ONLY |
32 | Programs can only read from the map. Equivalent to |
CONSTANTS
| Name | Value | Type | Description |
|---|---|---|---|
| COMPILED_PROGRAM_RIGHTS | Required handle rights for a JIT-compiled program VMO. |
||
| MAX_PROGRAM_HELPERS |
256
|
uint32 |
Maximum number of helper functions in ProgramLinkageInfo. |
| MAX_PROGRAM_INSTRUCTIONS |
4096
|
uint32 |
Maximum allowed number of instructions in an eBPF program. |
| MAX_PROGRAM_MAPS |
4096
|
uint32 |
Maximum number of maps an eBPF program can use. |
| MAX_STRUCT_FIELD_MAPPINGS |
256
|
uint32 |
Maximum number of struct field mappings in ProgramLinkageInfo. |
| PROGRAM_DEFUNCT_SIGNAL |
16777216
|
uint32 |
The signal raised on a ProgramHandle to indicate that the program should be dropped. |