Now that we have all the objects (bpf_prog, bpf_trampoline, bpf_dispatcher) linked in bpf_tree, there's no need to have separate bpf_image tree for images. Reverting the bpf_image tree together with struct bpf_image, because it's no longer needed. Also removing bpf_image_alloc function and adding the original bpf_jit_alloc_exec_page interface instead. The kernel_text_address function can now rely only on is_bpf_text_address, because it checks the bpf_tree that contains all the objects. Keeping bpf_image_ksym_add and bpf_image_ksym_del because they are useful wrappers with perf's ksymbol interface calls.
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -583,14 +583,8 @@ void bpf_trampoline_put(struct bpf_trampoline *tr); · 582 unmodified lines | |||
| 583 | #define BPF_DISPATCHER_PTR(name) (&bpf_dispatcher_##name) | 583 | #define BPF_DISPATCHER_PTR(name) (&bpf_dispatcher_##name) |
| 584 | void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from, | 584 | void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from, |
| 585 | struct bpf_prog *to); | 585 | struct bpf_prog *to); |
| 586 | struct bpf_image { | ||
| 587 | struct latch_tree_node tnode; | ||
| 588 | unsigned char data[]; | ||
| 589 | }; | ||
| 590 | #define BPF_IMAGE_SIZE (PAGE_SIZE - sizeof(struct bpf_image)) | ||
| 591 | bool is_bpf_image_address(unsigned long address); | ||
| 592 | void *bpf_image_alloc(void); | ||
| 593 | /* Called only from JIT-enabled code, so there's no need for stubs. */ | 586 | /* Called only from JIT-enabled code, so there's no need for stubs. */ |
| 587 | void *bpf_jit_alloc_exec_page(void); | ||
| 594 | void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym); | 588 | void bpf_image_ksym_add(void *data, struct bpf_ksym *ksym); |
| 595 | void bpf_image_ksym_del(struct bpf_ksym *ksym); | 589 | void bpf_image_ksym_del(struct bpf_ksym *ksym); |
| 596 | void bpf_ksym_add(struct bpf_ksym *ksym); | 590 | void bpf_ksym_add(struct bpf_ksym *ksym); |