Public bug reported:

== Summary ==
ftrace:test.d--00basic--trace_marker_raw.tc in ubuntu_kselftests_ftrace failed 
on stonking 7.3.0-11.12 generic ppc64el:
- The test hit the outer 600s timeout. The same timeout is reported on all 
architectures on stonking since 7.3.0-5.5
- Root cause found on a stonking 7.3.0-11-generic x86_64 machine: dd from 
uutils coreutils (rust-coreutils 0.12.0-1ubuntu2) cannot write to the 
non-seekable tracefs file trace_marker_raw.

== Test Information ==
* SRU Cycle: sru-20261109
* Series: stonking
* Package: linux
* Kernel Version: 7.3.0-11.12
* Arch: ppc64el
* Cloud / Target: openstack
* Test Suite: ubuntu_kselftests_ftrace
* Test Case: ftrace:test.d--00basic--trace_marker_raw.tc

== Failure Log ==
Running 'timeout 600s ./ftracetest -v test.d/00basic/trace_marker_raw.tc'
=== Ftrace unit tests ===
[1] Basic tests on writing to trace_marker_raw
Timer expired (600 sec.), nuking pid by the timeout command

== Analysis ==
The kernel tools/testing/selftests/ftrace/test.d/00basic/trace_marker_raw.tc in 
Ubuntu-7.3.0-11.12 (upstream v7.3) write_buffer() does:

  printf "$str" | dd of=trace_marker_raw bs=$len iflag=fullblock

In v7.1 the same test wrote with a plain "printf ... > trace_marker_raw" (no 
dd).
The dd based write_buffer() is present in v7.3. The test passed on 7.1.0-5.5 and
fails on 7.3.0-5.5 and later, according to our test history. It is not verified
that the 7.1.0-5.5 run used the same userland (uutils coreutils).

The test then runs
"awk ... trace_pipe", which only exits after 31 lines or a length mismatch, so 
with no raw events it blocks forever until the outer timeout kills it.

Reproduced manually on stonking 7.3.0-11-generic x86_64 (tracefs):

  $ dd --version | head -1
  dd (uutils coreutils) 0.12.0
  # printf '\001\000\000\000XXXX' | dd of=trace_marker_raw bs=8 iflag=fullblock
  dd: failed to seek in output file: Illegal seek

strace of uutils dd:

  openat(AT_FDCWD, "trace_marker_raw", O_WRONLY|O_CREAT|O_CLOEXEC, 0666) = 3
  ftruncate(3, 0)                         = 0
  lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
  dd: failed to seek in output file: Illegal seek

After this, "entries-in-buffer/entries-written" in the trace file is
0/0.

Comparison running the same write_buffer / test_multiple_writes logic with a 
20s timeout:
* uutils dd (default): all 30 writes fail, no raw events in the trace buffer, 
awk blocks on trace_pipe until killed.
* GNU dd (/usr/bin/gnudd from gnu-coreutils, put first in PATH): all 30 writes 
succeed, 30 raw events are recorded, awk exits with rc=0.

Writing to trace_marker_raw with cat also works, so the kernel side
accepts the writes.

Same trace with GNU dd (strace):

  lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)   <- 
stdin, ignored
  openat(AT_FDCWD, "trace_marker_raw", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
  write(1, "\1\0\0\0XXXX", 8)             = 8

GNU dd opens the output with O_TRUNC and never calls ftruncate()/lseek()
on it when seek= is not given, so it never hits ESPIPE on the output.
uutils dd opens without O_TRUNC, then calls ftruncate() and lseek(fd, 0,
SEEK_CUR) on the output and treats the ESPIPE as fatal.

== Verified ==
* On stonking 7.3.0-11-generic x86_64, uutils dd fails to write to 
trace_marker_raw (ESPIPE on lseek of the output) and GNU dd succeeds.
* With uutils dd the ftrace test logic records 0 raw events and awk blocks on 
trace_pipe; with GNU dd it records 30 events and awk exits with rc=0.
* The kernel accepts writes to trace_marker_raw (cat and GNU dd work).

== Not verified ==
* Whether this is a uutils bug or intended behaviour; GNU dd simply does not 
issue the failing lseek on the output.
* resolute is likely unaffected because it uses GNU coreutils or an older test 
script; not checked.
* Only reproduced on x86_64 with a manual re-implementation of the test logic, 
not with the full ./ftracetest. And not on other architectures like ppc64el, 
amd64, arm64, and s390x but they share the same package.
* The kernel source was read from the Ubuntu tree for Ubuntu-7.3.0-11.12 and 
upstream (official kernel.org) v7.1 and v7.3.

== Possible fixes ==
* rust-coreutils: do not fail when the initial ftruncate()/lseek() on a 
non-seekable output file returns ESPIPE (GNU dd does not seek the output unless 
seek= is given).
* Test side (kselftest ftrace): do not rely on dd for this write, and check the 
write result so the test fails instead of blocking in awk.

** Affects: ubuntu-kernel-tests
     Importance: Undecided
         Status: New

** Affects: rust-coreutils (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: 7.3 generic openstack ppc64el sru-20261109 stonking 
ubuntu-kselftests-ftrace

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2174694

Title:
  trace_marker_raw.tc in ubuntu_kselftests_ftrace failed on stonking
  (test timed out after 600s)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2174694/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to