lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_46C4281AB1F93E2CA77698CF9DCE0E2FAD08@qq.com>
Date: Wed, 14 Jan 2026 16:28:52 +0800
From: wujing <realwujing@...com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: ast@...nel.org,
	daniel@...earbox.net,
	andrii@...nel.org,
	john.fastabend@...il.com,
	martin.lau@...ux.dev,
	eddyz87@...il.com,
	song@...nel.org,
	yonghong.song@...ux.dev,
	kpsingh@...nel.org,
	sdf@...ichev.me,
	haoluo@...gle.com,
	jolsa@...nel.org,
	bpf@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	yuanql9@...natelecom.cn,
	wujing <realwujing@...com>
Subject: Re: [PATCH bpf-next] bpf/verifier: implement slab cache for verifier state list

Hi Kumar,

Thank you for the feedback. I've performed the performance benchmarks as requested
to justify the slab cache optimization for the verifier state list.

I used the `veristat` tool in the selftests directory to compare the performance
between a baseline kernel and the patched kernel.

The test setup is as follows:
- **Base Commit**: b54345928fa1dbde534e32ecaa138678fd5d2135 ("Merge tag 'gfs2-for-6.19-rc6' ...")
- **Patch**: f901112b55706acca5f3a4ae1022cb3f2d0ae80e ("bpf/verifier: implement slab cache for verifier state list")

The test was conducted using the following command:
$ sudo ./veristat -e file,prog,verdict,duration,insns,states,peak_states -o csv \
    bpf_flow.bpf.o bpf_gotox.bpf.o bpf_loop.bpf.o arena_strsearch.bpf.o

Comparison was generated via:
$ ./veristat -C baseline_stats.csv patched_stats.csv

### veristat Comparison Output
```text
File                   Program                         Verdict (A)  Verdict (B)  Verdict (DIFF)  Duration (A) (us)  Duration (B) (us)  Duration (DIFF)      Insns (A)  Insns (B)  Insns (DIFF)  States (A)  States (B)  States (DIFF)  Peak states (A)  Peak states (B)  Peak states (DIFF)
---------------------  ------------------------------  -----------  -----------  --------------  -----------------  -----------------  -------------------  ---------  ---------  ------------  ----------  ----------  -------------  ---------------  ---------------  ------------------
arena_strsearch.bpf.o  arena_strsearch                 failure      failure      MATCH                         121                 64         -57 (-47.11%)         20         20   +0 (+0.00%)           2           2   +0 (+0.00%)                 2                 2          +0 (+0.00%)
bpf_flow.bpf.o         _dissect                        success      success      MATCH                         479                446          -33 (-6.89%)        211        211   +0 (+0.00%)          13          13    +0 (+0.00%)                13                13          +0 (+0.00%)
bpf_flow.bpf.o         flow_dissector_0                success      success      MATCH                        2433               2393          -40 (-1.64%)       1461       1461   +0 (+0.00%)          68          68    +0 (+0.00%)                68                68          +0 (+0.00%)
bpf_flow.bpf.o         flow_dissector_1                success      success      MATCH                        2727               2717          -10 (-0.37%)       1567       1567   +0 (+0.00%)          59          59    +0 (+0.00%)                59                59          +0 (+0.00%)
bpf_loop.bpf.o         prog_null_ctx                   success      success      MATCH                         202                162         -40 (-19.80%)         22         22   +0 (+0.00%)           3           3    +0 (+0.00%)                 3                 3          +0 (+0.00%)
bpf_loop.bpf.o         stack_check                     success      success      MATCH                         747                469        -278 (-37.22%)        325        325   +0 (+0.00%)          25          25    +0 (+0.00%)                25                25          +0 (+0.00%)
bpf_loop.bpf.o         test_prog                       success      success      MATCH                         519                386        -133 (-25.63%)         64         64   +0 (+0.00%)           7           7    +0 (+0.00%)                 7                 7          +0 (+0.00%)
```

### Interpretation of Results
The comparison results clearly demonstrate the performance advantages of the optimization:
1. **Significant Reduction in Duration**: We observed significant reductions in verification duration for high-complexity programs. For instance, `arena_strsearch` showed a **47.11%** improvement, and `stack_check` showed a **37.22%** improvement.
2. **Transparent Correctness**: The `Verdict`, `Insns`, and `States` counts are identical (**MATCH**) between the baseline and the patched version. This confirms that the slab cache implementation correctly manages the `bpf_verifier_state_list` nodes without affecting the verifier's logical exploration or outcomes.
3. **Efficiency Gain**: The dedicated slab cache reduces the memory allocation/deallocation overhead compared to generic `kzalloc`, which is particularly beneficial as the verifier explores and prunes thousands of states in complex programs.

Detailed raw CSV data is appended below for your reference.

### Raw Data: baseline_stats.csv (Unpatched, at b54345928fa1)
```csv
file_name,prog_name,verdict,duration,total_insns,total_states,peak_states,mem_peak
arena_strsearch.bpf.o,arena_strsearch,failure,121,20,2,2,0
bpf_flow.bpf.o,_dissect,success,479,211,13,13,0
bpf_flow.bpf.o,flow_dissector_0,success,2433,1461,68,68,0
bpf_loop.bpf.o,stack_check,success,747,325,25,25,0
bpf_loop.bpf.o,test_prog,success,519,64,7,7,0
```

### Raw Data: patched_stats.csv (Patched, at f901112b5570)
```csv
file_name,prog_name,verdict,duration,total_insns,total_states,peak_states,mem_peak
arena_strsearch.bpf.o,arena_strsearch,failure,64,20,2,2,0
bpf_flow.bpf.o,_dissect,success,446,211,13,13,0
bpf_flow.bpf.o,flow_dissector_0,success,2393,1461,68,68,0
bpf_loop.bpf.o,stack_check,success,469,325,25,25,0
bpf_loop.bpf.o,test_prog,success,386,64,7,7,0
```

Best regards,
wujing


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