<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/tools/testing/selftests/bpf/veristat.c, branch master</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=master</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2026-02-24T16:19:49Z</updated>
<entry>
<title>veristat: Fix a memory leak for preset ENUMERATOR</title>
<updated>2026-02-24T16:19:49Z</updated>
<author>
<name>Ihor Solodrai</name>
</author>
<published>2026-02-23T19:07:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ff9511410d5fbdec21a3bbfaa477aa1f56735b33'/>
<id>urn:sha1:ff9511410d5fbdec21a3bbfaa477aa1f56735b33</id>
<content type='text'>
ASAN detected a memory leak in veristat. The cleanup code handling
ENUMERATOR value missed freeing strdup-ed svalue. Fix it.

Acked-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Ihor Solodrai &lt;ihor.solodrai@linux.dev&gt;
Link: https://lore.kernel.org/r/20260223190736.649171-13-ihor.solodrai@linux.dev
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;

</content>
</entry>
<entry>
<title>selftests/bpf: veristat: fix printing order in output_stats()</title>
<updated>2026-01-01T00:11:49Z</updated>
<author>
<name>Puranjay Mohan</name>
</author>
<published>2025-12-31T22:10:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c286e7e9d1f1f3d90ad11c37e896f582b02d19c4'/>
<id>urn:sha1:c286e7e9d1f1f3d90ad11c37e896f582b02d19c4</id>
<content type='text'>
The order of the variables in the printf() doesn't match the text and
therefore veristat prints something like this:

Done. Processed 24 files, 0 programs. Skipped 62 files, 0 programs.

When it should print:

Done. Processed 24 files, 62 programs. Skipped 0 files, 0 programs.

Fix the order of variables in the printf() call.

Fixes: 518fee8bfaf2 ("selftests/bpf: make veristat skip non-BPF and failing-to-open BPF objects")
Tested-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Signed-off-by: Puranjay Mohan &lt;puranjay@kernel.org&gt;
Link: https://lore.kernel.org/r/20251231221052.759396-1-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Add BPF program dump in veristat</title>
<updated>2025-09-05T19:12:09Z</updated>
<author>
<name>Mykyta Yatsenko</name>
</author>
<published>2025-09-05T14:08:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e12873ee856ffa6f104869b8ea10c0f741606f13'/>
<id>urn:sha1:e12873ee856ffa6f104869b8ea10c0f741606f13</id>
<content type='text'>
Add the ability to dump BPF program instructions directly from veristat.
Previously, inspecting a program required separate bpftool invocations:
one to load and another to dump it, which meant running multiple
commands.
During active development, it's common for developers to use veristat
for testing verification. Integrating instruction dumping into veristat
reduces the need to switch tools and simplifies the workflow.
By making this information more readily accessible, this change aims
to streamline the BPF development cycle and improve usability for
developers.
This implementation leverages bpftool, by running it directly via popen
to avoid any code duplication and keep veristat simple.

Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20250905140835.1416179-1-mykyta.yatsenko5@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Allow veristat compile standalone</title>
<updated>2025-07-02T18:45:14Z</updated>
<author>
<name>Mykyta Yatsenko</name>
</author>
<published>2025-07-02T17:56:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=38d95beb4b24301362f8bdae7fbdb82d74b803ca'/>
<id>urn:sha1:38d95beb4b24301362f8bdae7fbdb82d74b803ca</id>
<content type='text'>
Veristat is synced into the standalone repo, where it compiles without
kernel private dependencies. This patch fixes compilation errors in
standalone veristat.

Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20250702175622.358405-1-mykyta.yatsenko5@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: improve error messages in veristat</title>
<updated>2025-06-28T01:54:46Z</updated>
<author>
<name>Mykyta Yatsenko</name>
</author>
<published>2025-06-27T14:43:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ffaff1804e2ca1e88caa9d2e13ac6b4b7ecf011c'/>
<id>urn:sha1:ffaff1804e2ca1e88caa9d2e13ac6b4b7ecf011c</id>
<content type='text'>
Return error if preset parsing fails. Avoid proceeding with veristat run
if preset does not parse.
Before:
```
./veristat set_global_vars.bpf.o -G "arr[999999999999999999999] = 1"
Failed to parse value '999999999999999999999'
Processing 'set_global_vars.bpf.o'...
File                   Program           Verdict  Duration (us)  Insns  States  Program size  Jited size
---------------------  ----------------  -------  -------------  -----  ------  ------------  ----------
set_global_vars.bpf.o  test_set_globals  success             27     64       0            82           0
---------------------  ----------------  -------  -------------  -----  ------  ------------  ----------
Done. Processed 1 files, 0 programs. Skipped 1 files, 0 programs.
```
After:
```
./veristat set_global_vars.bpf.o -G "arr[999999999999999999999] = 1"
Failed to parse value '999999999999999999999'
Failed to parse global variable presets: arr[999999999999999999999] = 1
```

Improve error messages:
 * If preset struct member can't be found.
 * Array index out of bounds

