Skip to content

Commit 949a4e5

Browse files
sync with latest libbpf repo (#3529)
sync with latest libbpf repo which is upto commit 21f90f61b084 sync: latest libbpf changes from kernel Signed-off-by: Yonghong Song <[email protected]>
1 parent ef330a3 commit 949a4e5

File tree

6 files changed

+191
-12
lines changed

6 files changed

+191
-12
lines changed

docs/kernel-versions.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ Helper | Kernel version | License | Commit |
208208
-------|----------------|---------|--------|
209209
`BPF_FUNC_bind()` | 4.17 | | [`d74bad4e74ee`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=d74bad4e74ee373787a9ae24197c17b7cdc428d5) |
210210
`BPF_FUNC_bprm_opts_set()` | 5.11 | | [`3f6719c7b62f`](https://github.com/torvalds/linux/commit/3f6719c7b62f0327c9091e26d0da10e65668229e)
211+
`BPF_FUNC_btf_find_by_name_kind()` | 5.14 | | [`3d78417b60fb`](https://github.com/torvalds/linux/commit/3d78417b60fba249cc555468cb72d96f5cde2964)
211212
`BPF_FUNC_check_mtu()` | 5.12 | | [`34b2021cc616`](https://github.com/torvalds/linux/commit/34b2021cc61642d61c3cf943d9e71925b827941b)
212213
`BPF_FUNC_clone_redirect()` | 4.2 | | [`3896d655f4d4`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=3896d655f4d491c67d669a15f275a39f713410f8)
213214
`BPF_FUNC_copy_from_user()` | 5.10 | | [`07be4c4a3e7a`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=07be4c4a3e7a0db148e44b16c5190e753d1c8569)
@@ -226,6 +227,7 @@ Helper | Kernel version | License | Commit |
226227
`BPF_FUNC_get_current_task()` | 4.8 | GPL | [`606274c5abd8`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=606274c5abd8e245add01bc7145a8cbb92b69ba8)
227228
`BPF_FUNC_get_current_task_btf()` | 5.11 | GPL | [`3ca1032ab7ab`](https://github.com/torvalds/linux/commit/3ca1032ab7ab010eccb107aa515598788f7d93bb)
228229
`BPF_FUNC_get_current_uid_gid()` | 4.2 | | [`ffeedafbf023`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=ffeedafbf0236f03aeb2e8db273b3e5ae5f5bc89)
230+
`BPF_FUNC_get_func_ip()` | 5.15 | | [`5d8b583d04ae`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=5d8b583d04aedb3bd5f6d227a334c210c7d735f9)
229231
`BPF_FUNC_get_hash_recalc()` | 4.8 | | [`13c5c240f789`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=13c5c240f789bbd2bcacb14a23771491485ae61f)
230232
`BPF_FUNC_get_listener_sock()` | 5.1 | | [`dbafd7ddd623`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/dbafd7ddd62369b2f3926ab847cbf8fc40e800b7)
231233
`BPF_FUNC_get_local_storage()` | 4.19 | | [`cd3394317653`](https://github.com/torvalds/linux/commit/cd3394317653837e2eb5c5d0904a8996102af9fc)
@@ -352,6 +354,8 @@ Helper | Kernel version | License | Commit |
352354
`BPF_FUNC_store_hdr_opt()` | 5.10 | | [`0813a841566f`](https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit?id=0813a841566f0962a5551be7749b43c45f0022a0)
353355
`BPF_FUNC_strtol()` | 5.2 | | [`d7a4cb9b6705`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/d7a4cb9b6705a89937d12c8158a35a3145dc967a)
354356
`BPF_FUNC_strtoul()` | 5.2 | | [`d7a4cb9b6705`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/d7a4cb9b6705a89937d12c8158a35a3145dc967a)
357+
`BPF_FUNC_sys_bpf()` | 5.14 | | [`79a7f8bdb159`](https://github.com/torvalds/linux/commit/79a7f8bdb159d9914b58740f3d31d602a6e4aca8)
358+
`BPF_FUNC_sys_close()` | 5.14 | | [`3abea089246f`](https://github.com/torvalds/linux/commit/3abea089246f76c1517b054ddb5946f3f1dbd2c0)
355359
`BPF_FUNC_sysctl_get_current_value()` | 5.2 | | [`1d11b3016cec`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/1d11b3016cec4ed9770b98e82a61708c8f4926e7)
356360
`BPF_FUNC_sysctl_get_name()` | 5.2 | | [`808649fb787d`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/808649fb787d918a48a360a668ee4ee9023f0c11)
357361
`BPF_FUNC_sysctl_get_new_value()` | 5.2 | | [`4e63acdff864`](https://kernel.googlesource.com/pub/scm/linux/kernel/git/davem/net-next/+/4e63acdff864654cee0ac5aaeda3913798ee78f6)
@@ -364,6 +368,10 @@ Helper | Kernel version | License | Commit |
364368
`BPF_FUNC_tcp_send_ack()` | 5.5 | | [`206057fe020a`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=206057fe020ac5c037d5e2dd6562a9bd216ec765)
365369
`BPF_FUNC_tcp_sock()` | 5.1 | | [`655a51e536c0`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=655a51e536c09d15ffa3603b1b6fce2b45b85a1f)
366370
`BPF_FUNC_this_cpu_ptr()` | 5.10 | | [`63d9b80dcf2c`](https://github.com/torvalds/linux/commit/63d9b80dcf2c67bc5ade61cbbaa09d7af21f43f1) |
371+
`BPF_FUNC_timer_init()` | 5.15 | | [`b00628b1c7d5`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=b00628b1c7d595ae5b544e059c27b1f5828314b4)
372+
`BPF_FUNC_timer_set_callback()` | 5.15 | | [`b00628b1c7d5`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=b00628b1c7d595ae5b544e059c27b1f5828314b4)
373+
`BPF_FUNC_timer_start()` | 5.15 | | [`b00628b1c7d5`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=b00628b1c7d595ae5b544e059c27b1f5828314b4)
374+
`BPF_FUNC_timer_cancel()` | 5.15 | | [`b00628b1c7d5`](https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=b00628b1c7d595ae5b544e059c27b1f5828314b4)
367375
`BPF_FUNC_trace_printk()` | 4.1 | GPL | [`9c959c863f82`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9c959c863f8217a2ff3d7c296e8223654d240569)
368376
`BPF_FUNC_xdp_adjust_head()` | 4.10 | | [`17bedab27231`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=17bedab2723145d17b14084430743549e6943d03)
369377
`BPF_FUNC_xdp_adjust_meta()` | 4.15 | | [`de8f3a83b0a0`](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=de8f3a83b0a0fddb2cf56e7a718127e9619ea3da)

introspection/bps.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ static const char * const prog_type_strings[] = {
4747
[BPF_PROG_TYPE_EXT] = "ext",
4848
[BPF_PROG_TYPE_LSM] = "lsm",
4949
[BPF_PROG_TYPE_SK_LOOKUP] = "sk_lookup",
50+
[BPF_PROG_TYPE_SYSCALL] = "syscall",
5051
};
5152

5253
static const char * const map_type_strings[] = {

src/cc/compat/linux/virtual_bpf.h

Lines changed: 156 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,6 @@ union bpf_iter_link_info {
325325
* **BPF_PROG_TYPE_SK_LOOKUP**
326326
* *data_in* and *data_out* must be NULL.
327327
*
328-
* **BPF_PROG_TYPE_XDP**
329-
* *ctx_in* and *ctx_out* must be NULL.
330-
*
331328
* **BPF_PROG_TYPE_RAW_TRACEPOINT**,
332329
* **BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE**
333330
*
@@ -528,6 +525,15 @@ union bpf_iter_link_info {
528525
* Look up an element with the given *key* in the map referred to
529526
* by the file descriptor *fd*, and if found, delete the element.
530527
*
528+
* For **BPF_MAP_TYPE_QUEUE** and **BPF_MAP_TYPE_STACK** map
529+
* types, the *flags* argument needs to be set to 0, but for other
530+
* map types, it may be specified as:
531+
*
532+
* **BPF_F_LOCK**
533+
* Look up and delete the value of a spin-locked map
534+
* without returning the lock. This must be specified if
535+
* the elements contain a spinlock.
536+
*
531537
* The **BPF_MAP_TYPE_QUEUE** and **BPF_MAP_TYPE_STACK** map types
532538
* implement this command as a "pop" operation, deleting the top
533539
* element rather than one corresponding to *key*.
@@ -537,6 +543,10 @@ union bpf_iter_link_info {
537543
* This command is only valid for the following map types:
538544
* * **BPF_MAP_TYPE_QUEUE**
539545
* * **BPF_MAP_TYPE_STACK**
546+
* * **BPF_MAP_TYPE_HASH**
547+
* * **BPF_MAP_TYPE_PERCPU_HASH**
548+
* * **BPF_MAP_TYPE_LRU_HASH**
549+
* * **BPF_MAP_TYPE_LRU_PERCPU_HASH**
540550
*
541551
* Return
542552
* Returns zero on success. On error, -1 is returned and *errno*
@@ -838,6 +848,7 @@ enum bpf_cmd {
838848
BPF_PROG_ATTACH,
839849
BPF_PROG_DETACH,
840850
BPF_PROG_TEST_RUN,
851+
BPF_PROG_RUN = BPF_PROG_TEST_RUN,
841852
BPF_PROG_GET_NEXT_ID,
842853
BPF_MAP_GET_NEXT_ID,
843854
BPF_PROG_GET_FD_BY_ID,
@@ -938,6 +949,7 @@ enum bpf_prog_type {
938949
BPF_PROG_TYPE_EXT,
939950
BPF_PROG_TYPE_LSM,
940951
BPF_PROG_TYPE_SK_LOOKUP,
952+
BPF_PROG_TYPE_SYSCALL, /* a program that can execute syscalls */
941953
};
942954

943955
enum bpf_attach_type {
@@ -980,6 +992,8 @@ enum bpf_attach_type {
980992
BPF_SK_LOOKUP,
981993
BPF_XDP,
982994
BPF_SK_SKB_VERDICT,
995+
BPF_SK_REUSEPORT_SELECT,
996+
BPF_SK_REUSEPORT_SELECT_OR_MIGRATE,
983997
__MAX_BPF_ATTACH_TYPE
984998
};
985999

@@ -1098,24 +1112,28 @@ enum bpf_link_type {
10981112
/* When BPF ldimm64's insn[0].src_reg != 0 then this can have
10991113
* the following extensions:
11001114
*
1101-
* insn[0].src_reg: BPF_PSEUDO_MAP_FD
1102-
* insn[0].imm: map fd
1115+
* insn[0].src_reg: BPF_PSEUDO_MAP_[FD|IDX]
1116+
* insn[0].imm: map fd or fd_idx
11031117
* insn[1].imm: 0
11041118
* insn[0].off: 0
11051119
* insn[1].off: 0
11061120
* ldimm64 rewrite: address of map
11071121
* verifier type: CONST_PTR_TO_MAP
11081122
*/
11091123
#define BPF_PSEUDO_MAP_FD 1
1110-
/* insn[0].src_reg: BPF_PSEUDO_MAP_VALUE
1111-
* insn[0].imm: map fd
1124+
#define BPF_PSEUDO_MAP_IDX 5
1125+
1126+
/* insn[0].src_reg: BPF_PSEUDO_MAP_[IDX_]VALUE
1127+
* insn[0].imm: map fd or fd_idx
11121128
* insn[1].imm: offset into value
11131129
* insn[0].off: 0
11141130
* insn[1].off: 0
11151131
* ldimm64 rewrite: address of map[0]+offset
11161132
* verifier type: PTR_TO_MAP_VALUE
11171133
*/
1118-
#define BPF_PSEUDO_MAP_VALUE 2
1134+
#define BPF_PSEUDO_MAP_VALUE 2
1135+
#define BPF_PSEUDO_MAP_IDX_VALUE 6
1136+
11191137
/* insn[0].src_reg: BPF_PSEUDO_BTF_ID
11201138
* insn[0].imm: kernel btd id of VAR
11211139
* insn[1].imm: 0
@@ -1315,6 +1333,8 @@ union bpf_attr {
13151333
/* or valid module BTF object fd or 0 to attach to vmlinux */
13161334
__u32 attach_btf_obj_fd;
13171335
};
1336+
__u32 :32; /* pad */
1337+
__aligned_u64 fd_array; /* array of FDs */
13181338
};
13191339

13201340
struct { /* anonymous struct used by BPF_OBJ_* commands */
@@ -2535,8 +2555,12 @@ union bpf_attr {
25352555
* The lower two bits of *flags* are used as the return code if
25362556
* the map lookup fails. This is so that the return value can be
25372557
* one of the XDP program return codes up to **XDP_TX**, as chosen
2538-
* by the caller. Any higher bits in the *flags* argument must be
2539-
* unset.
2558+
* by the caller. The higher bits of *flags* can be set to
2559+
* BPF_F_BROADCAST or BPF_F_EXCLUDE_INGRESS as defined below.
2560+
*
2561+
* With BPF_F_BROADCAST the packet will be broadcasted to all the
2562+
* interfaces in the map, with BPF_F_EXCLUDE_INGRESS the ingress
2563+
* interface will be excluded when do broadcasting.
25402564
*
25412565
* See also **bpf_redirect**\ (), which only supports redirecting
25422566
* to an ifindex, but doesn't require a map to do so.
@@ -3223,7 +3247,7 @@ union bpf_attr {
32233247
* long bpf_sk_select_reuseport(struct sk_reuseport_md *reuse, struct bpf_map *map, void *key, u64 flags)
32243248
* Description
32253249
* Select a **SO_REUSEPORT** socket from a
3226-
* **BPF_MAP_TYPE_REUSEPORT_ARRAY** *map*.
3250+
* **BPF_MAP_TYPE_REUSEPORT_SOCKARRAY** *map*.
32273251
* It checks the selected socket is matching the incoming
32283252
* request in the socket buffer.
32293253
* Return
@@ -4736,6 +4760,94 @@ union bpf_attr {
47364760
* be zero-terminated except when **str_size** is 0.
47374761
*
47384762
* Or **-EBUSY** if the per-CPU memory copy buffer is busy.
4763+
*
4764+
* long bpf_sys_bpf(u32 cmd, void *attr, u32 attr_size)
4765+
* Description
4766+
* Execute bpf syscall with given arguments.
4767+
* Return
4768+
* A syscall result.
4769+
*
4770+
* long bpf_btf_find_by_name_kind(char *name, int name_sz, u32 kind, int flags)
4771+
* Description
4772+
* Find BTF type with given name and kind in vmlinux BTF or in module's BTFs.
4773+
* Return
4774+
* Returns btf_id and btf_obj_fd in lower and upper 32 bits.
4775+
*
4776+
* long bpf_sys_close(u32 fd)
4777+
* Description
4778+
* Execute close syscall for given FD.
4779+
* Return
4780+
* A syscall result.
4781+
*
4782+
* long bpf_timer_init(struct bpf_timer *timer, struct bpf_map *map, u64 flags)
4783+
* Description
4784+
* Initialize the timer.
4785+
* First 4 bits of *flags* specify clockid.
4786+
* Only CLOCK_MONOTONIC, CLOCK_REALTIME, CLOCK_BOOTTIME are allowed.
4787+
* All other bits of *flags* are reserved.
4788+
* The verifier will reject the program if *timer* is not from
4789+
* the same *map*.
4790+
* Return
4791+
* 0 on success.
4792+
* **-EBUSY** if *timer* is already initialized.
4793+
* **-EINVAL** if invalid *flags* are passed.
4794+
* **-EPERM** if *timer* is in a map that doesn't have any user references.
4795+
* The user space should either hold a file descriptor to a map with timers
4796+
* or pin such map in bpffs. When map is unpinned or file descriptor is
4797+
* closed all timers in the map will be cancelled and freed.
4798+
*
4799+
* long bpf_timer_set_callback(struct bpf_timer *timer, void *callback_fn)
4800+
* Description
4801+
* Configure the timer to call *callback_fn* static function.
4802+
* Return
4803+
* 0 on success.
4804+
* **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
4805+
* **-EPERM** if *timer* is in a map that doesn't have any user references.
4806+
* The user space should either hold a file descriptor to a map with timers
4807+
* or pin such map in bpffs. When map is unpinned or file descriptor is
4808+
* closed all timers in the map will be cancelled and freed.
4809+
*
4810+
* long bpf_timer_start(struct bpf_timer *timer, u64 nsecs, u64 flags)
4811+
* Description
4812+
* Set timer expiration N nanoseconds from the current time. The
4813+
* configured callback will be invoked in soft irq context on some cpu
4814+
* and will not repeat unless another bpf_timer_start() is made.
4815+
* In such case the next invocation can migrate to a different cpu.
4816+
* Since struct bpf_timer is a field inside map element the map
4817+
* owns the timer. The bpf_timer_set_callback() will increment refcnt
4818+
* of BPF program to make sure that callback_fn code stays valid.
4819+
* When user space reference to a map reaches zero all timers
4820+
* in a map are cancelled and corresponding program's refcnts are
4821+
* decremented. This is done to make sure that Ctrl-C of a user
4822+
* process doesn't leave any timers running. If map is pinned in
4823+
* bpffs the callback_fn can re-arm itself indefinitely.
4824+
* bpf_map_update/delete_elem() helpers and user space sys_bpf commands
4825+
* cancel and free the timer in the given map element.
4826+
* The map can contain timers that invoke callback_fn-s from different
4827+
* programs. The same callback_fn can serve different timers from
4828+
* different maps if key/value layout matches across maps.
4829+
* Every bpf_timer_set_callback() can have different callback_fn.
4830+
*
4831+
* Return
4832+
* 0 on success.
4833+
* **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier
4834+
* or invalid *flags* are passed.
4835+
*
4836+
* long bpf_timer_cancel(struct bpf_timer *timer)
4837+
* Description
4838+
* Cancel the timer and wait for callback_fn to finish if it was running.
4839+
* Return
4840+
* 0 if the timer was not active.
4841+
* 1 if the timer was active.
4842+
* **-EINVAL** if *timer* was not initialized with bpf_timer_init() earlier.
4843+
* **-EDEADLK** if callback_fn tried to call bpf_timer_cancel() on its
4844+
* own timer which would have led to a deadlock otherwise.
4845+
*
4846+
* u64 bpf_get_func_ip(void *ctx)
4847+
* Description
4848+
* Get address of the traced function (for tracing and kprobe programs).
4849+
* Return
4850+
* Address of the traced function.
47394851
*/
47404852
#define __BPF_FUNC_MAPPER(FN) \
47414853
FN(unspec), \
@@ -4904,6 +5016,14 @@ union bpf_attr {
49045016
FN(check_mtu), \
49055017
FN(for_each_map_elem), \
49065018
FN(snprintf), \
5019+
FN(sys_bpf), \
5020+
FN(btf_find_by_name_kind), \
5021+
FN(sys_close), \
5022+
FN(timer_init), \
5023+
FN(timer_set_callback), \
5024+
FN(timer_start), \
5025+
FN(timer_cancel), \
5026+
FN(get_func_ip), \
49075027
/* */
49085028

49095029
/* integer value in 'imm' field of BPF_CALL instruction selects which helper
@@ -5081,6 +5201,12 @@ enum {
50815201
BPF_F_BPRM_SECUREEXEC = (1ULL << 0),
50825202
};
50835203

5204+
/* Flags for bpf_redirect_map helper */
5205+
enum {
5206+
BPF_F_BROADCAST = (1ULL << 3),
5207+
BPF_F_EXCLUDE_INGRESS = (1ULL << 4),
5208+
};
5209+
50845210
#define __bpf_md_ptr(type, name) \
50855211
union { \
50865212
type name; \
@@ -5365,6 +5491,20 @@ struct sk_reuseport_md {
53655491
__u32 ip_protocol; /* IP protocol. e.g. IPPROTO_TCP, IPPROTO_UDP */
53665492
__u32 bind_inany; /* Is sock bound to an INANY address? */
53675493
__u32 hash; /* A hash of the packet 4 tuples */
5494+
/* When reuse->migrating_sk is NULL, it is selecting a sk for the
5495+
* new incoming connection request (e.g. selecting a listen sk for
5496+
* the received SYN in the TCP case). reuse->sk is one of the sk
5497+
* in the reuseport group. The bpf prog can use reuse->sk to learn
5498+
* the local listening ip/port without looking into the skb.
5499+
*
5500+
* When reuse->migrating_sk is not NULL, reuse->sk is closed and
5501+
* reuse->migrating_sk is the socket that needs to be migrated
5502+
* to another listening socket. migrating_sk could be a fullsock
5503+
* sk that is fully established or a reqsk that is in-the-middle
5504+
* of 3-way handshake.
5505+
*/
5506+
__bpf_md_ptr(struct bpf_sock *, sk);
5507+
__bpf_md_ptr(struct bpf_sock *, migrating_sk);
53685508
};
53695509

53705510
#define BPF_TAG_SIZE 8
@@ -6010,6 +6150,11 @@ struct bpf_spin_lock {
60106150
__u32 val;
60116151
};
60126152

6153+
struct bpf_timer {
6154+
__u64 :64;
6155+
__u64 :64;
6156+
} __attribute__((aligned(8)));
6157+
60136158
struct bpf_sysctl {
60146159
__u32 write; /* Sysctl is being read (= 0) or written (= 1).
60156160
* Allows 1,2,4-byte read, but no write.

src/cc/export/helpers.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,23 @@ static long (*bpf_snprintf)(char *str, __u32 str_size, const char *fmt,
882882
__u64 *data, __u32 data_len) =
883883
(void *)BPF_FUNC_snprintf;
884884

885+
static long (*bpf_sys_bpf)(__u32 cmd, void *attr, __u32 attr_size) =
886+
(void *)BPF_FUNC_sys_bpf;
887+
static long (*bpf_btf_find_by_name_kind)(char *name, int name_sz, __u32 kind, int flags) =
888+
(void *)BPF_FUNC_btf_find_by_name_kind;
889+
static long (*bpf_sys_close)(__u32 fd) = (void *)BPF_FUNC_sys_close;
890+
891+
struct bpf_timer;
892+
static long (*bpf_timer_init)(struct bpf_timer *timer, void *map, __u64 flags) =
893+
(void *)BPF_FUNC_timer_init;
894+
static long (*bpf_timer_set_callback)(struct bpf_timer *timer, void *callback_fn) =
895+
(void *)BPF_FUNC_timer_set_callback;
896+
static long (*bpf_timer_start)(struct bpf_timer *timer, __u64 nsecs, __u64 flags) =
897+
(void *)BPF_FUNC_timer_start;
898+
static long (*bpf_timer_cancel)(struct bpf_timer *timer) = (void *)BPF_FUNC_timer_cancel;
899+
900+
static __u64 (*bpf_get_func_ip)(void *ctx) = (void *)BPF_FUNC_get_func_ip;
901+
885902
/* llvm builtin functions that eBPF C program may use to
886903
* emit BPF_LD_ABS and BPF_LD_IND instructions
887904
*/

src/cc/libbpf.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,14 @@ static struct bpf_helper helpers[] = {
270270
{"check_mtu", "5.12"},
271271
{"for_each_map_elem", "5.13"},
272272
{"snprintf", "5.13"},
273+
{"sys_bpf", "5.14"},
274+
{"btf_find_by_name_kind", "5.14"},
275+
{"sys_close", "5.14"},
276+
{"timer_init", "5.15"},
277+
{"timer_set_callback", "5.15"},
278+
{"timer_start", "5.15"},
279+
{"timer_cancel", "5.15"},
280+
{"get_func_ip", "5.15"},
273281
};
274282

275283
static uint64_t ptr_to_u64(void *ptr)

0 commit comments

Comments
 (0)