@@ -28,13 +28,24 @@ bool bpf_ir_canfix(struct bpf_ir_env *env)
2828 int err = env -> verifier_err ;
2929
3030 for (size_t i = 0 ; i < env -> opts .custom_pass_num ; ++ i ) {
31- if (env -> opts .custom_passes [i ].check_apply && env -> opts .custom_passes [i ].check_apply (err )) {
31+ if (env -> opts .custom_passes [i ].check_apply &&
32+ env -> opts .custom_passes [i ].check_apply (err )) {
3233 return true;
3334 }
3435 }
3536 return false;
3637}
3738
39+ // Enable all builtin passes specified by enable_cfg
40+ static void enable_builtin (struct bpf_ir_env * env )
41+ {
42+ for (size_t i = 0 ; i < env -> opts .builtin_pass_cfg_num ; ++ i ) {
43+ if (env -> opts .builtin_pass_cfg [i ].enable_cfg ) {
44+ env -> opts .builtin_pass_cfg [i ].enable = true;
45+ }
46+ }
47+ }
48+
3849int bpf_ir_kern_run (struct bpf_prog * * prog_ptr , union bpf_attr * attr ,
3950 bpfptr_t uattr , u32 uattr_size , const char * pass_opt ,
4051 const char * global_opt )
@@ -81,7 +92,29 @@ int bpf_ir_kern_run(struct bpf_prog **prog_ptr, union bpf_attr *attr,
8192 goto clean_op ;
8293 }
8394
84- // Call the verifier
95+ // Remove line info, otherwise the verifier will complain about that they cannot find those lines
96+ // (Also you could remove debug flag when compile ebpf programs)
97+ // printk("LINEINFO %u, %u", attr->line_info_cnt,
98+ // attr->line_info_rec_size);
99+ attr -> line_info_cnt = 0 ;
100+
101+ // Iteration
102+
103+ u32 iter = 0 ;
104+
105+ while (true) {
106+ iter ++ ;
107+ if (iter >= env -> opts .max_iteration ) {
108+ err = - ELOOP ;
109+ break ;
110+ }
111+ }
112+
113+ if (err ) {
114+ goto clean_op ;
115+ }
116+
117+ // Run built-in passes
85118
86119 /*
87120 err = bpf_check(prog_ptr, attr, uattr, uattr_size, env);
0 commit comments