Extract rtrim function.

Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/r/20250627144342.686896-1-mykyta.yatsenko5@gmail.com
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Support array presets in veristat</title>
<updated>2025-06-26T17:28:50Z</updated>
<author>
<name>Mykyta Yatsenko</name>
</author>
<published>2025-06-25T16:59:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=edc99d0b021c1b345af3a27150d5d23799c1bc25'/>
<id>urn:sha1:edc99d0b021c1b345af3a27150d5d23799c1bc25</id>
<content type='text'>
Implement support for presetting values for array elements in veristat.
For example:
```
sudo ./veristat set_global_vars.bpf.o -G "arr[3] = 1"
```
Arrays of structures and structure of arrays work, but each individual
scalar value has to be set separately: `foo[1].bar[2] = value`.

Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20250625165904.87820-3-mykyta.yatsenko5@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Separate var preset parsing in veristat</title>
<updated>2025-06-26T17:28:50Z</updated>
<author>
<name>Mykyta Yatsenko</name>
</author>
<published>2025-06-25T16:59:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=be898cb5cbf4dede2f760303d73f5a427107282a'/>
<id>urn:sha1:be898cb5cbf4dede2f760303d73f5a427107282a</id>
<content type='text'>
Refactor var preset parsing in veristat to simplify implementation.
Prepare parsed variable beforehand so that parsing logic is separated
from functionality of calculating offsets and searching fields.
Introduce rvalue struct, storing either int or enum (string value),
will be reused in the next patch, extract parsing rvalue into a
separate function.

Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Link: https://lore.kernel.org/bpf/20250625165904.87820-2-mykyta.yatsenko5@gmail.com
</content>
</entry>
<entry>
<title>selftests/bpf: Fix unintentional switch case fall through</title>
<updated>2025-06-17T20:24:31Z</updated>
<author>
<name>Mykyta Yatsenko</name>
</author>
<published>2025-06-17T12:15:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=66ab68c9de89672366fdc474f4f185bb58cecf2d'/>
<id>urn:sha1:66ab68c9de89672366fdc474f4f185bb58cecf2d</id>
<content type='text'>
Break from switch expression after parsing -n CLI argument in veristat,
instead of falling through and enabling comparison mode.

Fixes: a5c57f81eb2b ("veristat: add ability to set BPF_F_TEST_SANITY_STRICT flag with -r flag")
Signed-off-by: Mykyta Yatsenko &lt;yatsenko@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yonghong.song@linux.dev&gt;
Link: https://lore.kernel.org/bpf/20250617121536.1320074-1-mykyta.yatsenko5@gmail.com
</content>
</entry>
<entry>
<title>veristat: Memory accounting for bpf programs</title>
<updated>2025-06-13T17:44:12Z</updated>
<author>
<name>Eduard Zingerman</name>
</author>
<published>2025-06-13T07:21:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=67cdcc405b46c13446d6d220a108daa2f8de3436'/>
<id>urn:sha1:67cdcc405b46c13446d6d220a108daa2f8de3436</id>
<content type='text'>
This commit adds a new field mem_peak / "Peak memory (MiB)" field to a
set of gathered statistics. The field is intended as an estimate for
peak verifier memory consumption for processing of a given program.

Mechanically stat is collected as follows:
- At the beginning of handle_verif_mode() a new cgroup is created
  and veristat process is moved into this cgroup.
- At each program load:
  - bpf_object__load() is split into bpf_object__prepare() and
    bpf_object__load() to avoid accounting for memory allocated for
    maps;
  - before bpf_object__load():
    - a write to "memory.peak" file of the new cgroup is used to reset
      cgroup statistics;
    - updated value is read from "memory.peak" file and stashed;
  - after bpf_object__load() "memory.peak" is read again and
    difference between new and stashed values is used as a metric.

If any of the above steps fails veristat proceeds w/o collecting
mem_peak information for a program, reporting mem_peak as -1.

While memcg provides data in bytes (converted from pages), veristat
converts it to megabytes to avoid jitter when comparing results of
different executions.

The change has no measurable impact on veristat running time.

A correlation between "Peak states" and "Peak memory" fields provides
a sanity check for gathered statistics, e.g. a sample of data for
sched_ext programs:

Program                   Peak states  Peak memory (MiB)
------------------------  -----------  -----------------
lavd_select_cpu                  2153                 44
lavd_enqueue                     1982                 41
lavd_dispatch                    3480                 28
layered_dispatch                 1417                 17
layered_enqueue                   760                 11
lavd_cpu_offline                  349                  6
lavd_cpu_online                   349                  6
lavd_init                         394                  6
rusty_init                        350                  5
layered_select_cpu                391                  4
...
rusty_stopping                    134                  1
arena_topology_node_init          170                  0

Signed-off-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20250613072147.3938139-3-eddyz87@gmail.com
</content>
</entry>
<entry>
<title>bpf/veristat: Fix veristat for map type BPF_MAP_TYPE_CGRP_STORAGE</title>
<updated>2025-06-13T17:08:22Z</updated>
<author>
<name>Song Liu</name>
</author>
<published>2025-06-13T05:00:01Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ccefa19335a0b81f11b0856e951ca909445b3783'/>
<id>urn:sha1:ccefa19335a0b81f11b0856e951ca909445b3783</id>
<content type='text'>
BPF_MAP_TYPE_CGRP_STORAGE doesn't allow non-zero max_entries. So veristat
should not set it to 1.

Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20250613050001.1058733-1-song@kernel.org
</content>
</entry>
</feed>
