Function report |
Source Code:kernel\bpf\syscall.c |
Create Date:2022-07-28 12:54:37 |
| Last Modify:2022-05-19 18:06:12 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:bpf_prog_get_info_by_fd
Proto:static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, const union bpf_attr *attr, union bpf_attr __user *uattr)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct bpf_prog * | prog | |
| const union bpf_attr * | attr | |
| union bpf_attr __user * | uattr |
| 2479 | __user * uinfo = u64_to_user_ptr(info) |
| 2480 | struct bpf_prog_info info = {} |
| 2490 | info_len = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, size of info , info_len) |
| 2492 | If copy_from_user( & info, uinfo, info_len) Then Return -EFAULT |
| 2495 | type = Type of BPF program |
| 2502 | No 3D Now!(tag, tag, size of tag ) |
| 2503 | No 3D Now!(name, name, size of name ) |
| 2505 | ulen = nr_map_ids |
| 2506 | nr_map_ids = used_map_cnt |
| 2507 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_map_ids, ulen) |
| 2508 | If ulen Then |
| 2509 | __user * user_map_ids = u64_to_user_ptr(map_ids) |
| 2512 | When i < ulen cycle If Write a simple value into user space(id, & user_map_ids[i]) Then |
| 2515 | Return -EFAULT |
| 2518 | err = set_info_rec_size( & info) |
| 2522 | bpf_prog_get_stats(prog, & stats) |
| 2523 | run_time_ns = nsecs |
| 2526 | If Not Check operation authority Then |
| 2527 | jited_prog_len = 0 |
| 2528 | xlated_prog_len = 0 |
| 2529 | nr_jited_ksyms = 0 |
| 2530 | nr_jited_func_lens = 0 |
| 2531 | nr_func_info = 0 |
| 2532 | nr_line_info = 0 |
| 2533 | nr_jited_line_info = 0 |
| 2534 | Go to done |
| 2537 | ulen = xlated_prog_len |
| 2538 | xlated_prog_len = bpf_prog_insn_size(prog) |
| 2539 | If xlated_prog_len && ulen Then |
| 2543 | If Was blinded && Not bpf_dump_raw_ok() Then |
| 2544 | xlated_prog_insns = 0 |
| 2545 | Go to done |
| 2547 | insns_sanitized = bpf_insn_prepare_dump(prog) |
| 2548 | If Not insns_sanitized Then Return -ENOMEM |
| 2550 | uinsns = u64_to_user_ptr(xlated_prog_insns) |
| 2551 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, xlated_prog_len, ulen) |
| 2552 | fault = copy_to_user(uinsns, insns_sanitized, ulen) |
| 2553 | kfree(insns_sanitized) |
| 2558 | If bpf_prog_is_dev_bound( Auxiliary fields ) Then |
| 2569 | ulen = jited_prog_len |
| 2570 | If used by non-func prog as the number of func progs Then |
| 2573 | jited_prog_len = 0 |
| 2576 | Else |
| 2580 | If jited_prog_len && ulen Then |
| 2581 | If bpf_dump_raw_ok() Then |
| 2582 | uinsns = u64_to_user_ptr(jited_prog_insns) |
| 2583 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, jited_prog_len, ulen) |
| 2588 | If used by non-func prog as the number of func progs Then |
| 2593 | When i < used by non-func prog as the number of func progs cycle |
| 2594 | len = Size of jited insns in bytes |
| 2595 | len = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, len, free) |
| 2597 | If copy_to_user(uinsns, img, len) Then Return -EFAULT |
| 2601 | If Not free Then Break |
| 2604 | Else |
| 2605 | If copy_to_user(uinsns, bpf_func, ulen) Then Return -EFAULT |
| 2608 | Else |
| 2609 | jited_prog_insns = 0 |
| 2613 | ulen = nr_jited_ksyms |
| 2614 | nr_jited_ksyms = If used by non-func prog as the number of func progs Else 1 |
| 2615 | If ulen Then |
| 2616 | If bpf_dump_raw_ok() Then |
| 2618 | __user * user_ksyms |
| 2624 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_jited_ksyms, ulen) |
| 2625 | user_ksyms = u64_to_user_ptr(jited_ksyms) |
| 2626 | If used by non-func prog as the number of func progs Then |
| 2630 | If Write a simple value into user space((u64)ksym_addr, & user_ksyms[i]) Then Return -EFAULT |
| 2634 | Else |
| 2636 | If Write a simple value into user space((u64)ksym_addr, & user_ksyms[0]) Then Return -EFAULT |
| 2639 | Else |
| 2640 | jited_ksyms = 0 |
| 2644 | ulen = nr_jited_func_lens |
| 2645 | nr_jited_func_lens = If used by non-func prog as the number of func progs Else 1 |
| 2646 | If ulen Then |
| 2647 | If bpf_dump_raw_ok() Then |
| 2652 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_jited_func_lens, ulen) |
| 2653 | user_lens = u64_to_user_ptr(jited_func_lens) |
| 2654 | If used by non-func prog as the number of func progs Then |
| 2658 | If Write a simple value into user space(func_len, & user_lens[i]) Then Return -EFAULT |
| 2661 | Else |
| 2663 | If Write a simple value into user space(func_len, & user_lens[0]) Then Return -EFAULT |
| 2666 | Else |
| 2667 | jited_func_lens = 0 |
| 2674 | ulen = nr_func_info |
| 2675 | nr_func_info = func_info_cnt |
| 2676 | If nr_func_info && ulen Then |
| 2677 | __user * user_finfo |
| 2679 | user_finfo = u64_to_user_ptr(func_info) |
| 2680 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_func_info, ulen) |
| 2681 | If copy_to_user(user_finfo, func_info, func_info_rec_size * ulen) Then Return -EFAULT |
| 2686 | ulen = nr_line_info |
| 2687 | nr_line_info = nr_linfo |
| 2688 | If nr_line_info && ulen Then |
| 2689 | __user * user_linfo |
| 2691 | user_linfo = u64_to_user_ptr(line_info) |
| 2698 | ulen = nr_jited_line_info |
| 2701 | Else nr_jited_line_info = 0 |
| 2703 | If nr_jited_line_info && ulen Then |
| 2704 | If bpf_dump_raw_ok() Then |
| 2705 | __user * user_linfo |
| 2708 | user_linfo = u64_to_user_ptr(jited_line_info) |
| 2709 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_jited_line_info, ulen) |
| 2715 | Else |
| 2716 | jited_line_info = 0 |
| 2720 | ulen = nr_prog_tags |
| 2721 | nr_prog_tags = If used by non-func prog as the number of func progs Else 1 |
| 2722 | If ulen Then |
| 2723 | __u8 __user( * user_prog_tags)[8] |
| 2726 | user_prog_tags = u64_to_user_ptr(prog_tags) |
| 2727 | ulen = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_prog_tags, ulen) |
| 2728 | If used by non-func prog as the number of func progs Then |
| 2730 | If copy_to_user(user_prog_tags[i], tag, BPF_TAG_SIZE) Then Return -EFAULT |
| 2735 | Else |
| 2736 | If copy_to_user(user_prog_tags[0], tag, BPF_TAG_SIZE) Then Return -EFAULT |
| 2742 | done : |
| 2743 | If copy_to_user(uinfo, & info, info_len) || Write a simple value into user space(info_len, & info_len) Then Return -EFAULT |
| 2747 | Return 0 |
| Name | Describe |
|---|---|
| bpf_obj_get_info_by_fd |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |