eBPF Helpers
eBPF Helpers sorted by Release Date
The following table provides a comprehensive overview of eBPF helper functions, organized by the Linux kernel version in which they were introduced, from 3.19 to 6.2. Each entry includes the helper’s name, the kernel version, a link to the corresponding commit in the Linux kernel Git repository, and a brief description of its functionality.
These helpers are critical for BPF programs, enabling tasks such as network packet manipulation, system tracing, and security policy enforcement. Sorted in ascending order by kernel version, the table highlights the evolution of BPF capabilities.
map_delete_elem
3.19
Deletes an element from a BPF map by key.
map_lookup_elem
3.19
Looks up an element in a BPF map by key, returning a pointer to the value.
map_update_elem
3.19
Updates or inserts an element in a BPF map.
get_prandom_u32
4.1
Returns a pseudo-random 32-bit integer.
get_smp_processor_id
4.1
Returns the ID of the current CPU.
ktime_get_ns
4.1
Returns the current time in nanoseconds since boot.
l3_csum_replace
4.1
Replaces the layer 3 checksum in a packet.
l4_csum_replace
4.1
Replaces the layer 4 checksum in a packet.
probe_read
4.1
Safely reads kernel or user memory into a buffer.
skb_store_bytes
4.1
Stores bytes into a packet at a specified offset.
trace_printk
4.1
Prints formatted debug output to the trace buffer.
clone_redirect
4.2
Clones a packet and redirects it to an interface.
get_current_comm
4.2
Returns the name of the current process.
get_current_pid_tgid
4.2
Returns the PID and TGID of the current task.
get_current_uid_gid
4.2
Returns the UID and GID of the current task.
tail_call
4.2
Jumps to another BPF program in the same map.
get_cgroup_classid
4.3
Returns the class ID of the current cgroup.
perf_event_read
4.3
Reads a performance counter value.
skb_get_tunnel_key
4.3
Retrieves the tunnel key from a packet.
skb_set_tunnel_key
4.3
Sets the tunnel key for a packet.
skb_vlan_pop
4.3
Removes a VLAN tag from a packet.
skb_vlan_push
4.3
Adds a VLAN tag to a packet.
get_route_realm
4.4
Returns the routing realm of a packet.
perf_event_output
4.4
Outputs data to a perf event buffer.
redirect
4.4
Redirects a packet to a specified interface.
skb_load_bytes
4.5
Loads bytes from a packet into a buffer.
csum_diff
4.6
Computes checksum difference between two buffers.
get_stackid
4.6
Returns a unique ID for the current stack trace.
skb_get_tunnel_opt
4.6
Retrieves tunnel options from a packet.
skb_set_tunnel_opt
4.6
Sets tunnel options for a packet.
get_current_task
4.8
Returns a pointer to the current task structure.
get_hash_recalc
4.8
Recalculates the hash for a socket buffer.
probe_write_user
4.8
Safely writes data to user space memory.
skb_change_proto
4.8
Changes the protocol of a packet.
skb_change_type
4.8
Changes the type of a packet.
skb_under_cgroup
4.8
Checks if a packet belongs to a cgroup.
csum_update
4.9
Updates the checksum of a packet.
current_task_under_cgroup
4.9
Checks if the current task is in a specified cgroup.
set_hash_invalid
4.9
Invalidates the hash of a socket buffer.
skb_change_tail
4.9
Adjusts the tail pointer of a packet.
skb_pull_data
4.9
Pulls data from a packet, adjusting pointers.
get_numa_node_id
4.10
Returns the NUMA node ID of the current CPU.
skb_change_head
4.10
Adjusts the head pointer of a packet.
xdp_adjust_head
4.10
Adjusts the head of an XDP buffer.
probe_read_str
4.11
Safely reads a null-terminated string from memory.
get_socket_cookie
4.12
Returns a unique cookie for a socket.
get_socket_uid
4.12
Returns the UID of a socket’s owner.
set_hash
4.13
Sets the hash value for a socket buffer.
skb_adjust_room
4.13
Adjusts the room in a packet for data.
setsockopt
4.13
Sets socket options for a socket.
redirect_map
4.14
Redirects a packet using a BPF map.
sock_map_update
4.14
Updates a socket map with a socket.
getsockopt
4.15
Retrieves socket options from a socket.
perf_event_read_value
4.15
Reads a performance counter with additional metadata.
perf_prog_read_value
4.15
Reads performance program-specific values.
xdp_adjust_meta
4.15
Adjusts the metadata of an XDP buffer.
override_return
4.16
Overrides the return value of a function.
sock_ops_cb_flags_set
4.16
Sets callback flags for socket operations.
bind
4.17
Binds a socket to an address.
msg_apply_bytes
4.17
Applies bytes to a socket message.
msg_cork_bytes
4.17
Corks bytes for a socket message.
msg_pull_data
4.17
Pulls data from a socket message.
msg_redirect_map
4.17
Redirects a socket message using a BPF map.
fib_lookup
4.18
Performs a FIB (Forwarding Information Base) lookup.
get_current_cgroup_id
4.18
Returns the ID of the current cgroup.
get_stack
4.18
Captures the current stack trace.
lwt_push_encap
4.18
Pushes encapsulation headers for LWT (Lightweight Tunneling).
lwt_seg6_action
4.18
Performs Segment Routing v6 actions.
lwt_seg6_adjust_srh
4.18
Adjusts the Segment Routing Header (SRH).
lwt_seg6_store_bytes
4.18
Stores bytes in a Segment Routing v6 packet.
rc_keydown
4.18
Sends a remote control key press event.
rc_repeat
4.18
Sends a remote control repeat event.
sk_redirect_hash
4.18
Redirects a socket using a hash-based map.
skb_cgroup_id
4.18
Returns the cgroup ID of a packet.
skb_get_xfrm_state
4.18
Retrieves the XFRM (IPsec) state of a packet.
skb_load_bytes_relative
4.18
Loads bytes from a packet relative to a header.
sock_hash_update
4.18
Updates a socket hash map.
xdp_adjust_tail
4.18
Adjusts the tail of an XDP buffer.
get_local_storage
4.19
Retrieves per-CPU local storage for a task.
sk_select_reuseport
4.19
Selects a reuseport socket for load balancing.
skb_ancestor_cgroup_id
4.19
Returns the cgroup ID of a packet’s ancestor.
map_peek_elem
4.20
Peeks at an element in a queue or stack map.
map_pop_elem
4.20
Pops an element from a queue or stack map.
map_push_elem
4.20
Pushes an element onto a queue or stack map.
msg_push_data
4.20
Pushes data into a socket message.
sk_lookup_tcp
4.20
Looks up a TCP socket by address and port.
sk_lookup_udp
4.20
Looks up a UDP socket by address and port.
sk_release
4.20
Releases a socket reference.
msg_pop_data
5.0
Pops data from a socket message.
rc_pointer_rel
5.0
Adjusts the pointer for a remote control event.
get_listener_sock
5.1
Retrieves the listener socket for a connection.
sk_fullsock
5.1
Returns the full socket structure.
skb_ecn_set_ce
5.1
Sets the ECN Congestion Experienced flag.
spin_lock
5.1
Acquires a spinlock for synchronization.
spin_unlock
5.1
Releases a spinlock.
tcp_sock
5.1
Returns the TCP socket structure.
sk_storage_delete
5.2
Deletes storage associated with a socket.
sk_storage_get
5.2
Retrieves storage associated with a socket.
skc_lookup_tcp
5.2
Looks up a TCP socket in a specific context.
strtol
5.2
Converts a string to a long integer.
strtoul
5.2
Converts a string to an unsigned long integer.
sysctl_get_current_value
5.2
Retrieves the current sysctl value.
sysctl_get_name
5.2
Retrieves the name of a sysctl.
sysctl_get_new_value
5.2
Retrieves the new sysctl value during a change.
sysctl_set_new_value
5.2
Sets a new sysctl value.
tcp_check_syncookie
5.2
Checks a TCP SYN cookie for validity.
send_signal
5.3
Sends a signal to a process.
tcp_gen_syncookie
5.3
Generates a TCP SYN cookie.
jiffies64
5.5
Returns the 64-bit jiffies counter.
probe_read_kernel
5.5
Safely reads kernel memory.
probe_read_kernel_str
5.5
Safely reads a kernel string.
probe_read_user
5.5
Safely reads user space memory.
probe_read_user_str
5.5
Safely reads a user space string.
send_signal_thread
5.5
Sends a signal to a specific thread.
skb_output
5.5
Outputs a packet to a network device.
tcp_send_ack
5.5
Sends a TCP ACK packet.
get_current_ancestor_cgroup_id
5.6
Returns the ID of an ancestor cgroup.
read_branch_records
5.6
Reads branch records for profiling.
sk_assign
5.6
Assigns a socket to a specific context.
xdp_output
5.6
Outputs an XDP buffer to a network device.
csum_level
5.7
Updates checksums for a specific protocol level.
get_netns_cookie
5.7
Returns a cookie for the current network namespace.
get_ns_current_pid_tgid
5.7
Returns PID and TGID in a specific namespace.
seq_printf
5.7
Prints formatted output to a seq_file.
seq_write
5.7
Writes raw data to a seq_file.
sk_ancestor_cgroup_id
5.7
Returns the ID of a socket’s ancestor cgroup.
sk_cgroup_id
5.7
Returns the cgroup ID of a socket.
ktime_get_boot_ns
5.8
Returns boot time in nanoseconds.
ringbuf_discard
5.8
Discards a reserved ring buffer entry.
ringbuf_output
5.8
Outputs data to a ring buffer.
ringbuf_query
5.8
Queries ring buffer status.
ringbuf_reserve
5.8
Reserves space in a ring buffer.
ringbuf_submit
5.8
Submits a ring buffer entry.
get_task_stack
5.9
Retrieves the stack of a specified task.
skc_to_tcp_sock
5.9
Converts a socket context to a TCP socket.
skc_to_tcp_request_sock
5.9
Converts a socket context to a TCP request socket.
skc_to_tcp_timewait_sock
5.9
Converts a socket context to a TCP timewait socket.
skc_to_tcp6_sock
5.9
Converts a socket context to a TCPv6 socket.
skc_to_udp6_sock
5.9
Converts a socket context to a UDPv6 socket.
copy_from_user
5.10
Copies data from user space to kernel space.
d_path
5.10
Returns the path of a dentry.
inode_storage_delete
5.10
Deletes storage associated with an inode.
inode_storage_get
5.10
Retrieves storage associated with an inode.
load_hdr_opt
5.10
Loads header options for a packet.
per_cpu_ptr
5.10
Returns a pointer to per-CPU data.
redirect_neigh
5.10
Redirects a packet to a neighbor.
redirect_peer
5.10
Redirects a packet to a peer.
reserve_hdr_opt
5.10
Reserves space for header options.
seq_printf_btf
5.10
Prints BTF-formatted data to a seq_file.
skb_cgroup_classid
5.10
Returns the class ID of a packet’s cgroup.
snprintf_btf
5.10
Formats BTF data into a string.
store_hdr_opt
5.10
Stores header options for a packet.
this_cpu_ptr
5.10
Returns a pointer to data on the current CPU.
bprm_opts_set
5.11
Sets options for a binary process.
get_current_task_btf
5.11
Returns the current task in BTF format.
ima_inode_hash
5.11
Computes the IMA hash of an inode.
ktime_get_coarse_ns
5.11
Returns coarse-grained time in nanoseconds.
sock_from_file
5.11
Retrieves a socket from a file descriptor.
task_storage_delete
5.11
Deletes storage associated with a task.
task_storage_get
5.11
Retrieves storage associated with a task.
check_mtu
5.12
Checks the MTU for a network device.
for_each_map_elem
5.13
Iterates over elements in a BPF map.
snprintf
5.13
Formats a string with a specified buffer size.
btf_find_by_name_kind
5.14
Finds a BTF type by name and kind.
sys_bpf
5.14
Executes a BPF system call from a program.
sys_close
5.14
Closes a file descriptor.
get_attach_cookie
5.15
Retrieves a cookie for a BPF attachment.
get_func_ip
5.15
Returns the instruction pointer of a function.
task_pt_regs
5.15
Returns the registers of a task.
timer_cancel
5.15
Cancels a BPF timer.
timer_init
5.15
Initializes a BPF timer.
timer_set_callback
5.15
Sets the callback for a BPF timer.
timer_start
5.15
Starts a BPF timer.
get_branch_snapshot
5.16
Captures a snapshot of branch records.
kallsyms_lookup_name
5.16
Looks up a kernel symbol by name.
skc_to_unix_sock
5.16
Converts a socket context to a UNIX socket.
trace_vprintk
5.16
Prints variable arguments to the trace buffer.
find_vma
5.17
Finds a virtual memory area for an address.
get_func_arg
5.17
Retrieves a function argument by index.
get_func_arg_cnt
5.17
Returns the number of function arguments.
get_func_ret
5.17
Retrieves the return value of a function.
loop
5.17
Executes a bounded loop in a BPF program.
strncmp
5.17
Compares two strings up to a specified length.
copy_from_user_task
5.18
Copies data from a task’s user space.
get_retval
5.18
Retrieves the return value of a program.
ima_file_hash
5.18
Computes the IMA hash of a file.
set_retval
5.18
Sets the return value of a program.
skb_set_tstamp
5.18
Sets the timestamp of a packet.
xdp_get_buff_len
5.18
Returns the length of an XDP buffer.
xdp_load_bytes
5.18
Loads bytes from an XDP buffer.
xdp_store_bytes
5.18
Stores bytes in an XDP buffer.
dynptr_data
5.19
Retrieves data from a dynamic pointer.
dynptr_from_mem
5.19
Creates a dynamic pointer from memory.
dynptr_read
5.19
Reads data from a dynamic pointer.
dynptr_write
5.19
Writes data to a dynamic pointer.
kptr_xchg
5.19
Exchanges a kernel pointer atomically.
map_lookup_percpu_elem
5.19
Looks up a per-CPU element in a map.
ringbuf_discard_dynptr
5.19
Discards a ring buffer entry via a dynamic pointer.
ringbuf_reserve_dynptr
5.19
Reserves a ring buffer entry via a dynamic pointer.
ringbuf_submit_dynptr
5.19
Submits a ring buffer entry via a dynamic pointer.
skc_to_mctcp_sock
5.19
Converts a socket context to an MCTCP socket.
tcp_raw_check_syncookie_ipv4
6.0
Checks an IPv4 TCP SYN cookie in raw mode.
tcp_raw_check_syncookie_ipv6
6.0
Checks an IPv6 TCP SYN cookie in raw mode.
tcp_raw_gen_syncookie_ipv4
6.0
Generates an IPv4 TCP SYN cookie in raw mode.
tcp_raw_gen_syncookie_ipv6
6.0
Generates an IPv6 TCP SYN cookie in raw mode.
ktime_get_tai_ns
6.1
Returns TAI time in nanoseconds.
user_ringbuf_drain
6.1
Drains a user-space ring buffer.
cgrp_storage_delete
6.2
Deletes storage associated with a cgroup.
cgrp_storage_get
6.2
Retrieves storage associated with a cgroup.
Last updated