libtracefs 1.8.4 has failing tests on Ubuntu
Hi,
in Ubuntu we run the tests once against the installed library and once with valgrind. The valgrind tests were failing in our patched 1.8.3 version. So I upgraded to 1.8.4 and now both tests are failing:
trace-utest:
Test: Follow events clear ...FAILED
1. tracefs-utest.c:1747 - fdata.missed_hit > 0
trace-utest-valgrind:
414s Test: trace cpu pipe ...missed events -1
419s missed events 796093548
419s ==6341== Invalid read of size 8
419s ==6341== at 0x48A5F34: ??? (in /usr/lib/x86_64-linux-gnu/libtraceevent.so.1.9.0) 419s ==6341== by 0x48A9177: kbuffer_load_subbuffer (in /usr/lib/x86_64-linux-gnu/libtraceevent.so.1.9.0) 419s ==6341== by 0x400D82C: read_trace_cpu_file (tracefs-utest.c:2015)
419s ==6341== by 0x400DAEB: test_cpu_pipe (tracefs-utest.c:2080)
419s ==6341== by 0x400DBE7: test_instance_trace_cpu_pipe (tracefs-utest.c:2096)
419s ==6341== by 0x400DC3D: test_trace_cpu_pipe (tracefs-utest.c:2105)
419s ==6341== by 0x48BF94C: ??? (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1)
419s ==6341== by 0x48BFC77: ??? (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1)
419s ==6341== by 0x48C0C0F: CU_run_all_tests (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1) 419s ==6341== by 0x4006D9B: main (trace-utest.c:81)
419s ==6341== Address 0x8676a90 is 0 bytes after a block of size 4,096 alloc'd
419s ==6341== at 0x4887E43: calloc (vg_replace_malloc.c:1616)
419s ==6341== by 0x400A629: setup_trace_cpu (tracefs-utest.c:1152)
419s ==6341== by 0x400DB7A: test_instance_trace_cpu_pipe (tracefs-utest.c:2089)
419s ==6341== by 0x400DC3D: test_trace_cpu_pipe (tracefs-utest.c:2105)
419s ==6341== by 0x48BF94C: ??? (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1)
419s ==6341== by 0x48BFC77: ??? (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1)
419s ==6341== by 0x48C0C0F: CU_run_all_tests (in /usr/lib/x86_64-linux-gnu/libcunit.so.1.0.1) 419s ==6341== by 0x4006D9B: main (trace-utest.c:81)
419s ==6341==
425s missed events -1
430s missed events 173403680
430s FAILED
430s 1. tracefs-utest.c:2082 - cnt == expect
430s 2. tracefs-utest.c:2082 - cnt == expect
430s 3. tracefs-utest.c:2082 - cnt == expect
430s 4. tracefs-utest.c:2082 - cnt == expect
[...]
The corresponding Ubuntu bug is https://launchpad.net/bugs/2172071 and the full test log can be found on
https://autopkgtest.ubuntu.com/results/autopkgtest-tenacious/tenacious/amd64/libt/libtracefs/20261022_134419_661b1@/log.gz
The failure is reproducible.
The Ubuntu package only carries this patch that should not have an influence:
https://git.launchpad.net/ubuntu/+source/libtracefs/plain/debian/patches/add-find_debug_tracing_dir-to-tracefs-utest.patch
Signature · 2 lines
Benjamin Drung Debian & Ubuntu Developer
PATCH 1/1 libtracefs utest: Fix buffer size in follow events clear test
Commit 310b796 (libtracefs utest: Add better logic to cause missed events) reduced the buffer size to make missed events more likely during the follow events clear test.
However, getpagesize() returns the page size in bytes, while tracefs_instance_set_buffer_size() expects the buffer size in kilobytes. This causes the buffer to be set 1024 times larger than intended, making it less likely to overflow and trigger missed events.
Convert the buffer size from bytes to kilobytes to ensure the intended buffer size of 4 pages is used.
--- utest/tracefs-utest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
utest/tracefs-utest.c +1 -1
@@ -1721,7 +1721,7 @@ static void test_instance_follow_events_clear(struct tracefs_instance *instance)/* Shrink the buffer to make sure we have missed events */ page_size =getpagesize (); save_size =tracefs_instance_get_buffer_size (instance,0 ); - ret =tracefs_instance_set_buffer_size (instance, page_size *4 ,0 ); + ret =tracefs_instance_set_buffer_size (instance, (page_size *4 ) /1024 ,0 );CU_TEST (ret ==0 );tracefs_trace_on (instance);
Signature · 1 line
2.53.0