bpf_trace.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. /* Copyright (c) 2011-2015 PLUMgrid, http://plumgrid.com
  2. * Copyright (c) 2016 Facebook
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of version 2 of the GNU General Public
  6. * License as published by the Free Software Foundation.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/types.h>
  10. #include <linux/slab.h>
  11. #include <linux/bpf.h>
  12. #include <linux/bpf_perf_event.h>
  13. #include <linux/filter.h>
  14. #include <linux/uaccess.h>
  15. #include <linux/ctype.h>
  16. #include "trace.h"
  17. /**
  18. * trace_call_bpf - invoke BPF program
  19. * @prog: BPF program
  20. * @ctx: opaque context pointer
  21. *
  22. * kprobe handlers execute BPF programs via this helper.
  23. * Can be used from static tracepoints in the future.
  24. *
  25. * Return: BPF programs always return an integer which is interpreted by
  26. * kprobe handler as:
  27. * 0 - return from kprobe (event is filtered out)
  28. * 1 - store kprobe event into ring buffer
  29. * Other values are reserved and currently alias to 1
  30. */
  31. unsigned int trace_call_bpf(struct bpf_prog *prog, void *ctx)
  32. {
  33. unsigned int ret;
  34. if (in_nmi()) /* not supported yet */
  35. return 1;
  36. preempt_disable();
  37. if (unlikely(__this_cpu_inc_return(bpf_prog_active) != 1)) {
  38. /*
  39. * since some bpf program is already running on this cpu,
  40. * don't call into another bpf program (same or different)
  41. * and don't send kprobe event into ring-buffer,
  42. * so return zero here
  43. */
  44. ret = 0;
  45. goto out;
  46. }
  47. rcu_read_lock();
  48. ret = BPF_PROG_RUN(prog, ctx);
  49. rcu_read_unlock();
  50. out:
  51. __this_cpu_dec(bpf_prog_active);
  52. preempt_enable();
  53. return ret;
  54. }
  55. EXPORT_SYMBOL_GPL(trace_call_bpf);
  56. BPF_CALL_3(bpf_probe_read, void *, dst, u32, size, const void *, unsafe_ptr)
  57. {
  58. int ret;
  59. ret = probe_kernel_read(dst, unsafe_ptr, size);
  60. if (unlikely(ret < 0))
  61. memset(dst, 0, size);
  62. return ret;
  63. }
  64. static const struct bpf_func_proto bpf_probe_read_proto = {
  65. .func = bpf_probe_read,
  66. .gpl_only = true,
  67. .ret_type = RET_INTEGER,
  68. .arg1_type = ARG_PTR_TO_RAW_STACK,
  69. .arg2_type = ARG_CONST_STACK_SIZE,
  70. .arg3_type = ARG_ANYTHING,
  71. };
  72. BPF_CALL_3(bpf_probe_write_user, void *, unsafe_ptr, const void *, src,
  73. u32, size)
  74. {
  75. /*
  76. * Ensure we're in user context which is safe for the helper to
  77. * run. This helper has no business in a kthread.
  78. *
  79. * access_ok() should prevent writing to non-user memory, but in
  80. * some situations (nommu, temporary switch, etc) access_ok() does
  81. * not provide enough validation, hence the check on KERNEL_DS.
  82. */
  83. if (unlikely(in_interrupt() ||
  84. current->flags & (PF_KTHREAD | PF_EXITING)))
  85. return -EPERM;
  86. if (unlikely(segment_eq(get_fs(), KERNEL_DS)))
  87. return -EPERM;
  88. if (!access_ok(VERIFY_WRITE, unsafe_ptr, size))
  89. return -EPERM;
  90. return probe_kernel_write(unsafe_ptr, src, size);
  91. }
  92. static const struct bpf_func_proto bpf_probe_write_user_proto = {
  93. .func = bpf_probe_write_user,
  94. .gpl_only = true,
  95. .ret_type = RET_INTEGER,
  96. .arg1_type = ARG_ANYTHING,
  97. .arg2_type = ARG_PTR_TO_STACK,
  98. .arg3_type = ARG_CONST_STACK_SIZE,
  99. };
  100. static const struct bpf_func_proto *bpf_get_probe_write_proto(void)
  101. {
  102. pr_warn_ratelimited("%s[%d] is installing a program with bpf_probe_write_user helper that may corrupt user memory!",
  103. current->comm, task_pid_nr(current));
  104. return &bpf_probe_write_user_proto;
  105. }
  106. /*
  107. * limited trace_printk()
  108. * only %d %u %x %ld %lu %lx %lld %llu %llx %p %s conversion specifiers allowed
  109. */
  110. BPF_CALL_5(bpf_trace_printk, char *, fmt, u32, fmt_size, u64, arg1,
  111. u64, arg2, u64, arg3)
  112. {
  113. bool str_seen = false;
  114. int mod[3] = {};
  115. int fmt_cnt = 0;
  116. u64 unsafe_addr;
  117. char buf[64];
  118. int i;
  119. /*
  120. * bpf_check()->check_func_arg()->check_stack_boundary()
  121. * guarantees that fmt points to bpf program stack,
  122. * fmt_size bytes of it were initialized and fmt_size > 0
  123. */
  124. if (fmt[--fmt_size] != 0)
  125. return -EINVAL;
  126. /* check format string for allowed specifiers */
  127. for (i = 0; i < fmt_size; i++) {
  128. if ((!isprint(fmt[i]) && !isspace(fmt[i])) || !isascii(fmt[i]))
  129. return -EINVAL;
  130. if (fmt[i] != '%')
  131. continue;
  132. if (fmt_cnt >= 3)
  133. return -EINVAL;
  134. /* fmt[i] != 0 && fmt[last] == 0, so we can access fmt[i + 1] */
  135. i++;
  136. if (fmt[i] == 'l') {
  137. mod[fmt_cnt]++;
  138. i++;
  139. } else if (fmt[i] == 'p' || fmt[i] == 's') {
  140. mod[fmt_cnt]++;
  141. i++;
  142. if (!isspace(fmt[i]) && !ispunct(fmt[i]) && fmt[i] != 0)
  143. return -EINVAL;
  144. fmt_cnt++;
  145. if (fmt[i - 1] == 's') {
  146. if (str_seen)
  147. /* allow only one '%s' per fmt string */
  148. return -EINVAL;
  149. str_seen = true;
  150. switch (fmt_cnt) {
  151. case 1:
  152. unsafe_addr = arg1;
  153. arg1 = (long) buf;
  154. break;
  155. case 2:
  156. unsafe_addr = arg2;
  157. arg2 = (long) buf;
  158. break;
  159. case 3:
  160. unsafe_addr = arg3;
  161. arg3 = (long) buf;
  162. break;
  163. }
  164. buf[0] = 0;
  165. strncpy_from_unsafe(buf,
  166. (void *) (long) unsafe_addr,
  167. sizeof(buf));
  168. }
  169. continue;
  170. }
  171. if (fmt[i] == 'l') {
  172. mod[fmt_cnt]++;
  173. i++;
  174. }
  175. if (fmt[i] != 'd' && fmt[i] != 'u' && fmt[i] != 'x')
  176. return -EINVAL;
  177. fmt_cnt++;
  178. }
  179. return __trace_printk(1/* fake ip will not be printed */, fmt,
  180. mod[0] == 2 ? arg1 : mod[0] == 1 ? (long) arg1 : (u32) arg1,
  181. mod[1] == 2 ? arg2 : mod[1] == 1 ? (long) arg2 : (u32) arg2,
  182. mod[2] == 2 ? arg3 : mod[2] == 1 ? (long) arg3 : (u32) arg3);
  183. }
  184. static const struct bpf_func_proto bpf_trace_printk_proto = {
  185. .func = bpf_trace_printk,
  186. .gpl_only = true,
  187. .ret_type = RET_INTEGER,
  188. .arg1_type = ARG_PTR_TO_STACK,
  189. .arg2_type = ARG_CONST_STACK_SIZE,
  190. };
  191. const struct bpf_func_proto *bpf_get_trace_printk_proto(void)
  192. {
  193. /*
  194. * this program might be calling bpf_trace_printk,
  195. * so allocate per-cpu printk buffers
  196. */
  197. trace_printk_init_buffers();
  198. return &bpf_trace_printk_proto;
  199. }
  200. BPF_CALL_2(bpf_perf_event_read, struct bpf_map *, map, u64, flags)
  201. {
  202. struct bpf_array *array = container_of(map, struct bpf_array, map);
  203. unsigned int cpu = smp_processor_id();
  204. u64 index = flags & BPF_F_INDEX_MASK;
  205. struct bpf_event_entry *ee;
  206. struct perf_event *event;
  207. if (unlikely(flags & ~(BPF_F_INDEX_MASK)))
  208. return -EINVAL;
  209. if (index == BPF_F_CURRENT_CPU)
  210. index = cpu;
  211. if (unlikely(index >= array->map.max_entries))
  212. return -E2BIG;
  213. ee = READ_ONCE(array->ptrs[index]);
  214. if (!ee)
  215. return -ENOENT;
  216. event = ee->event;
  217. if (unlikely(event->attr.type != PERF_TYPE_HARDWARE &&
  218. event->attr.type != PERF_TYPE_RAW))
  219. return -EINVAL;
  220. /* make sure event is local and doesn't have pmu::count */
  221. if (unlikely(event->oncpu != cpu || event->pmu->count))
  222. return -EINVAL;
  223. /*
  224. * we don't know if the function is run successfully by the
  225. * return value. It can be judged in other places, such as
  226. * eBPF programs.
  227. */
  228. return perf_event_read_local(event);
  229. }
  230. static const struct bpf_func_proto bpf_perf_event_read_proto = {
  231. .func = bpf_perf_event_read,
  232. .gpl_only = true,
  233. .ret_type = RET_INTEGER,
  234. .arg1_type = ARG_CONST_MAP_PTR,
  235. .arg2_type = ARG_ANYTHING,
  236. };
  237. static __always_inline u64
  238. __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map,
  239. u64 flags, struct perf_raw_record *raw)
  240. {
  241. struct bpf_array *array = container_of(map, struct bpf_array, map);
  242. unsigned int cpu = smp_processor_id();
  243. u64 index = flags & BPF_F_INDEX_MASK;
  244. struct perf_sample_data sample_data;
  245. struct bpf_event_entry *ee;
  246. struct perf_event *event;
  247. if (index == BPF_F_CURRENT_CPU)
  248. index = cpu;
  249. if (unlikely(index >= array->map.max_entries))
  250. return -E2BIG;
  251. ee = READ_ONCE(array->ptrs[index]);
  252. if (!ee)
  253. return -ENOENT;
  254. event = ee->event;
  255. if (unlikely(event->attr.type != PERF_TYPE_SOFTWARE ||
  256. event->attr.config != PERF_COUNT_SW_BPF_OUTPUT))
  257. return -EINVAL;
  258. if (unlikely(event->oncpu != cpu))
  259. return -EOPNOTSUPP;
  260. perf_sample_data_init(&sample_data, 0, 0);
  261. sample_data.raw = raw;
  262. perf_event_output(event, &sample_data, regs);
  263. return 0;
  264. }
  265. BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map,
  266. u64, flags, void *, data, u64, size)
  267. {
  268. struct perf_raw_record raw = {
  269. .frag = {
  270. .size = size,
  271. .data = data,
  272. },
  273. };
  274. if (unlikely(flags & ~(BPF_F_INDEX_MASK)))
  275. return -EINVAL;
  276. return __bpf_perf_event_output(regs, map, flags, &raw);
  277. }
  278. static const struct bpf_func_proto bpf_perf_event_output_proto = {
  279. .func = bpf_perf_event_output,
  280. .gpl_only = true,
  281. .ret_type = RET_INTEGER,
  282. .arg1_type = ARG_PTR_TO_CTX,
  283. .arg2_type = ARG_CONST_MAP_PTR,
  284. .arg3_type = ARG_ANYTHING,
  285. .arg4_type = ARG_PTR_TO_STACK,
  286. .arg5_type = ARG_CONST_STACK_SIZE,
  287. };
  288. static DEFINE_PER_CPU(struct pt_regs, bpf_pt_regs);
  289. u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size,
  290. void *ctx, u64 ctx_size, bpf_ctx_copy_t ctx_copy)
  291. {
  292. struct pt_regs *regs = this_cpu_ptr(&bpf_pt_regs);
  293. struct perf_raw_frag frag = {
  294. .copy = ctx_copy,
  295. .size = ctx_size,
  296. .data = ctx,
  297. };
  298. struct perf_raw_record raw = {
  299. .frag = {
  300. {
  301. .next = ctx_size ? &frag : NULL,
  302. },
  303. .size = meta_size,
  304. .data = meta,
  305. },
  306. };
  307. perf_fetch_caller_regs(regs);
  308. return __bpf_perf_event_output(regs, map, flags, &raw);
  309. }
  310. BPF_CALL_0(bpf_get_current_task)
  311. {
  312. return (long) current;
  313. }
  314. static const struct bpf_func_proto bpf_get_current_task_proto = {
  315. .func = bpf_get_current_task,
  316. .gpl_only = true,
  317. .ret_type = RET_INTEGER,
  318. };
  319. BPF_CALL_2(bpf_current_task_under_cgroup, struct bpf_map *, map, u32, idx)
  320. {
  321. struct bpf_array *array = container_of(map, struct bpf_array, map);
  322. struct cgroup *cgrp;
  323. if (unlikely(in_interrupt()))
  324. return -EINVAL;
  325. if (unlikely(idx >= array->map.max_entries))
  326. return -E2BIG;
  327. cgrp = READ_ONCE(array->ptrs[idx]);
  328. if (unlikely(!cgrp))
  329. return -EAGAIN;
  330. return task_under_cgroup_hierarchy(current, cgrp);
  331. }
  332. static const struct bpf_func_proto bpf_current_task_under_cgroup_proto = {
  333. .func = bpf_current_task_under_cgroup,
  334. .gpl_only = false,
  335. .ret_type = RET_INTEGER,
  336. .arg1_type = ARG_CONST_MAP_PTR,
  337. .arg2_type = ARG_ANYTHING,
  338. };
  339. static const struct bpf_func_proto *tracing_func_proto(enum bpf_func_id func_id)
  340. {
  341. switch (func_id) {
  342. case BPF_FUNC_map_lookup_elem:
  343. return &bpf_map_lookup_elem_proto;
  344. case BPF_FUNC_map_update_elem:
  345. return &bpf_map_update_elem_proto;
  346. case BPF_FUNC_map_delete_elem:
  347. return &bpf_map_delete_elem_proto;
  348. case BPF_FUNC_probe_read:
  349. return &bpf_probe_read_proto;
  350. case BPF_FUNC_ktime_get_ns:
  351. return &bpf_ktime_get_ns_proto;
  352. case BPF_FUNC_tail_call:
  353. return &bpf_tail_call_proto;
  354. case BPF_FUNC_get_current_pid_tgid:
  355. return &bpf_get_current_pid_tgid_proto;
  356. case BPF_FUNC_get_current_task:
  357. return &bpf_get_current_task_proto;
  358. case BPF_FUNC_get_current_uid_gid:
  359. return &bpf_get_current_uid_gid_proto;
  360. case BPF_FUNC_get_current_comm:
  361. return &bpf_get_current_comm_proto;
  362. case BPF_FUNC_trace_printk:
  363. return bpf_get_trace_printk_proto();
  364. case BPF_FUNC_get_smp_processor_id:
  365. return &bpf_get_smp_processor_id_proto;
  366. case BPF_FUNC_perf_event_read:
  367. return &bpf_perf_event_read_proto;
  368. case BPF_FUNC_probe_write_user:
  369. return bpf_get_probe_write_proto();
  370. case BPF_FUNC_current_task_under_cgroup:
  371. return &bpf_current_task_under_cgroup_proto;
  372. case BPF_FUNC_get_prandom_u32:
  373. return &bpf_get_prandom_u32_proto;
  374. default:
  375. return NULL;
  376. }
  377. }
  378. static const struct bpf_func_proto *kprobe_prog_func_proto(enum bpf_func_id func_id)
  379. {
  380. switch (func_id) {
  381. case BPF_FUNC_perf_event_output:
  382. return &bpf_perf_event_output_proto;
  383. case BPF_FUNC_get_stackid:
  384. return &bpf_get_stackid_proto;
  385. default:
  386. return tracing_func_proto(func_id);
  387. }
  388. }
  389. /* bpf+kprobe programs can access fields of 'struct pt_regs' */
  390. static bool kprobe_prog_is_valid_access(int off, int size, enum bpf_access_type type,
  391. enum bpf_reg_type *reg_type)
  392. {
  393. if (off < 0 || off >= sizeof(struct pt_regs))
  394. return false;
  395. if (type != BPF_READ)
  396. return false;
  397. if (off % size != 0)
  398. return false;
  399. return true;
  400. }
  401. static const struct bpf_verifier_ops kprobe_prog_ops = {
  402. .get_func_proto = kprobe_prog_func_proto,
  403. .is_valid_access = kprobe_prog_is_valid_access,
  404. };
  405. static struct bpf_prog_type_list kprobe_tl = {
  406. .ops = &kprobe_prog_ops,
  407. .type = BPF_PROG_TYPE_KPROBE,
  408. };
  409. BPF_CALL_5(bpf_perf_event_output_tp, void *, tp_buff, struct bpf_map *, map,
  410. u64, flags, void *, data, u64, size)
  411. {
  412. struct pt_regs *regs = *(struct pt_regs **)tp_buff;
  413. /*
  414. * r1 points to perf tracepoint buffer where first 8 bytes are hidden
  415. * from bpf program and contain a pointer to 'struct pt_regs'. Fetch it
  416. * from there and call the same bpf_perf_event_output() helper inline.
  417. */
  418. return ____bpf_perf_event_output(regs, map, flags, data, size);
  419. }
  420. static const struct bpf_func_proto bpf_perf_event_output_proto_tp = {
  421. .func = bpf_perf_event_output_tp,
  422. .gpl_only = true,
  423. .ret_type = RET_INTEGER,
  424. .arg1_type = ARG_PTR_TO_CTX,
  425. .arg2_type = ARG_CONST_MAP_PTR,
  426. .arg3_type = ARG_ANYTHING,
  427. .arg4_type = ARG_PTR_TO_STACK,
  428. .arg5_type = ARG_CONST_STACK_SIZE,
  429. };
  430. BPF_CALL_3(bpf_get_stackid_tp, void *, tp_buff, struct bpf_map *, map,
  431. u64, flags)
  432. {
  433. struct pt_regs *regs = *(struct pt_regs **)tp_buff;
  434. /*
  435. * Same comment as in bpf_perf_event_output_tp(), only that this time
  436. * the other helper's function body cannot be inlined due to being
  437. * external, thus we need to call raw helper function.
  438. */
  439. return bpf_get_stackid((unsigned long) regs, (unsigned long) map,
  440. flags, 0, 0);
  441. }
  442. static const struct bpf_func_proto bpf_get_stackid_proto_tp = {
  443. .func = bpf_get_stackid_tp,
  444. .gpl_only = true,
  445. .ret_type = RET_INTEGER,
  446. .arg1_type = ARG_PTR_TO_CTX,
  447. .arg2_type = ARG_CONST_MAP_PTR,
  448. .arg3_type = ARG_ANYTHING,
  449. };
  450. static const struct bpf_func_proto *tp_prog_func_proto(enum bpf_func_id func_id)
  451. {
  452. switch (func_id) {
  453. case BPF_FUNC_perf_event_output:
  454. return &bpf_perf_event_output_proto_tp;
  455. case BPF_FUNC_get_stackid:
  456. return &bpf_get_stackid_proto_tp;
  457. default:
  458. return tracing_func_proto(func_id);
  459. }
  460. }
  461. static bool tp_prog_is_valid_access(int off, int size, enum bpf_access_type type,
  462. enum bpf_reg_type *reg_type)
  463. {
  464. if (off < sizeof(void *) || off >= PERF_MAX_TRACE_SIZE)
  465. return false;
  466. if (type != BPF_READ)
  467. return false;
  468. if (off % size != 0)
  469. return false;
  470. return true;
  471. }
  472. static const struct bpf_verifier_ops tracepoint_prog_ops = {
  473. .get_func_proto = tp_prog_func_proto,
  474. .is_valid_access = tp_prog_is_valid_access,
  475. };
  476. static struct bpf_prog_type_list tracepoint_tl = {
  477. .ops = &tracepoint_prog_ops,
  478. .type = BPF_PROG_TYPE_TRACEPOINT,
  479. };
  480. static bool pe_prog_is_valid_access(int off, int size, enum bpf_access_type type,
  481. enum bpf_reg_type *reg_type)
  482. {
  483. if (off < 0 || off >= sizeof(struct bpf_perf_event_data))
  484. return false;
  485. if (type != BPF_READ)
  486. return false;
  487. if (off % size != 0)
  488. return false;
  489. if (off == offsetof(struct bpf_perf_event_data, sample_period)) {
  490. if (size != sizeof(u64))
  491. return false;
  492. } else {
  493. if (size != sizeof(long))
  494. return false;
  495. }
  496. return true;
  497. }
  498. static u32 pe_prog_convert_ctx_access(enum bpf_access_type type, int dst_reg,
  499. int src_reg, int ctx_off,
  500. struct bpf_insn *insn_buf,
  501. struct bpf_prog *prog)
  502. {
  503. struct bpf_insn *insn = insn_buf;
  504. switch (ctx_off) {
  505. case offsetof(struct bpf_perf_event_data, sample_period):
  506. BUILD_BUG_ON(FIELD_SIZEOF(struct perf_sample_data, period) != sizeof(u64));
  507. *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct bpf_perf_event_data_kern,
  508. data), dst_reg, src_reg,
  509. offsetof(struct bpf_perf_event_data_kern, data));
  510. *insn++ = BPF_LDX_MEM(BPF_DW, dst_reg, dst_reg,
  511. offsetof(struct perf_sample_data, period));
  512. break;
  513. default:
  514. *insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct bpf_perf_event_data_kern,
  515. regs), dst_reg, src_reg,
  516. offsetof(struct bpf_perf_event_data_kern, regs));
  517. *insn++ = BPF_LDX_MEM(BPF_SIZEOF(long), dst_reg, dst_reg, ctx_off);
  518. break;
  519. }
  520. return insn - insn_buf;
  521. }
  522. static const struct bpf_verifier_ops perf_event_prog_ops = {
  523. .get_func_proto = tp_prog_func_proto,
  524. .is_valid_access = pe_prog_is_valid_access,
  525. .convert_ctx_access = pe_prog_convert_ctx_access,
  526. };
  527. static struct bpf_prog_type_list perf_event_tl = {
  528. .ops = &perf_event_prog_ops,
  529. .type = BPF_PROG_TYPE_PERF_EVENT,
  530. };
  531. static int __init register_kprobe_prog_ops(void)
  532. {
  533. bpf_register_prog_type(&kprobe_tl);
  534. bpf_register_prog_type(&tracepoint_tl);
  535. bpf_register_prog_type(&perf_event_tl);
  536. return 0;
  537. }
  538. late_initcall(register_kprobe_prog_ops);