bpf_experimental.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. #ifndef __BPF_EXPERIMENTAL__
  2. #define __BPF_EXPERIMENTAL__
  3. #include <vmlinux.h>
  4. #include <bpf/bpf_tracing.h>
  5. #include <bpf/bpf_helpers.h>
  6. #include <bpf/bpf_core_read.h>
  7. #define __contains(name, node) __attribute__((btf_decl_tag("contains:" #name ":" #node)))
  8. /* Description
  9. * Allocates an object of the type represented by 'local_type_id' in
  10. * program BTF. User may use the bpf_core_type_id_local macro to pass the
  11. * type ID of a struct in program BTF.
  12. *
  13. * The 'local_type_id' parameter must be a known constant.
  14. * The 'meta' parameter is rewritten by the verifier, no need for BPF
  15. * program to set it.
  16. * Returns
  17. * A pointer to an object of the type corresponding to the passed in
  18. * 'local_type_id', or NULL on failure.
  19. */
  20. extern void *bpf_obj_new_impl(__u64 local_type_id, void *meta) __ksym;
  21. /* Convenience macro to wrap over bpf_obj_new_impl */
  22. #define bpf_obj_new(type) ((type *)bpf_obj_new_impl(bpf_core_type_id_local(type), NULL))
  23. /* Description
  24. * Free an allocated object. All fields of the object that require
  25. * destruction will be destructed before the storage is freed.
  26. *
  27. * The 'meta' parameter is rewritten by the verifier, no need for BPF
  28. * program to set it.
  29. * Returns
  30. * Void.
  31. */
  32. extern void bpf_obj_drop_impl(void *kptr, void *meta) __ksym;
  33. /* Convenience macro to wrap over bpf_obj_drop_impl */
  34. #define bpf_obj_drop(kptr) bpf_obj_drop_impl(kptr, NULL)
  35. /* Description
  36. * Increment the refcount on a refcounted local kptr, turning the
  37. * non-owning reference input into an owning reference in the process.
  38. *
  39. * The 'meta' parameter is rewritten by the verifier, no need for BPF
  40. * program to set it.
  41. * Returns
  42. * An owning reference to the object pointed to by 'kptr'
  43. */
  44. extern void *bpf_refcount_acquire_impl(void *kptr, void *meta) __ksym;
  45. /* Convenience macro to wrap over bpf_refcount_acquire_impl */
  46. #define bpf_refcount_acquire(kptr) bpf_refcount_acquire_impl(kptr, NULL)
  47. /* Description
  48. * Add a new entry to the beginning of the BPF linked list.
  49. *
  50. * The 'meta' and 'off' parameters are rewritten by the verifier, no need
  51. * for BPF programs to set them
  52. * Returns
  53. * 0 if the node was successfully added
  54. * -EINVAL if the node wasn't added because it's already in a list
  55. */
  56. extern int bpf_list_push_front_impl(struct bpf_list_head *head,
  57. struct bpf_list_node *node,
  58. void *meta, __u64 off) __ksym;
  59. /* Convenience macro to wrap over bpf_list_push_front_impl */
  60. #define bpf_list_push_front(head, node) bpf_list_push_front_impl(head, node, NULL, 0)
  61. /* Description
  62. * Add a new entry to the end of the BPF linked list.
  63. *
  64. * The 'meta' and 'off' parameters are rewritten by the verifier, no need
  65. * for BPF programs to set them
  66. * Returns
  67. * 0 if the node was successfully added
  68. * -EINVAL if the node wasn't added because it's already in a list
  69. */
  70. extern int bpf_list_push_back_impl(struct bpf_list_head *head,
  71. struct bpf_list_node *node,
  72. void *meta, __u64 off) __ksym;
  73. /* Convenience macro to wrap over bpf_list_push_back_impl */
  74. #define bpf_list_push_back(head, node) bpf_list_push_back_impl(head, node, NULL, 0)
  75. /* Description
  76. * Remove the entry at the beginning of the BPF linked list.
  77. * Returns
  78. * Pointer to bpf_list_node of deleted entry, or NULL if list is empty.
  79. */
  80. extern struct bpf_list_node *bpf_list_pop_front(struct bpf_list_head *head) __ksym;
  81. /* Description
  82. * Remove the entry at the end of the BPF linked list.
  83. * Returns
  84. * Pointer to bpf_list_node of deleted entry, or NULL if list is empty.
  85. */
  86. extern struct bpf_list_node *bpf_list_pop_back(struct bpf_list_head *head) __ksym;
  87. /* Description
  88. * Remove 'node' from rbtree with root 'root'
  89. * Returns
  90. * Pointer to the removed node, or NULL if 'root' didn't contain 'node'
  91. */
  92. extern struct bpf_rb_node *bpf_rbtree_remove(struct bpf_rb_root *root,
  93. struct bpf_rb_node *node) __ksym;
  94. /* Description
  95. * Add 'node' to rbtree with root 'root' using comparator 'less'
  96. *
  97. * The 'meta' and 'off' parameters are rewritten by the verifier, no need
  98. * for BPF programs to set them
  99. * Returns
  100. * 0 if the node was successfully added
  101. * -EINVAL if the node wasn't added because it's already in a tree
  102. */
  103. extern int bpf_rbtree_add_impl(struct bpf_rb_root *root, struct bpf_rb_node *node,
  104. bool (less)(struct bpf_rb_node *a, const struct bpf_rb_node *b),
  105. void *meta, __u64 off) __ksym;
  106. /* Convenience macro to wrap over bpf_rbtree_add_impl */
  107. #define bpf_rbtree_add(head, node, less) bpf_rbtree_add_impl(head, node, less, NULL, 0)
  108. /* Description
  109. * Return the first (leftmost) node in input tree
  110. * Returns
  111. * Pointer to the node, which is _not_ removed from the tree. If the tree
  112. * contains no nodes, returns NULL.
  113. */
  114. extern struct bpf_rb_node *bpf_rbtree_first(struct bpf_rb_root *root) __ksym;
  115. /* Description
  116. * Allocates a percpu object of the type represented by 'local_type_id' in
  117. * program BTF. User may use the bpf_core_type_id_local macro to pass the
  118. * type ID of a struct in program BTF.
  119. *
  120. * The 'local_type_id' parameter must be a known constant.
  121. * The 'meta' parameter is rewritten by the verifier, no need for BPF
  122. * program to set it.
  123. * Returns
  124. * A pointer to a percpu object of the type corresponding to the passed in
  125. * 'local_type_id', or NULL on failure.
  126. */
  127. extern void *bpf_percpu_obj_new_impl(__u64 local_type_id, void *meta) __ksym;
  128. /* Convenience macro to wrap over bpf_percpu_obj_new_impl */
  129. #define bpf_percpu_obj_new(type) ((type __percpu_kptr *)bpf_percpu_obj_new_impl(bpf_core_type_id_local(type), NULL))
  130. /* Description
  131. * Free an allocated percpu object. All fields of the object that require
  132. * destruction will be destructed before the storage is freed.
  133. *
  134. * The 'meta' parameter is rewritten by the verifier, no need for BPF
  135. * program to set it.
  136. * Returns
  137. * Void.
  138. */
  139. extern void bpf_percpu_obj_drop_impl(void *kptr, void *meta) __ksym;
  140. struct bpf_iter_task_vma;
  141. extern int bpf_iter_task_vma_new(struct bpf_iter_task_vma *it,
  142. struct task_struct *task,
  143. __u64 addr) __ksym;
  144. extern struct vm_area_struct *bpf_iter_task_vma_next(struct bpf_iter_task_vma *it) __ksym;
  145. extern void bpf_iter_task_vma_destroy(struct bpf_iter_task_vma *it) __ksym;
  146. /* Convenience macro to wrap over bpf_obj_drop_impl */
  147. #define bpf_percpu_obj_drop(kptr) bpf_percpu_obj_drop_impl(kptr, NULL)
  148. /* Description
  149. * Throw a BPF exception from the program, immediately terminating its
  150. * execution and unwinding the stack. The supplied 'cookie' parameter
  151. * will be the return value of the program when an exception is thrown,
  152. * and the default exception callback is used. Otherwise, if an exception
  153. * callback is set using the '__exception_cb(callback)' declaration tag
  154. * on the main program, the 'cookie' parameter will be the callback's only
  155. * input argument.
  156. *
  157. * Thus, in case of default exception callback, 'cookie' is subjected to
  158. * constraints on the program's return value (as with R0 on exit).
  159. * Otherwise, the return value of the marked exception callback will be
  160. * subjected to the same checks.
  161. *
  162. * Note that throwing an exception with lingering resources (locks,
  163. * references, etc.) will lead to a verification error.
  164. *
  165. * Note that callbacks *cannot* call this helper.
  166. * Returns
  167. * Never.
  168. * Throws
  169. * An exception with the specified 'cookie' value.
  170. */
  171. extern void bpf_throw(u64 cookie) __ksym;
  172. /* Description
  173. * Acquire a reference on the exe_file member field belonging to the
  174. * mm_struct that is nested within the supplied task_struct. The supplied
  175. * task_struct must be trusted/referenced.
  176. * Returns
  177. * A referenced file pointer pointing to the exe_file member field of the
  178. * mm_struct nested in the supplied task_struct, or NULL.
  179. */
  180. extern struct file *bpf_get_task_exe_file(struct task_struct *task) __ksym;
  181. /* Description
  182. * Release a reference on the supplied file. The supplied file must be
  183. * acquired.
  184. */
  185. extern void bpf_put_file(struct file *file) __ksym;
  186. /* Description
  187. * Resolve a pathname for the supplied path and store it in the supplied
  188. * buffer. The supplied path must be trusted/referenced.
  189. * Returns
  190. * A positive integer corresponding to the length of the resolved pathname,
  191. * including the NULL termination character, stored in the supplied
  192. * buffer. On error, a negative integer is returned.
  193. */
  194. extern int bpf_path_d_path(struct path *path, char *buf, size_t buf__sz) __ksym;
  195. /* This macro must be used to mark the exception callback corresponding to the
  196. * main program. For example:
  197. *
  198. * int exception_cb(u64 cookie) {
  199. * return cookie;
  200. * }
  201. *
  202. * SEC("tc")
  203. * __exception_cb(exception_cb)
  204. * int main_prog(struct __sk_buff *ctx) {
  205. * ...
  206. * return TC_ACT_OK;
  207. * }
  208. *
  209. * Here, exception callback for the main program will be 'exception_cb'. Note
  210. * that this attribute can only be used once, and multiple exception callbacks
  211. * specified for the main program will lead to verification error.
  212. */
  213. #define __exception_cb(name) __attribute__((btf_decl_tag("exception_callback:" #name)))
  214. #define __bpf_assert_signed(x) _Generic((x), \
  215. unsigned long: 0, \
  216. unsigned long long: 0, \
  217. signed long: 1, \
  218. signed long long: 1 \
  219. )
  220. #define __bpf_assert_check(LHS, op, RHS) \
  221. _Static_assert(sizeof(&(LHS)), "1st argument must be an lvalue expression"); \
  222. _Static_assert(sizeof(LHS) == 8, "Only 8-byte integers are supported\n"); \
  223. _Static_assert(__builtin_constant_p(__bpf_assert_signed(LHS)), "internal static assert"); \
  224. _Static_assert(__builtin_constant_p((RHS)), "2nd argument must be a constant expression")
  225. #define __bpf_assert(LHS, op, cons, RHS, VAL) \
  226. ({ \
  227. (void)bpf_throw; \
  228. asm volatile ("if %[lhs] " op " %[rhs] goto +2; r1 = %[value]; call bpf_throw" \
  229. : : [lhs] "r"(LHS), [rhs] cons(RHS), [value] "ri"(VAL) : ); \
  230. })
  231. #define __bpf_assert_op_sign(LHS, op, cons, RHS, VAL, supp_sign) \
  232. ({ \
  233. __bpf_assert_check(LHS, op, RHS); \
  234. if (__bpf_assert_signed(LHS) && !(supp_sign)) \
  235. __bpf_assert(LHS, "s" #op, cons, RHS, VAL); \
  236. else \
  237. __bpf_assert(LHS, #op, cons, RHS, VAL); \
  238. })
  239. #define __bpf_assert_op(LHS, op, RHS, VAL, supp_sign) \
  240. ({ \
  241. if (sizeof(typeof(RHS)) == 8) { \
  242. const typeof(RHS) rhs_var = (RHS); \
  243. __bpf_assert_op_sign(LHS, op, "r", rhs_var, VAL, supp_sign); \
  244. } else { \
  245. __bpf_assert_op_sign(LHS, op, "i", RHS, VAL, supp_sign); \
  246. } \
  247. })
  248. #define __cmp_cannot_be_signed(x) \
  249. __builtin_strcmp(#x, "==") == 0 || __builtin_strcmp(#x, "!=") == 0 || \
  250. __builtin_strcmp(#x, "&") == 0
  251. #define __is_signed_type(type) (((type)(-1)) < (type)1)
  252. #define __bpf_cmp(LHS, OP, PRED, RHS, DEFAULT) \
  253. ({ \
  254. __label__ l_true; \
  255. bool ret = DEFAULT; \
  256. asm volatile goto("if %[lhs] " OP " %[rhs] goto %l[l_true]" \
  257. :: [lhs] "r"((short)LHS), [rhs] PRED (RHS) :: l_true); \
  258. ret = !DEFAULT; \
  259. l_true: \
  260. ret; \
  261. })
  262. /* C type conversions coupled with comparison operator are tricky.
  263. * Make sure BPF program is compiled with -Wsign-compare then
  264. * __lhs OP __rhs below will catch the mistake.
  265. * Be aware that we check only __lhs to figure out the sign of compare.
  266. */
  267. #define _bpf_cmp(LHS, OP, RHS, UNLIKELY) \
  268. ({ \
  269. typeof(LHS) __lhs = (LHS); \
  270. typeof(RHS) __rhs = (RHS); \
  271. bool ret; \
  272. _Static_assert(sizeof(&(LHS)), "1st argument must be an lvalue expression"); \
  273. (void)(__lhs OP __rhs); \
  274. if (__cmp_cannot_be_signed(OP) || !__is_signed_type(typeof(__lhs))) { \
  275. if (sizeof(__rhs) == 8) \
  276. /* "i" will truncate 64-bit constant into s32, \
  277. * so we have to use extra register via "r". \
  278. */ \
  279. ret = __bpf_cmp(__lhs, #OP, "r", __rhs, UNLIKELY); \
  280. else \
  281. ret = __bpf_cmp(__lhs, #OP, "ri", __rhs, UNLIKELY); \
  282. } else { \
  283. if (sizeof(__rhs) == 8) \
  284. ret = __bpf_cmp(__lhs, "s"#OP, "r", __rhs, UNLIKELY); \
  285. else \
  286. ret = __bpf_cmp(__lhs, "s"#OP, "ri", __rhs, UNLIKELY); \
  287. } \
  288. ret; \
  289. })
  290. #ifndef bpf_cmp_unlikely
  291. #define bpf_cmp_unlikely(LHS, OP, RHS) _bpf_cmp(LHS, OP, RHS, true)
  292. #endif
  293. #ifndef bpf_cmp_likely
  294. #define bpf_cmp_likely(LHS, OP, RHS) \
  295. ({ \
  296. bool ret = 0; \
  297. if (__builtin_strcmp(#OP, "==") == 0) \
  298. ret = _bpf_cmp(LHS, !=, RHS, false); \
  299. else if (__builtin_strcmp(#OP, "!=") == 0) \
  300. ret = _bpf_cmp(LHS, ==, RHS, false); \
  301. else if (__builtin_strcmp(#OP, "<=") == 0) \
  302. ret = _bpf_cmp(LHS, >, RHS, false); \
  303. else if (__builtin_strcmp(#OP, "<") == 0) \
  304. ret = _bpf_cmp(LHS, >=, RHS, false); \
  305. else if (__builtin_strcmp(#OP, ">") == 0) \
  306. ret = _bpf_cmp(LHS, <=, RHS, false); \
  307. else if (__builtin_strcmp(#OP, ">=") == 0) \
  308. ret = _bpf_cmp(LHS, <, RHS, false); \
  309. else \
  310. asm volatile("r0 " #OP " invalid compare"); \
  311. ret; \
  312. })
  313. #endif
  314. /*
  315. * Note that cond_break can only be portably used in the body of a breakable
  316. * construct, whereas can_loop can be used anywhere.
  317. */
  318. #ifdef __BPF_FEATURE_MAY_GOTO
  319. #define can_loop \
  320. ({ __label__ l_break, l_continue; \
  321. bool ret = true; \
  322. asm volatile goto("may_goto %l[l_break]" \
  323. :::: l_break); \
  324. goto l_continue; \
  325. l_break: ret = false; \
  326. l_continue:; \
  327. ret; \
  328. })
  329. #define cond_break \
  330. ({ __label__ l_break, l_continue; \
  331. asm volatile goto("may_goto %l[l_break]" \
  332. :::: l_break); \
  333. goto l_continue; \
  334. l_break: break; \
  335. l_continue:; \
  336. })
  337. #else
  338. #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  339. #define can_loop \
  340. ({ __label__ l_break, l_continue; \
  341. bool ret = true; \
  342. asm volatile goto("1:.byte 0xe5; \
  343. .byte 0; \
  344. .long ((%l[l_break] - 1b - 8) / 8) & 0xffff; \
  345. .short 0" \
  346. :::: l_break); \
  347. goto l_continue; \
  348. l_break: ret = false; \
  349. l_continue:; \
  350. ret; \
  351. })
  352. #define cond_break \
  353. ({ __label__ l_break, l_continue; \
  354. asm volatile goto("1:.byte 0xe5; \
  355. .byte 0; \
  356. .long ((%l[l_break] - 1b - 8) / 8) & 0xffff; \
  357. .short 0" \
  358. :::: l_break); \
  359. goto l_continue; \
  360. l_break: break; \
  361. l_continue:; \
  362. })
  363. #else
  364. #define can_loop \
  365. ({ __label__ l_break, l_continue; \
  366. bool ret = true; \
  367. asm volatile goto("1:.byte 0xe5; \
  368. .byte 0; \
  369. .long (((%l[l_break] - 1b - 8) / 8) & 0xffff) << 16; \
  370. .short 0" \
  371. :::: l_break); \
  372. goto l_continue; \
  373. l_break: ret = false; \
  374. l_continue:; \
  375. ret; \
  376. })
  377. #define cond_break \
  378. ({ __label__ l_break, l_continue; \
  379. asm volatile goto("1:.byte 0xe5; \
  380. .byte 0; \
  381. .long (((%l[l_break] - 1b - 8) / 8) & 0xffff) << 16; \
  382. .short 0" \
  383. :::: l_break); \
  384. goto l_continue; \
  385. l_break: break; \
  386. l_continue:; \
  387. })
  388. #endif
  389. #endif
  390. #ifndef bpf_nop_mov
  391. #define bpf_nop_mov(var) \
  392. asm volatile("%[reg]=%[reg]"::[reg]"r"((short)var))
  393. #endif
  394. /* emit instruction:
  395. * rX = rX .off = BPF_ADDR_SPACE_CAST .imm32 = (dst_as << 16) | src_as
  396. */
  397. #ifndef bpf_addr_space_cast
  398. #define bpf_addr_space_cast(var, dst_as, src_as)\
  399. asm volatile(".byte 0xBF; \
  400. .ifc %[reg], r0; \
  401. .byte 0x00; \
  402. .endif; \
  403. .ifc %[reg], r1; \
  404. .byte 0x11; \
  405. .endif; \
  406. .ifc %[reg], r2; \
  407. .byte 0x22; \
  408. .endif; \
  409. .ifc %[reg], r3; \
  410. .byte 0x33; \
  411. .endif; \
  412. .ifc %[reg], r4; \
  413. .byte 0x44; \
  414. .endif; \
  415. .ifc %[reg], r5; \
  416. .byte 0x55; \
  417. .endif; \
  418. .ifc %[reg], r6; \
  419. .byte 0x66; \
  420. .endif; \
  421. .ifc %[reg], r7; \
  422. .byte 0x77; \
  423. .endif; \
  424. .ifc %[reg], r8; \
  425. .byte 0x88; \
  426. .endif; \
  427. .ifc %[reg], r9; \
  428. .byte 0x99; \
  429. .endif; \
  430. .short %[off]; \
  431. .long %[as]" \
  432. : [reg]"+r"(var) \
  433. : [off]"i"(BPF_ADDR_SPACE_CAST) \
  434. , [as]"i"((dst_as << 16) | src_as));
  435. #endif
  436. void bpf_preempt_disable(void) __weak __ksym;
  437. void bpf_preempt_enable(void) __weak __ksym;
  438. typedef struct {
  439. } __bpf_preempt_t;
  440. static inline __bpf_preempt_t __bpf_preempt_constructor(void)
  441. {
  442. __bpf_preempt_t ret = {};
  443. bpf_preempt_disable();
  444. return ret;
  445. }
  446. static inline void __bpf_preempt_destructor(__bpf_preempt_t *t)
  447. {
  448. bpf_preempt_enable();
  449. }
  450. #define bpf_guard_preempt() \
  451. __bpf_preempt_t ___bpf_apply(preempt, __COUNTER__) \
  452. __attribute__((__unused__, __cleanup__(__bpf_preempt_destructor))) = \
  453. __bpf_preempt_constructor()
  454. /* Description
  455. * Assert that a conditional expression is true.
  456. * Returns
  457. * Void.
  458. * Throws
  459. * An exception with the value zero when the assertion fails.
  460. */
  461. #define bpf_assert(cond) if (!(cond)) bpf_throw(0);
  462. /* Description
  463. * Assert that a conditional expression is true.
  464. * Returns
  465. * Void.
  466. * Throws
  467. * An exception with the specified value when the assertion fails.
  468. */
  469. #define bpf_assert_with(cond, value) if (!(cond)) bpf_throw(value);
  470. /* Description
  471. * Assert that LHS is in the range [BEG, END] (inclusive of both). This
  472. * statement updates the known bounds of LHS during verification. Note
  473. * that both BEG and END must be constant values, and must fit within the
  474. * data type of LHS.
  475. * Returns
  476. * Void.
  477. * Throws
  478. * An exception with the value zero when the assertion fails.
  479. */
  480. #define bpf_assert_range(LHS, BEG, END) \
  481. ({ \
  482. _Static_assert(BEG <= END, "BEG must be <= END"); \
  483. barrier_var(LHS); \
  484. __bpf_assert_op(LHS, >=, BEG, 0, false); \
  485. __bpf_assert_op(LHS, <=, END, 0, false); \
  486. })
  487. /* Description
  488. * Assert that LHS is in the range [BEG, END] (inclusive of both). This
  489. * statement updates the known bounds of LHS during verification. Note
  490. * that both BEG and END must be constant values, and must fit within the
  491. * data type of LHS.
  492. * Returns
  493. * Void.
  494. * Throws
  495. * An exception with the specified value when the assertion fails.
  496. */
  497. #define bpf_assert_range_with(LHS, BEG, END, value) \
  498. ({ \
  499. _Static_assert(BEG <= END, "BEG must be <= END"); \
  500. barrier_var(LHS); \
  501. __bpf_assert_op(LHS, >=, BEG, value, false); \
  502. __bpf_assert_op(LHS, <=, END, value, false); \
  503. })
  504. struct bpf_iter_css_task;
  505. struct cgroup_subsys_state;
  506. extern int bpf_iter_css_task_new(struct bpf_iter_css_task *it,
  507. struct cgroup_subsys_state *css, unsigned int flags) __weak __ksym;
  508. extern struct task_struct *bpf_iter_css_task_next(struct bpf_iter_css_task *it) __weak __ksym;
  509. extern void bpf_iter_css_task_destroy(struct bpf_iter_css_task *it) __weak __ksym;
  510. struct bpf_iter_task;
  511. extern int bpf_iter_task_new(struct bpf_iter_task *it,
  512. struct task_struct *task, unsigned int flags) __weak __ksym;
  513. extern struct task_struct *bpf_iter_task_next(struct bpf_iter_task *it) __weak __ksym;
  514. extern void bpf_iter_task_destroy(struct bpf_iter_task *it) __weak __ksym;
  515. struct bpf_iter_css;
  516. extern int bpf_iter_css_new(struct bpf_iter_css *it,
  517. struct cgroup_subsys_state *start, unsigned int flags) __weak __ksym;
  518. extern struct cgroup_subsys_state *bpf_iter_css_next(struct bpf_iter_css *it) __weak __ksym;
  519. extern void bpf_iter_css_destroy(struct bpf_iter_css *it) __weak __ksym;
  520. extern int bpf_wq_init(struct bpf_wq *wq, void *p__map, unsigned int flags) __weak __ksym;
  521. extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym;
  522. extern int bpf_wq_set_callback_impl(struct bpf_wq *wq,
  523. int (callback_fn)(void *map, int *key, void *value),
  524. unsigned int flags__k, void *aux__ign) __ksym;
  525. #define bpf_wq_set_callback(timer, cb, flags) \
  526. bpf_wq_set_callback_impl(timer, cb, flags, NULL)
  527. #endif