@@ -319,34 +319,12 @@ struct bpf_func_state {
319
319
struct bpf_stack_state * stack ;
320
320
};
321
321
322
- #define MAX_CALL_FRAMES 8
323
-
324
- /* instruction history flags, used in bpf_jmp_history_entry.flags field */
325
- enum {
326
- /* instruction references stack slot through PTR_TO_STACK register;
327
- * we also store stack's frame number in lower 3 bits (MAX_CALL_FRAMES is 8)
328
- * and accessed stack slot's index in next 6 bits (MAX_BPF_STACK is 512,
329
- * 8 bytes per slot, so slot index (spi) is [0, 63])
330
- */
331
- INSN_F_FRAMENO_MASK = 0x7 , /* 3 bits */
332
-
333
- INSN_F_SPI_MASK = 0x3f , /* 6 bits */
334
- INSN_F_SPI_SHIFT = 3 , /* shifted 3 bits to the left */
335
-
336
- INSN_F_STACK_ACCESS = BIT (9 ), /* we need 10 bits total */
337
- };
338
-
339
- static_assert (INSN_F_FRAMENO_MASK + 1 >= MAX_CALL_FRAMES );
340
- static_assert (INSN_F_SPI_MASK + 1 >= MAX_BPF_STACK / 8 );
341
-
342
- struct bpf_jmp_history_entry {
322
+ struct bpf_idx_pair {
323
+ u32 prev_idx ;
343
324
u32 idx ;
344
- /* insn idx can't be bigger than 1 million */
345
- u32 prev_idx : 22 ;
346
- /* special flags, e.g., whether insn is doing register stack spill/load */
347
- u32 flags : 10 ;
348
325
};
349
326
327
+ #define MAX_CALL_FRAMES 8
350
328
/* Maximum number of register states that can exist at once */
351
329
#define BPF_ID_MAP_SIZE ((MAX_BPF_REG + MAX_BPF_STACK / BPF_REG_SIZE) * MAX_CALL_FRAMES)
352
330
struct bpf_verifier_state {
@@ -429,7 +407,7 @@ struct bpf_verifier_state {
429
407
* For most states jmp_history_cnt is [0-3].
430
408
* For loops can go up to ~40.
431
409
*/
432
- struct bpf_jmp_history_entry * jmp_history ;
410
+ struct bpf_idx_pair * jmp_history ;
433
411
u32 jmp_history_cnt ;
434
412
u32 dfs_depth ;
435
413
u32 callback_unroll_depth ;
@@ -662,7 +640,6 @@ struct bpf_verifier_env {
662
640
int cur_stack ;
663
641
} cfg ;
664
642
struct backtrack_state bt ;
665
- struct bpf_jmp_history_entry * cur_hist_ent ;
666
643
u32 pass_cnt ; /* number of times do_check() was called */
667
644
u32 subprog_cnt ;
668
645
/* number of instructions analyzed by the verifier */
0 commit comments