Lines Matching +full:no +full:- +full:unaligned +full:- +full:direct +full:- +full:access

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) */
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 */
51 #define BPF_CMPXCHG (0xf0 | BPF_FETCH) /* atomic compare-and-write */
69 /* BPF has 10 general purpose 64-bit registers and stack frame. */
94 BPF_CGROUP_ITER_DESCENDANTS_PRE, /* walk descendants in pre-order. */
95 BPF_CGROUP_ITER_DESCENDANTS_POST, /* walk descendants in post-order. */
106 /* At most one of cgroup_fd and cgroup_id can be non-zero. If
122 /* BPF syscall commands, see bpf(2) man-page for more details. */
137 * map. The close-on-exec file descriptor flag (see **fcntl**\ (2))
144 * A new file descriptor (a nonnegative integer), or -1 if an
156 * Look up the value of a spin-locked map without
161 * Returns zero on success. On error, -1 is returned and *errno*
178 * Update a spin_lock-ed map element.
181 * Returns zero on success. On error, -1 is returned and *errno*
202 * Returns zero on success. On error, -1 is returned and *errno*
212 * Returns zero on success. On error, -1 is returned and *errno*
222 * * If *key* is the last element, returns -1 and *errno* is set
236 * The close-on-exec file descriptor flag (see **fcntl**\ (2)) is
240 * A new file descriptor (a nonnegative integer), or -1 if an
258 * If no other file descriptors or filesystem nodes refer to the
265 * Returns zero on success. On error, -1 is returned and *errno*
274 * A new file descriptor (a nonnegative integer), or -1 if an
320 * Returns zero on success. On error, -1 is returned and *errno*
330 * Returns zero on success. On error, -1 is returned and *errno*
362 * Returns zero on success. On error, -1 is returned and *errno*
376 * and updates *next_id* on success. If no other eBPF programs
377 * remain with ids higher than *start_id*, returns -1 and sets
381 * Returns zero on success. On error, or when no id remains, -1
389 * and updates *next_id* on success. If no other eBPF maps
390 * remain with ids higher than *start_id*, returns -1 and sets
394 * Returns zero on success. On error, or when no id remains, -1
403 * A new file descriptor (a nonnegative integer), or -1 if an
412 * A new file descriptor (a nonnegative integer), or -1 if an
430 * Returns zero on success. On error, -1 is returned and *errno*
476 * Returns zero on success. On error, -1 is returned and *errno*
481 * Attach an eBPF program to a tracepoint *name* to access kernel
487 * No ABI guarantees are made about the content of tracepoint
494 * A new file descriptor (a nonnegative integer), or -1 if an
517 * A new file descriptor (a nonnegative integer), or -1 if an
526 * A new file descriptor (a nonnegative integer), or -1 if an
547 * Returns zero on success. On error, -1 is returned and *errno*
560 * Look up and delete the value of a spin-locked map
579 * Returns zero on success. On error, -1 is returned and *errno*
587 * Upon success, no future syscall invocations may alter the
594 * Returns zero on success. On error, -1 is returned and *errno*
603 * and updates *next_id* on success. If no other BTF objects
604 * remain with ids higher than *start_id*, returns -1 and sets
608 * Returns zero on success. On error, or when no id remains, -1
632 * Look up the value of a spin-locked map without
644 * Returns zero on success. On error, -1 is returned and *errno*
649 * iteration of a hash-based map type.
666 * Returns zero on success. On error, -1 is returned and *errno*
693 * Update spin_lock-ed map elements. This must be
702 * Returns zero on success. On error, -1 is returned and *errno*
736 * Look up the value of a spin-locked map without
748 * Returns zero on success. On error, -1 is returned and *errno*
758 * A new file descriptor (a nonnegative integer), or -1 if an
767 * Returns zero on success. On error, -1 is returned and *errno*
776 * A new file descriptor (a nonnegative integer), or -1 if an
784 * and updates *next_id* on success. If no other eBPF links
785 * remain with ids higher than *start_id*, returns -1 and sets
789 * Returns zero on success. On error, or when no id remains, -1
804 * disabled system-wide when all outstanding file descriptors
808 * A new file descriptor (a nonnegative integer), or -1 if an
823 * A new file descriptor (a nonnegative integer), or -1 if an
832 * Returns zero on success. On error, -1 is returned and *errno*
847 * Returns zero on success. On error, -1 is returned and *errno*
863 * to the object have been closed and no references remain pinned to the
929 * both cgroup-attached and other progs and supports all functionality
1075 /* cgroup-bpf attach flags used in BPF_PROG_ATTACH command
1077 * NONE(default): No further bpf programs allowed in the subtree.
1079 * BPF_F_ALLOW_OVERRIDE: If a sub-cgroup installs some bpf program,
1080 * the program in this cgroup yields to sub-cgroup program.
1082 * BPF_F_ALLOW_MULTI: If a sub-cgroup installs some bpf program,
1093 * The programs of sub-cgroup are executed first, then programs of
1103 * A cgroup with MULTI or OVERRIDE flag allows any attach flags in sub-cgroups.
1104 * A cgroup with NONE doesn't allow any programs in sub-cgroups.
1106 * cgrp1 (MULTI progs A, B) ->
1107 * cgrp2 (OVERRIDE prog C) ->
1108 * cgrp3 (MULTI prog D) ->
1109 * cgrp4 (OVERRIDE prog E) ->
1143 * context and memory access aspects of the verifier, but because
1144 * of an unaligned access the alignment check would trigger before
1150 * Verifier does sub-register def/use analysis and identifies instructions whose
1151 * def only matters for low 32-bit, high 32-bit is never referenced later
1152 * through implicit zero extension. Therefore verifier notifies JIT back-ends
1153 * that it is safe to ignore clearing high 32-bit for these instructions. This
1154 * saves some back-ends a lot of code-gen. However such optimization is not
1155 * necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends
1161 * 32-bit for those instructions who has been identified as safe to ignore them.
1184 * program becomes device-bound but can access XDP metadata.
1252 /* when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
1256 /* when bpf_call->src_reg == BPF_PSEUDO_KFUNC_CALL,
1257 * bpf_call->imm == btf_id of a BTF_KIND_FUNC in the running kernel
1266 BPF_F_LOCK = 4, /* spin_lock-ed map_lookup/map_update */
1289 /* Zero-initialize hash function seed. This should only be used for testing. */
1299 /* Enable memory-mapping BPF map */
1375 __u32 btf_vmlinux_value_type_id;/* BTF type_id of a kernel-
1379 /* Any per-map-type extra fields
1381 * BPF_MAP_TYPE_BLOOM_FILTER - the lowest 4 bits indicate the
1439 __u32 attach_btf_id; /* in-kernel BTF type id to attach to */
1542 /* output: per-program attach_flags.
1603 /* black box user-provided value passed through
1619 /* black box user-provided value passed through
1698 * --filename include/uapi/linux/bpf.h > /tmp/bpf-helpers.rst
1699 * $ rst2man /tmp/bpf-helpers.rst > /tmp/bpf-helpers.7
1700 * $ man /tmp/bpf-helpers.7
1713 * Map value associated to *key*, or **NULL** if no entry was
1726 * No condition on the existence of the entry for *key*.
1760 * This helper is a "printk()-like" facility for debugging. It
1778 * telnet-470 [001] .N.. 419421.045894: 0x00000001: <formatted msg>
1801 * **%lli**, **%llu**, **%llx**, **%p**, **%s**. No modifier (size
1803 * helper will return **-EINVAL** (but print nothing) if it
1819 * Get a pseudo-random number.
1822 * pseudo-random internal state, and cannot be used to infer the
1827 * A random 32-bit unsigned value.
1844 * **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
1845 * **->swhash** and *skb*\ **->l4hash** to 0).
1851 * direct packet access.
1868 * which does not update the checksum in-place, but offers more
1876 * direct packet access.
1897 * the checksum is to be computed against a pseudo-header.
1900 * which does not update the checksum in-place, but offers more
1908 * direct packet access.
1932 * fails, then the helper has no effect, and the caller continues
1963 * direct packet access.
1973 * A 64-bit integer containing the current tgid and pid, and
1975 * *current_task*\ **->tgid << 32 \|**
1976 * *current_task*\ **->pid**.
1982 * A 64-bit integer containing the current GID and UID, and
1991 * helper makes sure that the *buf* is NUL-terminated. On failure,
2004 * based on a user-provided identifier for all traffic coming from
2007 * *Documentation/admin-guide/cgroup-v1/net_cls.rst*.
2013 * run on cgroups, which is a cgroup-v2-only feature (a socket can
2034 * direct packet access.
2046 * direct packet access.
2065 * in *key*\ **->remote_ipv4** or *key*\ **->remote_ipv6**. Also,
2066 * this struct exposes the *key*\ **->tunnel_id**, which is
2124 * Add a flag to tunnel metadata indicating that no tunnel
2181 * supports redirection to the egress interface, and accepts no
2197 * identifier retrieved is a user-provided tag, similar to the
2203 * (see also **tc-bpf(8)**), or alternatively on conventional
2270 * by "direct packet access", enabling packet data to be
2271 * manipulated with *skb*\ **->data** and *skb*\ **->data_end**
2302 * generating a variety of graphs (such as flame graphs or off-cpu
2360 * and retrieving arbitrary TLVs (Type-Length-Value headers) from
2399 * direct packet access.
2406 * comes down to setting *skb*\ **->pkt_type** to *type*, except
2407 * the eBPF program does not have a write access to *skb*\
2408 * **->pkt_type** beside this helper. Using a helper here allows
2443 * Retrieve the hash of the packet, *skb*\ **->hash**. If it is
2446 * directly with *skb*\ **->hash**.
2455 * The 32-bit hash.
2470 * security mechanism because of TOC-TOU attacks, but rather to
2471 * debug, divert, and manipulate execution of semi-cooperative
2514 * direct packet access.
2520 * Pull in non-linear data in case the *skb* is non-linear and not
2526 * This helper is only needed for reading and writing with direct
2527 * packet access.
2529 * For direct packet access, testing that offsets to access
2530 * are within packet boundaries (test on *skb*\ **->data_end**) is
2532 * data is in non-linear parts of the *skb*. On failure the
2533 * program can just bail out, or in the case of a non-linear
2535 * **bpf_skb_load_bytes**\ () helper is a first solution to access
2537 * to pull in once the non-linear parts, then retesting and
2538 * eventually access the data.
2541 * which is a necessary condition for direct write. As this needs
2551 * direct packet access.
2557 * Add the checksum *csum* into *skb*\ **->csum** in case the
2562 * written into the packet through direct packet access.
2569 * Invalidate the current *skb*\ **->hash**. It can be used after
2570 * mangling on headers through direct packet access, in order to
2572 * recalculation the next time the kernel tries to access this
2605 * direct packet access.
2611 * Adjust (move) *xdp_md*\ **->data** by *delta* bytes. Note that
2620 * direct packet access.
2641 * If no cookie has been set yet, generate a new cookie. Once
2647 * A 8-byte long unique number on success, or 0 if the socket
2655 * A 8-byte long unique number.
2662 * A 8-byte long unique number.
2670 * A 8-byte long unique number or 0 if *sk* is NULL.
2678 * time-wait or a request socket instead), **overflowuid** value
2684 * Set the full hash for *skb* (set the field *skb*\ **->hash**)
2778 * direct packet access.
2829 * No condition on the existence of the entry for *key*.
2839 * Adjust the address pointed by *xdp_md*\ **->data_meta** by
2841 * operation modifies the address stored in *xdp_md*\ **->data**,
2845 * The use of *xdp_md*\ **->data_meta** is optional and programs
2851 * this up for further post-processing. Since TC works with socket
2862 * direct packet access.
2885 * **->enabled** and *buf*\ **->running**, respectively) are
2896 * will not reflect the case compared to when no multiplexing
3003 * **bpf_sock->bpf_sock_ops_cb_flags & ~BPF_SOCK_OPS_RTO_CB_FLAG)**
3014 * Code **-EINVAL** if the socket is not a full TCP socket;
3054 * *bytes* will be sent and the eBPF program will be re-run with
3062 * a non-zero value, this is not a problem because data is not
3077 * 1-byte long message segments. Obviously, this is bad for
3087 * For socket policies, pull in non-linear data from user space
3088 * for *msg* and set pointers *msg*\ **->data** and *msg*\
3089 * **->data_end** to *start* and *end* bytes offsets into *msg*,
3109 * direct packet access.
3125 * domain (*addr*\ **->sa_family**) must be **AF_INET** (or
3127 * or **sin6_port**) which triggers IP_BIND_ADDRESS_NO_PORT-like
3129 * port as long as 4-tuple is unique. Passing non-zero port might
3136 * Adjust (move) *xdp_md*\ **->data_end** by *delta* bytes. It is
3144 * direct packet access.
3151 * **ip-xfrm(8)**) at *index* in XFRM "security path" for *skb*.
3188 * adjusted by adding (sh_addr - sh_offset), where
3204 * The non-negative copied *buf* length equal to or less than
3221 * In general, "direct packet access" is the preferred method to
3222 * access packet data, however, this helper is in particular useful
3223 * in socket filters where *skb*\ **->data** does not always point
3224 * to the start of the mac header and where "direct packet access"
3246 * Do a direct table lookup vs full lookup using FIB
3250 * Use the routing table ID present in *params*->tbid
3256 * Skip the neighbour table lookup. *params*->dmac
3257 * and *params*->smac will not be set as output. A common
3270 * was exceeded and output params->mtu_result contains the MTU.
3283 * No condition on the existence of the entry for *key*.
3339 * if **skb_is_gso**\ (*skb*) is true, no more than two
3352 * direct packet access.
3367 * direct packet access.
3383 * direct packet access.
3395 * End.X action: Endpoint with Layer-3 cross-connect.
3412 * direct packet access.
3469 * to the same 64-bit id.
3482 * A 64-bit integer containing the current cgroup id based
3534 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3542 * **sizeof**\ (*tuple*\ **->ipv4**)
3544 * **sizeof**\ (*tuple*\ **->ipv6**)
3547 * If the *netns* is a negative signed 32-bit integer, then the
3551 * If *netns* is any other signed 32-bit value greater than or
3554 * range of 32-bit integers are reserved for future use.
3564 * result is from *reuse*\ **->socks**\ [] using the hash of the
3571 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3579 * **sizeof**\ (*tuple*\ **->ipv4**)
3581 * **sizeof**\ (*tuple*\ **->ipv6**)
3584 * If the *netns* is a negative signed 32-bit integer, then the
3588 * If *netns* is any other signed 32-bit value greater than or
3591 * range of 32-bit integers are reserved for future use.
3601 * result is from *reuse*\ **->socks**\ [] using the hash of the
3607 * non-**NULL** pointer that was returned from
3697 * allowed inside a spinlock-ed region.
3700 * * The BPF program can access **struct bpf_spin_lock** only via
3720 * * **bpf_spin_lock** is not allowed in inner maps of map-in-map.
3769 * and if non-**NULL**, released via **bpf_sk_release**\ ().
3773 * **bpf_sk_fullsock**\ () or **bpf_tcp_sock**\ () to access the
3781 * result is from *reuse*\ **->socks**\ [] using the hash of the
3805 * The buffer is always NUL terminated, unless it's zero-sized.
3813 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3822 * The whole value is copied, no matter what file position user
3825 * The buffer is always NUL terminated, unless it's zero-sized.
3829 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3832 * **-EINVAL** if current value was unavailable, e.g. because
3833 * sysctl is uninitialized and read returns -EIO for it.
3843 * The buffer is always NUL terminated, unless it's zero-sized.
3847 * **-E2BIG** if the buffer wasn't big enough (*buf* will contain
3850 * **-EINVAL** if sysctl is being read.
3865 * **-E2BIG** if the *buf_len* is too big.
3867 * **-EINVAL** if sysctl is being read.
3877 * optional '**-**' sign.
3886 * no more than *buf_len*.
3888 * **-EINVAL** if no valid digits were found or unsupported base
3891 * **-ERANGE** if resulting value was out of range.
3909 * no more than *buf_len*.
3911 * **-EINVAL** if no valid digits were found or unsupported base
3914 * **-ERANGE** if resulting value was out of range.
3918 * Get a bpf-local-storage from a *sk*.
3928 * the *map*. The *map* is used as the bpf-local-storage
3929 * "type". The bpf-local-storage "type" (i.e. the *map*) is
3930 * searched against all bpf-local-storages residing at *sk*.
3936 * used such that a new bpf-local-storage will be
3939 * the initial value of a bpf-local-storage. If *value* is
3940 * **NULL**, the new bpf-local-storage will be zero initialized.
3942 * A bpf-local-storage pointer is returned on success.
3945 * a new bpf-local-storage.
3949 * Delete a bpf-local-storage from a *sk*.
3953 * **-ENOENT** if the bpf-local-storage cannot be found.
3954 * **-EINVAL** if sk is not a fullsock (e.g. a request_sock).
3963 * **-EBUSY** if work queue under nmi is full.
3965 * **-EINVAL** if *sig* is invalid.
3967 * **-EPERM** if no permission to send the *sig*.
3969 * **-EAGAIN** if bpf program can try again.
3990 * **-EINVAL** SYN cookie cannot be issued due to error
3992 * **-ENOENT** SYN cookie should not be issued (no SYN flood)
3994 * **-EOPNOTSUPP** kernel configuration does not enable SYN cookies
3996 * **-EPROTONOSUPPORT** IP packet version is not 4 or 6
4015 * *ctx* is a pointer to in-kernel struct sk_buff.
4042 * string length is larger than *size*, just *size*-1 bytes are
4057 * ctx->di);
4072 * *current*\ **->mm->arg_start** and *current*\
4073 * **->mm->env_start**: using this helper and the return value,
4090 * Send out a tcp-ack. *tp* is the in-kernel struct **tcp_sock**.
4101 * **-EBUSY** if work queue under nmi is full.
4103 * **-EINVAL** if *sig* is invalid.
4105 * **-EPERM** if no permission to send the *sig*.
4107 * **-EAGAIN** if bpf program can try again.
4129 * **-EINVAL** if arguments invalid or **size** not a multiple
4132 * **-ENOENT** if architecture does not support branch records.
4141 * **-EINVAL** if dev and inum supplied don't match dev_t and inode number
4144 * **-ENOENT** if pidns does not exists for the current task.
4163 * *ctx* is a pointer to in-kernel struct xdp_buff.
4181 * A 8-byte long opaque number.
4220 * **-EINVAL** if specified *flags* are not supported.
4222 * **-ENOENT** if the socket is unavailable for assignment.
4224 * **-ENETUNREACH** if the socket is unreachable (wrong netns).
4226 * **-EOPNOTSUPP** if the operation is not supported, for example
4242 * that are not v6-only can be selected for IPv4 packets.
4255 * load-balancing within reuseport group for the socket
4258 * On success *ctx->sk* will point to the selected socket.
4263 * * **-EAFNOSUPPORT** if socket family (*sk->family*) is
4264 * not compatible with packet family (*ctx->family*).
4266 * * **-EEXIST** if socket has been already selected,
4270 * * **-EINVAL** if unsupported flags were specified.
4272 * * **-EPROTOTYPE** if socket L4 protocol
4273 * (*sk->protocol*) doesn't match packet protocol
4274 * (*ctx->protocol*).
4276 * * **-ESOCKTNOSUPPORT** if socket is not in allowed
4296 * The *data_len* is the size of *data* in bytes - must be a multiple of 8.
4307 * **-EBUSY** if per-CPU memory copy buffer is busy, can try again
4310 * **-EINVAL** if arguments are invalid, or if *fmt* is invalid/unsupported.
4312 * **-E2BIG** if *fmt* contains too many format specifiers.
4314 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
4324 * **-EOVERFLOW** if an overflow happened: The same object will be tried again.
4330 * *sk* must be a non-**NULL** pointer to a socket, e.g. one
4361 * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification
4368 * An adaptive notification is a notification sent whenever the user-space
4369 * process has caught up and consumed all available payloads. In case the user-space
4370 * process is still processing a previous payload, then no notification is needed
4386 * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification
4400 * If **BPF_RB_NO_WAKEUP** is specified in *flags*, no notification
4446 * * **BPF_CSUM_LEVEL_INC**: Increases skb->csum_level for skbs
4448 * * **BPF_CSUM_LEVEL_DEC**: Decreases skb->csum_level for skbs
4450 * * **BPF_CSUM_LEVEL_RESET**: Resets skb->csum_level to 0 and
4452 * * **BPF_CSUM_LEVEL_QUERY**: No-op, returns the current
4453 * skb->csum_level.
4456 * case of **BPF_CSUM_LEVEL_QUERY**, the current skb->csum_level
4457 * is returned or the error code -EACCES in case the skb is not
4519 * The non-negative copied *buf* length equal to or less than
4528 * *skops*\ **->skb_data**. The comment in **struct bpf_sock_ops**
4530 * *skops*\ **->op**.
4540 * the 2nd byte which is "kind-length" of a TCP
4541 * header option and the "kind-length" also
4542 * includes the first 2 bytes "kind" and "kind-length"
4551 * Note, kind-length must be 0 for regular option.
4553 * Searching for No-Op (0) and End-of-Option-List (1) are
4562 * saved_syn packet or the just-received syn packet.
4569 * **-EINVAL** if a parameter is invalid.
4571 * **-ENOMSG** if the option is not found.
4573 * **-ENOENT** if no syn packet is available when
4576 * **-ENOSPC** if there is not enough space. Only *len* number of
4579 * **-EFAULT** on failure to parse the header options in the
4582 * **-EPERM** if the helper cannot be used under the current
4583 * *skops*\ **->op**.
4591 * includes the kind, kind-length, and the actual
4592 * option data. The *len* must be at least kind-length
4593 * long. The kind-length does not have to be 4 byte
4595 * and setting the 4 bytes aligned value to th->doff.
4606 * **-EINVAL** If param is invalid.
4608 * **-ENOSPC** if there is not enough space in the header.
4611 * **-EEXIST** if the option already exists.
4613 * **-EFAULT** on failure to parse the existing header options.
4615 * **-EPERM** if the helper cannot be used under the current
4616 * *skops*\ **->op**.
4633 * **-EINVAL** if a parameter is invalid.
4635 * **-ENOSPC** if there is not enough space in the header.
4637 * **-EPERM** if the helper cannot be used under the current
4638 * *skops*\ **->op**.
4652 * the *map*. The *map* is used as the bpf-local-storage
4653 * "type". The bpf-local-storage "type" (i.e. the *map*) is
4674 * **-ENOENT** if the bpf_local_storage cannot be found.
4697 * Use BTF to store a string representation of *ptr*->ptr in *str*,
4698 * using *ptr*->type_id. This value should specify the type
4699 * that *ptr*->ptr points to. LLVM __builtin_btf_type_id(type, 1)
4702 * stored in the first *str_size* - 1 bytes of *str*. Safe copy of
4716 * no formatting around type information
4718 * no struct/union member names/types
4723 * show zero-valued struct/union members; they
4734 * *ptr*->ptr, using *ptr*->type_id as per bpf_snprintf_btf().
4826 * the *map*. The *map* is used as the bpf-local-storage
4827 * "type". The bpf-local-storage "type" (i.e. the *map*) is
4848 * **-ENOENT** if the bpf_local_storage cannot be found.
4866 * **-EINVAL** if invalid *flags* are passed, zero otherwise.
4870 * Return a coarse-grained version of the time elapsed since
4885 * **-EOPNOTSUP** if IMA is disabled or **-EINVAL** if
4920 * this value is L3 as this correlate to MTU and IP-header tot_len
4939 * possible for the skb packet to get re-segmented
4949 * MTU value in your BPF-code.
4966 * **map**, **callback_ctx** and other map-specific parameters.
4989 * The number of traversed map elements for success, **-EINVAL** for
4995 * based on a format string stored in a read-only map pointed by
5001 * array. The *data_len* is the size of *data* in bytes - must be
5016 * be zero-terminated except when **str_size** is 0.
5018 * Or **-EBUSY** if the per-CPU memory copy buffer is busy.
5048 * **-EBUSY** if *timer* is already initialized.
5049 * **-EINVAL** if invalid *flags* are passed.
5050 * **-EPERM** if *timer* is in a map that doesn't have any user references.
5060 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
5061 * **-EPERM** if *timer* is in a map that doesn't have any user references.
5077 * decremented. This is done to make sure that Ctrl-C of a user
5079 * bpffs the callback_fn can re-arm itself indefinitely.
5082 * The map can contain timers that invoke callback_fn-s from different
5095 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier
5104 * **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
5105 * **-EDEADLK** if callback_fn tried to call bpf_timer_cancel() on its
5128 * - kprobe/uprobe;
5129 * - tracepoint;
5130 * - perf_event.
5158 * **-EINVAL** if *flags* is not zero.
5160 * **-ENOENT** if architecture does not support branch records.
5185 * **-EINVAL** if *flags* is not zero.
5187 * **-EINVAL** if string *name* is not the same size as *name_sz*.
5189 * **-ENOENT** if symbol is not found.
5191 * **-EPERM** if caller does not have permission to obtain kernel address.
5208 * **-ENOENT** if *task->mm* is NULL, or no vma contains *addr*.
5209 * **-EBUSY** if failed to try lock mmap_lock.
5210 * **-EINVAL** for invalid **flags**.
5225 * is zero-indexed.
5233 * The number of loops performed, **-EINVAL** for invalid **flags**,
5234 * **-E2BIG** if **nr_loops** exceeds the maximum number of loops.
5239 * to be null-terminated and **s1_sz** is the maximum storage
5240 * size of **s1**. **s2** must be a read-only string.
5248 * Get **n**-th argument register (zero based) of the traced function (for tracing programs)
5253 * **-EINVAL** if n >= argument register count of traced function.
5262 * **-EOPNOTSUPP** for tracing programs other than BPF_TRACE_FEXIT or BPF_MODIFY_RETURN.
5291 * bpf_set_retval(-EPERM);
5294 * In this case, the BPF program's return value will use helper's -EPERM. This
5334 * Change the __sk_buff->tstamp_type to *tstamp_type*
5335 * and set *tstamp* to the __sk_buff->tstamp together.
5337 * If there is no need to change the __sk_buff->tstamp_type,
5338 * the tstamp value can be directly written to __sk_buff->tstamp
5349 * Only IPv4 and IPv6 skb->protocol are supported.
5352 * mono delivery time to __sk_buff->tstamp and then
5354 * changing the (rcv) timestamp in __sk_buff->tstamp at
5356 * to sch_fq@phy-dev.
5359 * **-EINVAL** for invalid input
5360 * **-EOPNOTSUPP** for unsupported protocol
5369 * **-EOPNOTSUP** if the hash calculation failed or **-EINVAL** if
5388 * Map value associated to *key* on *cpu*, or **NULL** if no entry
5405 * 0 on success, -E2BIG if the size exceeds DYNPTR_MAX_SIZE,
5406 * -EINVAL if flags is not 0.
5422 * through the dynptr interface. This is a no-op if the dynptr is
5433 * interface. This is a no-op if the dynptr is invalid/null.
5446 * 0 on success, -E2BIG if *offset* + *len* exceeds the length
5447 * of *src*'s data, -EINVAL if *src* is an invalid dynptr or if
5455 * *flags* must be 0 except for skb-type dynptrs.
5457 * For skb-type dynptrs:
5466 * 0 on success, -E2BIG if *offset* + *len* exceeds the length
5467 * of *dst*'s data, -EINVAL if *dst* is an invalid dynptr or if *dst*
5468 * is a read-only dynptr or if *flags* is not correct. For skb-type dynptrs,
5482 * read-only, if the dynptr is invalid, or if the offset and length
5503 * **-EINVAL** if *th_len* is invalid.
5523 * **-EINVAL** if *th_len* is invalid.
5525 * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
5540 * **-EACCES** if the SYN cookie is not valid.
5555 * **-EACCES** if the SYN cookie is not valid.
5557 * **-EPROTONOSUPPORT** if CONFIG_IPV6 is not builtin.
5561 * A nonsettable system-wide clock derived from wall-clock time but
5584 * The number of drained samples if no error was encountered while
5585 * draining samples, or 0 if no samples were present in the ring
5586 * buffer. If a user-space producer was epoll-waiting on this map,
5590 * function, no wakeup notification will be sent. If the
5592 * be sent even if no sample was drained.
5596 * **-EBUSY** if the ring buffer is contended, and another calling
5599 * **-EINVAL** if user-space is not properly tracking the ring
5604 * **-E2BIG** if user-space has tried to publish a sample which is
5619 * In reality, the local-storage value is embedded directly inside of the
5621 * **BPF_MAP_TYPE_CGRP_STORAGE** map. When the local-storage value is
5623 * O(n) iteration over all of the live local-storage values for that
5624 * *cgroup* object until the local-storage value for the *map* is found.
5644 * **-ENOENT** if the bpf_local_storage cannot be found.
5861 /* backwards-compatibility macros for users of __BPF_FUNC_MAPPER that don't
5945 BPF_F_CURRENT_NETNS = (-1L),
6067 * and try to deduce it by ingress, egress or skb->sk->sk_clockid.
6071 /* user accessible mirror of in-kernel sk_buff.
6135 /* user accessible mirror of in-kernel xfrm_state.
6150 * The values are binary compatible with their TC_ACT_* counter-part to
6160 /* 3-6 reserved */
6172 * to indicate that no custom dissection was performed, and
6185 /* IP address also allows 1 and 2 bytes access */
6262 * their TC_ACT_* counter-parts. For compatibility in behavior, unknown
6266 TCX_NEXT = -1,
6298 /* Below access go through struct xdp_rxq_info */
6299 __u32 ingress_ifindex; /* rxq->dev->ifindex */
6300 __u32 rx_queue_index; /* rxq->queue_index */
6302 __u32 egress_ifindex; /* txq->dev->ifindex */
6305 /* DEVMAP map-value layout
6307 * The struct data-layout of map-value is a configuration interface.
6318 /* CPUMAP map-value layout
6320 * The struct data-layout of map-value is a configuration interface.
6365 * Note that the directly accessible bytes (data_end - data)
6378 /* When reuse->migrating_sk is NULL, it is selecting a sk for the
6380 * the received SYN in the TCP case). reuse->sk is one of the sk
6381 * in the reuseport group. The bpf prog can use reuse->sk to learn
6384 * When reuse->migrating_sk is not NULL, reuse->sk is closed and
6385 * reuse->migrating_sk is the socket that needs to be migrated
6387 * sk that is fully established or a reqsk that is in-the-middle
6388 * of 3-way handshake.
6561 /* User bpf_sock_addr struct to access socket fields and sockaddr struct passed
6566 __u32 user_family; /* Allows 4-byte read, but no write. */
6567 __u32 user_ip4; /* Allows 1,2,4-byte read and 4-byte write.
6570 __u32 user_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
6573 __u32 user_port; /* Allows 1,2,4-byte read and 4-byte write.
6576 __u32 family; /* Allows 4-byte read, but no write */
6577 __u32 type; /* Allows 4-byte read, but no write */
6578 __u32 protocol; /* Allows 4-byte read, but no write */
6579 __u32 msg_src_ip4; /* Allows 1,2,4-byte read and 4-byte write.
6582 __u32 msg_src_ip6[4]; /* Allows 1,2,4,8-byte read and 4,8-byte write.
6588 /* User bpf_sock_ops struct to access socket values and specify request ops
6678 * called under sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB
6686 * mode and required the active side to resend the bpf-written
6687 * options. The active side can keep writing the bpf-options until
6698 * sock_ops->op == BPF_SOCK_OPS_PARSE_HDR_OPT_CB.
6708 * sock_ops->op == BPF_SOCK_OPS_HDR_OPT_LEN_CB. Then
6710 * under sock_ops->op == BPF_SOCK_OPS_WRITE_HDR_OPT_CB.
6729 BPF_SOCK_OPS_TIMEOUT_INIT, /* Should return SYN-RTO value to use or
6730 * -1 if default value should be used
6733 * window (in packets) or -1 if default
6783 * sock_ops->skb_data:
6797 * sock_ops->skb_data:
6798 * Not available because no header has
6801 * sock_ops->skb_tcp_flags:
6812 * sock_ops->skb_data:
6817 * earlier bpf-progs.
6819 * sock_ops->skb_tcp_flags:
6832 * earlier bpf-progs.
6870 * 1. the just-received SYN packet (only available when writing the
6884 * If the bpf-prog does not need the IP[46] header, the
6885 * bpf-prog can avoid parsing the IP header by using
6886 * TCP_BPF_SYN. Otherwise, the bpf-prog can get both
6890 * -ENOSPC: Not enough space in optval. Only optlen number of
6892 * -ENOENT: The SYN skb is not available now and the earlier SYN pkt
6912 * MSS. No skb is actually
6948 /* DIRECT: Skip the FIB rules and go to FIB table associated with device
6966 BPF_FIB_LKUP_RET_NO_NEIGH, /* no neighbor entry for nh */
6976 /* set if lookup is to consider L4 data - e.g., FIB rules */
6983 __u16 tot_len; /* L3 length from network hdr (iph->tot_len) */
7051 BPF_MTU_CHK_RET_SEGS_TOOBIG, /* GSO re-segmentation needed to fwd */
7152 * Allows 1,2,4-byte read, but no write.
7155 * Allows 1,2,4-byte read an 4-byte write.
7179 __u64 cookie; /* Non-zero if socket was selected in PROG_TEST_RUN */
7197 * via the bpf_snprintf_btf() helper described above. A flags field -
7199 * (rather than its mode of display) - is included for future use.
7200 * Display flags - BTF_F_* - are passed to bpf_snprintf_btf separately.
7210 * - BTF_F_COMPACT: no formatting around type information
7211 * - BTF_F_NONAME: no struct/union member names/types
7212 * - BTF_F_PTR_RAW: show raw (unobfuscated) pointer values;
7214 * - BTF_F_ZERO: show zero-valued struct/union members; they
7232 BPF_CORE_FIELD_SIGNED = 3, /* field signedness (0 - unsigned, 1 - signed) */
7233 BPF_CORE_FIELD_LSHIFT_U64 = 4, /* bitfield-specific left bitshift */
7234 BPF_CORE_FIELD_RSHIFT_U64 = 5, /* bitfield-specific right bitshift */
7248 * CO-RE relocation captures the following data:
7249 * - insn_off - instruction offset (in bytes) within a BPF program that needs
7250 * its insn->imm field to be relocated with actual field info;
7251 * - type_id - BTF type ID of the "root" (containing) entity of a relocatable
7253 * - access_str_off - offset into corresponding .BTF string section. String
7255 * - for field-based relocations, string encodes an accessed field using
7259 * - for type-based relocations, strings is expected to be just "0";
7260 * - for enum value-based relocations, string contains an index of enum
7262 * - kind - one of enum bpf_core_relo_kind;
7273 * int *x = &s->a; // encoded as "0:0" (a is field #0)
7274 * int *y = &s->b[5]; // encoded as "0:1:0:5" (anon struct is field #1,
7276 * int *z = &s[10]->b; // encoded as "10:1" (ptr is used as an array)
7282 * Clang built-in, passing expression that captures field address, e.g.:
7285 * __builtin_preserve_access_index(&src->a.b.c));
7290 * [0] https://llvm.org/docs/LangRef.html#getelementptr-instruction
7301 * - BPF_F_TIMER_ABS: Timeout passed is absolute time, by default it is