Lines Matching +full:embedded +full:- +full:trace +full:- +full:extension
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com
21 #define BPF_DW 0x18 /* double word (64-bit) */
22 #define BPF_MEMSX 0x80 /* load with sign extension */
23 #define BPF_ATOMIC 0xc0 /* atomic memory ops - op type in immediate */
24 #define BPF_XADD 0xc0 /* exclusive add - legacy name */
32 #define BPF_TO_LE 0x00 /* convert to little-endian */
33 #define BPF_TO_BE 0x08 /* convert to big-endian */
52 #define BPF_CMPXCHG (0xf0 | BPF_FETCH) /* atomic compare-and-write */
74 /* BPF has 10 general purpose 64-bit registers and stack frame. */
116 BPF_CGROUP_ITER_DESCENDANTS_PRE, /* walk descendants in pre-order. */
117 BPF_CGROUP_ITER_DESCENDANTS_POST, /* walk descendants in post-order. */
128 /* At most one of cgroup_fd and cgroup_id can be non-zero. If
144 /* BPF syscall commands, see bpf(2) man-page for more details. */
159 * map. The close-on-exec file descriptor flag (see **fcntl**\ (2))
166 * A new file descriptor (a nonnegative integer), or -1 if an
178 * Look up the value of a spin-locked map without
183 * Returns zero on success. On error, -1 is returned and *errno*
200 * Update a spin_lock-ed map element.
203 * Returns zero on success. On error, -1 is returned and *errno*
224 * Returns zero on success. On error, -1 is returned and *errno*
234 * Returns zero on success. On error, -1 is returned and *errno*
244 * * If *key* is the last element, returns -1 and *errno* is set
258 * The close-on-exec file descriptor flag (see **fcntl**\ (2)) is
262 * A new file descriptor (a nonnegative integer), or -1 if an
287 * Returns zero on success. On error, -1 is returned and *errno*
296 * A new file descriptor (a nonnegative integer), or -1 if an
342 * Returns zero on success. On error, -1 is returned and *errno*
352 * Returns zero on success. On error, -1 is returned and *errno*
384 * Returns zero on success. On error, -1 is returned and *errno*
399 * remain with ids higher than *start_id*, returns -1 and sets
403 * Returns zero on success. On error, or when no id remains, -1
412 * remain with ids higher than *start_id*, returns -1 and sets
416 * Returns zero on success. On error, or when no id remains, -1
425 * A new file descriptor (a nonnegative integer), or -1 if an
434 * A new file descriptor (a nonnegative integer), or -1 if an
452 * Returns zero on success. On error, -1 is returned and *errno*
498 * Returns zero on success. On error, -1 is returned and *errno*
516 * A new file descriptor (a nonnegative integer), or -1 if an
539 * A new file descriptor (a nonnegative integer), or -1 if an
548 * A new file descriptor (a nonnegative integer), or -1 if an
569 * Returns zero on success. On error, -1 is returned and *errno*
582 * Look up and delete the value of a spin-locked map
601 * Returns zero on success. On error, -1 is returned and *errno*
616 * Returns zero on success. On error, -1 is returned and *errno*
626 * remain with ids higher than *start_id*, returns -1 and sets
630 * Returns zero on success. On error, or when no id remains, -1
658 * Look up the value of a spin-locked map without
670 * Returns zero on success. On error, -1 is returned and *errno*
675 * iteration of a hash-based map type.
692 * Returns zero on success. On error, -1 is returned and *errno*
719 * Update spin_lock-ed map elements. This must be
728 * Returns zero on success. On error, -1 is returned and *errno*
762 * Look up the value of a spin-locked map without
774 * Returns zero on success. On error, -1 is returned and *errno*
784 * A new file descriptor (a nonnegative integer), or -1 if an
793 * Returns zero on success. On error, -1 is returned and *errno*
802 * A new file descriptor (a nonnegative integer), or -1 if an
811 * remain with ids higher than *start_id*, returns -1 and sets
815 * Returns zero on success. On error, or when no id remains, -1
830 * disabled system-wide when all outstanding file descriptors
834 * A new file descriptor (a nonnegative integer), or -1 if an
849 * A new file descriptor (a nonnegative integer), or -1 if an
858 * Returns zero on success. On error, -1 is returned and *errno*
869 * references to the map (for example, embedded in the eBPF
873 * Returns zero on success. On error, -1 is returned and *errno*
878 * Create BPF token with embedded information about what
879 * BPF-related functionality it allows:
880 * - a set of allowed bpf() syscall commands;
881 * - a set of allowed BPF map types to be created with
883 * - a set of allowed BPF program types and BPF program attach
903 * A new file descriptor (a nonnegative integer), or -1 if an
987 * both cgroup-attached and other progs and supports all functionality
1159 /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
1163 * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program,
1164 * the program in this cgroup yields to sub-cgroup program.
1166 * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program,
1177 * The programs of sub-cgroup are executed first, then programs of
1187 * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups.
1188 * A cgroup with NONE doesn't allow any programs in sub-cgroups.
1190 * cgrp1 (MULTI progs A, B) ->
1191 * cgrp2 (OVERRIDE prog C) ->
1192 * cgrp3 (MULTI prog D) ->
1193 * cgrp4 (OVERRIDE prog E) ->
1234 * Verifier does sub-register def/use analysis and identifies instructions whose
1235 * def only matters for low 32-bit, high 32-bit is never referenced later
1236 * through implicit zero extension. Therefore verifier notifies JIT back-ends
1237 * that it is safe to ignore clearing high 32-bit for these instructions. This
1238 * saves some back-ends a lot of code-gen. However such optimization is not
1239 * necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends
1245 * 32-bit for those instructions who has been identified as safe to ignore them.
1268 * program becomes device-bound but can access XDP metadata.
1339 /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
1343 /* when bpf_call->src_reg == BPF_PSEUDO_KFUNC_CALL,
1344 * bpf_call->imm == btf_id of a BTF_KIND_FUNC in the running kernel
1357 BPF_F_LOCK = 4, /* spin_lock-ed map_lookup/map_update */
1380 /* Zero-initialize hash function seed. This should only be used for testing. */
1390 /* Enable memory-mapping BPF map */
1442 /* user space need an empty entry to identify end of a trace */
1480 __u32 btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
1484 /* Any per-map-type extra fields
1486 * BPF_MAP_TYPE_BLOOM_FILTER - the lowest 4 bits indicate the
1490 * BPF_MAP_TYPE_ARENA - contains the address where user space
1556 __u32 attach_btf_id; /* in-kernel BTF type id to attach to */
1582 * then the fd_array[0,...,fd_array_cnt-1] is expected to be
1673 /* output: per-program attach_flags.
1741 /* black box user-provided value passed through
1757 /* black box user-provided value passed through
1848 * --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
1849 * $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
1850 * $ man /tmp/bpf-helpers.7
1910 * This helper is a "printk()-like" facility for debugging. It
1912 * to file *\/sys/kernel/tracing/trace* from TraceFS, if
1917 * Each time the helper is called, it appends a line to the trace.
1918 * Lines are discarded while *\/sys/kernel/tracing/trace* is
1920 * The format of the trace is customizable, and the exact output
1928 * telnet-470 [001] .N.. 419421.045894: 0x00000001: <formatted msg>
1953 * helper will return **-EINVAL** (but print nothing) if it
1969 * Get a pseudo-random number.
1972 * pseudo-random internal state, and cannot be used to infer the
1977 * A random 32-bit unsigned value.
1996 * **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
1997 * **->swhash** and *skb*\ **->l4hash** to 0).
2020 * which does not update the checksum in-place, but offers more
2049 * the checksum is to be computed against a pseudo-header.
2052 * which does not update the checksum in-place, but offers more
2125 * A 64-bit integer containing the current tgid and pid, and
2127 * *current_task*\ **->tgid << 32 \|**
2128 * *current_task*\ **->pid**.
2134 * A 64-bit integer containing the current GID and UID, and
2143 * helper makes sure that the *buf* is NUL-terminated. On failure,
2156 * based on a user-provided identifier for all traffic coming from
2159 * *Documentation/admin-guide/cgroup-v1/net_cls.rst*.
2165 * run on cgroups, which is a cgroup-v2-only feature (a socket can
2217 * in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also,
2218 * this struct exposes the *key*\ **->tunnel_id**, which is
2349 * identifier retrieved is a user-provided tag, similar to the
2355 * (see also **tc-bpf(8)**), or alternatively on conventional
2423 * manipulated with *skb*\ **->data** and *skb*\ **->data_end**
2454 * generating a variety of graphs (such as flame graphs or off-cpu
2512 * and retrieving arbitrary TLVs (Type-Length-Value headers) from
2558 * comes down to setting *skb*\ **->pkt_type** to *type*, except
2560 * **->pkt_type** beside this helper. Using a helper here allows
2595 * Retrieve the hash of the packet, *skb*\ **->hash**. If it is
2598 * directly with *skb*\ **->hash**.
2607 * The 32-bit hash.
2622 * security mechanism because of TOC-TOU attacks, but rather to
2623 * debug, divert, and manipulate execution of semi-cooperative
2672 * Pull in non-linear data in case the *skb* is non-linear and not
2682 * are within packet boundaries (test on *skb*\ **->data_end**) is
2684 * data is in non-linear parts of the *skb*. On failure the
2685 * program can just bail out, or in the case of a non-linear
2689 * to pull in once the non-linear parts, then retesting and
2709 * Add the checksum *csum* into *skb*\ **->csum** in case the
2721 * Invalidate the current *skb*\ **->hash**. It can be used after
2763 * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
2799 * A 8-byte long unique number on success, or 0 if the socket
2807 * A 8-byte long unique number.
2814 * A 8-byte long unique number.
2822 * A 8-byte long unique number or 0 if *sk* is NULL.
2830 * time-wait or a request socket instead), **overflowuid** value
2836 * Set the full hash for *skb* (set the field *skb*\ **->hash**)
2991 * Adjust the address pointed by *xdp_md*\ **->data_meta** by
2993 * operation modifies the address stored in *xdp_md*\ **->data**,
2997 * The use of *xdp_md*\ **->data_meta** is optional and programs
3003 * this up for further post-processing. Since TC works with socket
3037 * **->enabled** and *buf*\ **->running**, respectively) are
3151 * **bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)**
3162 * Code **-EINVAL** if the socket is not a full TCP socket;
3202 * *bytes* will be sent and the eBPF program will be re-run with
3210 * a non-zero value, this is not a problem because data is not
3225 * 1-byte long message segments. Obviously, this is bad for
3235 * For socket policies, pull in non-linear data from user space
3236 * for *msg* and set pointers *msg*\ **->data** and *msg*\
3237 * **->data_end** to *start* and *end* bytes offsets into *msg*,
3273 * domain (*addr*\ **->sa_family**) must be **AF_INET** (or
3275 * or **sin6_port**) which triggers IP_BIND_ADDRESS_NO_PORT-like
3277 * port as long as 4-tuple is unique. Passing non-zero port might
3284 * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
3299 * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
3336 * adjusted by adding (sh_addr - sh_offset), where
3352 * The non-negative copied *buf* length equal to or less than
3371 * in socket filters where *skb*\ **->data** does not always point
3398 * Use the routing table ID present in *params*->tbid
3404 * Skip the neighbour table lookup. *params*->dmac
3405 * and *params*->smac will not be set as output. A common
3409 * Derive and set source IP addr in *params*->ipv{4,6}_src
3412 * case, *params*->dmac and *params*->smac are not set either.
3414 * Use the mark present in *params*->mark for the fib lookup.
3427 * was exceeded and output params->mtu_result contains the MTU.
3552 * End.X action: Endpoint with Layer-3 cross-connect.
3626 * to the same 64-bit id.
3639 * A 64-bit integer containing the current cgroup id based
3691 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3699 * **sizeof**\ (*tuple*\ **->ipv4**)
3701 * **sizeof**\ (*tuple*\ **->ipv6**)
3704 * If the *netns* is a negative signed 32-bit integer, then the
3708 * If *netns* is any other signed 32-bit value greater than or
3711 * range of 32-bit integers are reserved for future use.
3721 * result is from *reuse*\ **->socks**\ [] using the hash of the
3728 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3736 * **sizeof**\ (*tuple*\ **->ipv4**)
3738 * **sizeof**\ (*tuple*\ **->ipv6**)
3741 * If the *netns* is a negative signed 32-bit integer, then the
3745 * If *netns* is any other signed 32-bit value greater than or
3748 * range of 32-bit integers are reserved for future use.
3758 * result is from *reuse*\ **->socks**\ [] using the hash of the
3764 * non-**NULL** pointer that was returned from
3854 * allowed inside a spinlock-ed region.
3877 * * **bpf_spin_lock** is not allowed in inner maps of map-in-map.
3926 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3938 * result is from *reuse*\ **->socks**\ [] using the hash of the
3962 * The buffer is always NUL terminated, unless it's zero-sized.
3970 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3982 * The buffer is always NUL terminated, unless it's zero-sized.
3986 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3989 * **-EINVAL** if current value was unavailable, e.g. because
3990 * sysctl is uninitialized and read returns -EIO for it.
4000 * The buffer is always NUL terminated, unless it's zero-sized.
4004 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
4007 * **-EINVAL** if sysctl is being read.
4022 * **-E2BIG** if the *buf_len* is too big.
4024 * **-EINVAL** if sysctl is being read.
4034 * optional '**-**' sign.
4045 * **-EINVAL** if no valid digits were found or unsupported base
4048 * **-ERANGE** if resulting value was out of range.
4068 * **-EINVAL** if no valid digits were found or unsupported base
4071 * **-ERANGE** if resulting value was out of range.
4075 * Get a bpf-local-storage from a *sk*.
4085 * the *map*. The *map* is used as the bpf-local-storage
4086 * "type". The bpf-local-storage "type" (i.e. the *map*) is
4087 * searched against all bpf-local-storages residing at *sk*.
4093 * used such that a new bpf-local-storage will be
4096 * the initial value of a bpf-local-storage. If *value* is
4097 * **NULL**, the new bpf-local-storage will be zero initialized.
4099 * A bpf-local-storage pointer is returned on success.
4102 * a new bpf-local-storage.
4106 * Delete a bpf-local-storage from a *sk*.
4110 * **-ENOENT** if the bpf-local-storage cannot be found.
4111 * **-EINVAL** if sk is not a fullsock (e.g. a request_sock).
4120 * **-EBUSY** if work queue under nmi is full.
4122 * **-EINVAL** if *sig* is invalid.
4124 * **-EPERM** if no permission to send the *sig*.
4126 * **-EAGAIN** if bpf program can try again.
4147 * **-EINVAL** SYN cookie cannot be issued due to error
4149 * **-ENOENT** SYN cookie should not be issued (no SYN flood)
4151 * **-EOPNOTSUPP** kernel configuration does not enable SYN cookies
4153 * **-EPROTONOSUPPORT** IP packet version is not 4 or 6
4172 * *ctx* is a pointer to in-kernel struct sk_buff.
4199 * string length is larger than *size*, just *size*-1 bytes are
4214 * ctx->di);
4229 * *current*\ **->mm->arg_start** and *current*\
4230 * **->mm->env_start**: using this helper and the return value,
4247 * Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**.
4258 * **-EBUSY** if work queue under nmi is full.
4260 * **-EINVAL** if *sig* is invalid.
4262 * **-EPERM** if no permission to send the *sig*.
4264 * **-EAGAIN** if bpf program can try again.
4286 * **-EINVAL** if arguments invalid or **size** not a multiple
4289 * **-ENOENT** if architecture does not support branch records.
4298 * **-EINVAL** if dev and inum supplied don't match dev_t and inode number
4301 * **-ENOENT** if pidns does not exists for the current task.
4320 * *ctx* is a pointer to in-kernel struct xdp_buff.
4338 * A 8-byte long opaque number.
4377 * **-EINVAL** if specified *flags* are not supported.
4379 * **-ENOENT** if the socket is unavailable for assignment.
4381 * **-ENETUNREACH** if the socket is unreachable (wrong netns).
4383 * **-EOPNOTSUPP** if the operation is not supported, for example
4399 * that are not v6-only can be selected for IPv4 packets.
4412 * load-balancing within reuseport group for the socket
4415 * On success *ctx->sk* will point to the selected socket.
4420 * * **-EAFNOSUPPORT** if socket family (*sk->family*) is
4421 * not compatible with packet family (*ctx->family*).
4423 * * **-EEXIST** if socket has been already selected,
4427 * * **-EINVAL** if unsupported flags were specified.
4429 * * **-EPROTOTYPE** if socket L4 protocol
4430 * (*sk->protocol*) doesn't match packet protocol
4431 * (*ctx->protocol*).
4433 * * **-ESOCKTNOSUPPORT** if socket is not in allowed
4453 * The *data_len* is the size of *data* in bytes - must be a multiple of 8.
4464 * **-EBUSY** if per-CPU memory copy buffer is busy, can try again
4467 * **-EINVAL** if arguments are invalid, or if *fmt* is invalid/unsupported.
4469 * **-E2BIG** if *fmt* contains too many format specifiers.
4471 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
4481 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
4487 * *sk* must be a non-**NULL** pointer to a socket, e.g. one
4525 * An adaptive notification is a notification sent whenever the user-space
4526 * process has caught up and consumed all available payloads. In case the user-space
4603 * * **BPF_CSUM_LEVEL_INC**: Increases skb->csum_level for skbs
4605 * * **BPF_CSUM_LEVEL_DEC**: Decreases skb->csum_level for skbs
4607 * * **BPF_CSUM_LEVEL_RESET**: Resets skb->csum_level to 0 and
4609 * * **BPF_CSUM_LEVEL_QUERY**: No-op, returns the current
4610 * skb->csum_level.
4613 * case of **BPF_CSUM_LEVEL_QUERY**, the current skb->csum_level
4614 * is returned or the error code -EACCES in case the skb is not
4651 * the current task; all other tasks will return -EOPNOTSUPP.
4679 * The non-negative copied *buf* length equal to or less than
4688 * *skops*\ **->skb_data**. The comment in **struct bpf_sock_ops**
4690 * *skops*\ **->op**.
4700 * the 2nd byte which is "kind-length" of a TCP
4701 * header option and the "kind-length" also
4702 * includes the first 2 bytes "kind" and "kind-length"
4711 * Note, kind-length must be 0 for regular option.
4713 * Searching for No-Op (0) and End-of-Option-List (1) are
4722 * saved_syn packet or the just-received syn packet.
4729 * **-EINVAL** if a parameter is invalid.
4731 * **-ENOMSG** if the option is not found.
4733 * **-ENOENT** if no syn packet is available when
4736 * **-ENOSPC** if there is not enough space. Only *len* number of
4739 * **-EFAULT** on failure to parse the header options in the
4742 * **-EPERM** if the helper cannot be used under the current
4743 * *skops*\ **->op**.
4751 * includes the kind, kind-length, and the actual
4752 * option data. The *len* must be at least kind-length
4753 * long. The kind-length does not have to be 4 byte
4755 * and setting the 4 bytes aligned value to th->doff.
4766 * **-EINVAL** If param is invalid.
4768 * **-ENOSPC** if there is not enough space in the header.
4771 * **-EEXIST** if the option already exists.
4773 * **-EFAULT** on failure to parse the existing header options.
4775 * **-EPERM** if the helper cannot be used under the current
4776 * *skops*\ **->op**.
4793 * **-EINVAL** if a parameter is invalid.
4795 * **-ENOSPC** if there is not enough space in the header.
4797 * **-EPERM** if the helper cannot be used under the current
4798 * *skops*\ **->op**.
4812 * the *map*. The *map* is used as the bpf-local-storage
4813 * "type". The bpf-local-storage "type" (i.e. the *map*) is
4834 * **-ENOENT** if the bpf_local_storage cannot be found.
4857 * Use BTF to store a string representation of *ptr*->ptr in *str*,
4858 * using *ptr*->type_id. This value should specify the type
4859 * that *ptr*->ptr points to. LLVM __builtin_btf_type_id(type, 1)
4862 * stored in the first *str_size* - 1 bytes of *str*. Safe copy of
4883 * show zero-valued struct/union members; they
4894 * *ptr*->ptr, using *ptr*->type_id as per bpf_snprintf_btf().
4986 * the *map*. The *map* is used as the bpf-local-storage
4987 * "type". The bpf-local-storage "type" (i.e. the *map*) is
5008 * **-ENOENT** if the bpf_local_storage cannot be found.
5026 * **-EINVAL** if invalid *flags* are passed, zero otherwise.
5030 * Return a coarse-grained version of the time elapsed since
5045 * **-EOPNOTSUPP** if IMA is disabled or **-EINVAL** if
5080 * this value is L3 as this correlate to MTU and IP-header tot_len
5099 * possible for the skb packet to get re-segmented
5109 * MTU value in your BPF-code.
5126 * **map**, **callback_ctx** and other map-specific parameters.
5149 * The number of traversed map elements for success, **-EINVAL** for
5155 * based on a format string stored in a read-only map pointed by
5161 * array. The *data_len* is the size of *data* in bytes - must be
5176 * be zero-terminated except when **str_size** is 0.
5178 * Or **-EBUSY** if the per-CPU memory copy buffer is busy.
5208 * **-EBUSY** if *timer* is already initialized.
5209 * **-EINVAL** if invalid *flags* are passed.
5210 * **-EPERM** if *timer* is in a map that doesn't have any user references.
5220 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
5221 * **-EPERM** if *timer* is in a map that doesn't have any user references.
5237 * decremented. This is done to make sure that Ctrl-C of a user
5239 * bpffs the callback_fn can re-arm itself indefinitely.
5242 * The map can contain timers that invoke callback_fn-s from different
5257 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier
5266 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
5267 * **-EDEADLK** if callback_fn tried to call bpf_timer_cancel() on its
5290 * - kprobe/uprobe;
5291 * - tracepoint;
5292 * - perf_event.
5305 * Get branch trace from hardware engines like Intel LBR. The
5308 * based on the actual use case. To capture branch trace
5320 * **-EINVAL** if *flags* is not zero.
5322 * **-ENOENT** if architecture does not support branch records.
5347 * **-EINVAL** if *flags* is not zero.
5349 * **-EINVAL** if string *name* is not the same size as *name_sz*.
5351 * **-ENOENT** if symbol is not found.
5353 * **-EPERM** if caller does not have permission to obtain kernel address.
5370 * **-ENOENT** if *task->mm* is NULL, or no vma contains *addr*.
5371 * **-EBUSY** if failed to try lock mmap_lock.
5372 * **-EINVAL** for invalid **flags**.
5387 * is zero-indexed.
5395 * The number of loops performed, **-EINVAL** for invalid **flags**,
5396 * **-E2BIG** if **nr_loops** exceeds the maximum number of loops.
5401 * to be null-terminated and **s1_sz** is the maximum storage
5402 * size of **s1**. **s2** must be a read-only string.
5410 * Get **n**-th argument register (zero based) of the traced function (for tracing programs)
5415 * **-EINVAL** if n >= argument register count of traced function.
5424 * **-EOPNOTSUPP** for tracing programs other than BPF_TRACE_FEXIT or BPF_MODIFY_RETURN.
5453 * bpf_set_retval(-EPERM);
5456 * In this case, the BPF program's return value will use helper's -EPERM. This
5496 * Change the __sk_buff->tstamp_type to *tstamp_type*
5497 * and set *tstamp* to the __sk_buff->tstamp together.
5499 * If there is no need to change the __sk_buff->tstamp_type,
5500 * the tstamp value can be directly written to __sk_buff->tstamp
5511 * Only IPv4 and IPv6 skb->protocol are supported.
5514 * mono delivery time to __sk_buff->tstamp and then
5516 * changing the (rcv) timestamp in __sk_buff->tstamp at
5518 * to sch_fq@phy-dev.
5521 * **-EINVAL** for invalid input
5522 * **-EOPNOTSUPP** for unsupported protocol
5531 * **-EOPNOTSUPP** if the hash calculation failed or **-EINVAL** if
5568 * 0 on success, -E2BIG if the size exceeds DYNPTR_MAX_SIZE,
5569 * -EINVAL if flags is not 0.
5585 * through the dynptr interface. This is a no-op if the dynptr is
5596 * interface. This is a no-op if the dynptr is invalid/null.
5609 * 0 on success, -E2BIG if *offset* + *len* exceeds the length
5610 * of *src*'s data, -EINVAL if *src* is an invalid dynptr or if
5618 * *flags* must be 0 except for skb-type dynptrs.
5620 * For skb-type dynptrs:
5629 * 0 on success, -E2BIG if *offset* + *len* exceeds the length
5630 * of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst*
5631 * is a read-only dynptr or if *flags* is not correct. For skb-type dynptrs,
5645 * read-only, if the dynptr is invalid, or if the offset and length
5666 * **-EINVAL** if *th_len* is invalid.
5686 * **-EINVAL** if *th_len* is invalid.
5688 * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
5703 * **-EACCES** if the SYN cookie is not valid.
5718 * **-EACCES** if the SYN cookie is not valid.
5720 * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
5724 * A nonsettable system-wide clock derived from wall-clock time but
5749 * buffer. If a user-space producer was epoll-waiting on this map,
5759 * **-EBUSY** if the ring buffer is contended, and another calling
5762 * **-EINVAL** if user-space is not properly tracking the ring
5767 * **-E2BIG** if user-space has tried to publish a sample which is
5782 * In reality, the local-storage value is embedded directly inside of the
5784 * **BPF_MAP_TYPE_CGRP_STORAGE** map. When the local-storage value is
5786 * O(n) iteration over all of the live local-storage values for that
5787 * *cgroup* object until the local-storage value for the *map* is found.
5807 * **-ENOENT** if the bpf_local_storage cannot be found.
6024 /* backwards-compatibility macros for users of __BPF_FUNC_MAPPER that don't
6103 BPF_F_CURRENT_NETNS = (-1L),
6222 /* The enum used in skb->tstamp_type. It specifies the clock type
6223 * of the time stored in the skb->tstamp.
6232 * the bpf prog can try to deduce it by ingress/egress/skb->sk->sk_clockid.
6236 /* user accessible mirror of in-kernel sk_buff.
6300 /* user accessible mirror of in-kernel xfrm_state.
6315 * The values are binary compatible with their TC_ACT_* counter-part to
6325 /* 3-6 reserved */
6427 * their TC_ACT_* counter-parts. For compatibility in behavior, unknown
6431 TCX_NEXT = -1,
6464 __u32 ingress_ifindex; /* rxq->dev->ifindex */
6465 __u32 rx_queue_index; /* rxq->queue_index */
6467 __u32 egress_ifindex; /* txq->dev->ifindex */
6470 /* DEVMAP map-value layout
6472 * The struct data-layout of map-value is a configuration interface.
6483 /* CPUMAP map-value layout
6485 * The struct data-layout of map-value is a configuration interface.
6530 * Note that the directly accessible bytes (data_end - data)
6543 /* When reuse->migrating_sk is NULL, it is selecting a sk for the
6545 * the received SYN in the TCP case). reuse->sk is one of the sk
6546 * in the reuseport group. The bpf prog can use reuse->sk to learn
6549 * When reuse->migrating_sk is not NULL, reuse->sk is closed and
6550 * reuse->migrating_sk is the socket that needs to be migrated
6552 * sk that is fully established or a reqsk that is in-the-middle
6553 * of 3-way handshake.
6758 __u32 user_family; /* Allows 4-byte read, but no write. */
6759 __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write.
6762 __u32 user_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
6765 __u32 user_port; /* Allows 1,2,4-byte read and 4-byte write.
6768 __u32 family; /* Allows 4-byte read, but no write */
6769 __u32 type; /* Allows 4-byte read, but no write */
6770 __u32 protocol; /* Allows 4-byte read, but no write */
6771 __u32 msg_src_ip4; /* Allows 1,2,4-byte read and 4-byte write.
6774 __u32 msg_src_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
6870 * called under sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB
6878 * mode and required the active side to resend the bpf-written
6879 * options. The active side can keep writing the bpf-options until
6890 * sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB.
6900 * sock_ops->op == BPF_SOCK_OPS_HDR_OPT_LEN_CB. Then
6902 * under sock_ops->op == BPF_SOCK_OPS_WRITE_HDR_OPT_CB.
6921 BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or
6922 * -1 if default value should be used
6925 * window (in packets) or -1 if default
6977 * sock_ops->skb_data:
6991 * sock_ops->skb_data:
6995 * sock_ops->skb_tcp_flags:
7006 * sock_ops->skb_data:
7011 * earlier bpf-progs.
7013 * sock_ops->skb_tcp_flags:
7026 * earlier bpf-progs.
7065 * 1. the just-received SYN packet (only available when writing the
7079 * If the bpf-prog does not need the IP[46] header, the
7080 * bpf-prog can avoid parsing the IP header by using
7081 * TCP_BPF_SYN. Otherwise, the bpf-prog can get both
7085 * -ENOSPC: Not enough space in optval. Only optlen number of
7087 * -ENOENT: The SYN skb is not available now and the earlier SYN pkt
7175 /* set if lookup is to consider L4 data - e.g., FIB rules */
7182 __u16 tot_len; /* L3 length from network hdr (iph->tot_len) */
7235 /* 2 4-byte holes for input */
7264 BPF_MTU_CHK_RET_SEGS_TOOBIG, /* GSO re-segmentation needed to fwd */
7360 * Allows 1,2,4-byte read, but no write.
7363 * Allows 1,2,4-byte read an 4-byte write.
7387 __u64 cookie; /* Non-zero if socket was selected in PROG_TEST_RUN */
7405 * via the bpf_snprintf_btf() helper described above. A flags field -
7407 * (rather than its mode of display) - is included for future use.
7408 * Display flags - BTF_F_* - are passed to bpf_snprintf_btf separately.
7418 * - BTF_F_COMPACT: no formatting around type information
7419 * - BTF_F_NONAME: no struct/union member names/types
7420 * - BTF_F_PTR_RAW: show raw (unobfuscated) pointer values;
7422 * - BTF_F_ZERO: show zero-valued struct/union members; they
7440 BPF_CORE_FIELD_SIGNED = 3, /* field signedness (0 - unsigned, 1 - signed) */
7441 BPF_CORE_FIELD_LSHIFT_U64 = 4, /* bitfield-specific left bitshift */
7442 BPF_CORE_FIELD_RSHIFT_U64 = 5, /* bitfield-specific right bitshift */
7456 * CO-RE relocation captures the following data:
7457 * - insn_off - instruction offset (in bytes) within a BPF program that needs
7458 * its insn->imm field to be relocated with actual field info;
7459 * - type_id - BTF type ID of the "root" (containing) entity of a relocatable
7461 * - access_str_off - offset into corresponding .BTF string section. String
7463 * - for field-based relocations, string encodes an accessed field using
7467 * - for type-based relocations, strings is expected to be just "0";
7468 * - for enum value-based relocations, string contains an index of enum
7470 * - kind - one of enum bpf_core_relo_kind;
7481 * int *x = &s->a; // encoded as "0:0" (a is field #0)
7482 * int *y = &s->b[5]; // encoded as "0:1:0:5" (anon struct is field #1,
7484 * int *z = &s[10]->b; // encoded as "10:1" (ptr is used as an array)
7490 * Clang built-in, passing expression that captures field address, e.g.:
7493 * __builtin_preserve_access_index(&src->a.b.c));
7496 * be able to find offset of embedded `a.b.c` field within `src` struct.
7498 * [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction
7509 * - BPF_F_TIMER_ABS: Timeout passed is absolute time, by default it is
7511 * - BPF_F_TIMER_CPU_PIN: Timer will be pinned to the CPU of the caller.
7528 * - BPF_F_PAD_ZEROS: Pad destination buffer with zeros. (See the respective