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: <20260129120523.6f710ff2@gandalf.local.home>
Date: Thu, 29 Jan 2026 12:05:23 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Vincent Donnefort <vdonnefort@...gle.com>
Cc: mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
 linux-trace-kernel@...r.kernel.org, maz@...nel.org, oliver.upton@...ux.dev,
 joey.gouly@....com, suzuki.poulose@....com, yuzenghui@...wei.com,
 kvmarm@...ts.linux.dev, linux-arm-kernel@...ts.infradead.org,
 jstultz@...gle.com, qperret@...gle.com, will@...nel.org,
 aneesh.kumar@...nel.org, kernel-team@...roid.com,
 linux-kernel@...r.kernel.org, Shuah Khan <skhan@...uxfoundation.org>,
 linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v10 15/30] tracing: selftests: Add trace remote tests

On Mon, 26 Jan 2026 10:44:04 +0000
Vincent Donnefort <vdonnefort@...gle.com> wrote:

> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/remotes/trace.tc
> @@ -0,0 +1,127 @@
> +#!/bin/sh
> +# SPDX-License-Identifier: GPL-2.0
> +# description: Test trace remote non-consuming read
> +# requires: remotes/test
> +
> +. $TEST_DIR/remotes/functions
> +
> +test_trace()
> +{
> +	echo 0 > tracing_on
> +    assert_unloaded
> +
> +    echo 7 > buffer_size_kb
> +    echo 1 > tracing_on
> +    assert_loaded
> +
> +    # Simple test: Emit few events and try to read them
> +    for i in $(seq 1 8); do
> +        echo $i > write_event
> +    done
> +
> +    check_trace 1 8 trace
> +
> +    #
> +    # Test interaction with consuming read
> +    #
> +
> +    cat trace_pipe > /dev/null &
> +    pid=$!
> +
> +    sleep 1
> +    kill $pid
> +
> +    test $(wc -l < trace) -eq 0
> +
> +    for i in $(seq 16 32); do
> +        echo $i > write_event
> +    done
> +
> +    check_trace 16 32 trace
> +
> +    #
> +    # Test interaction with reset
> +    #
> +
> +    echo 0 > trace
> +
> +    test $(wc -l < trace) -eq 0
> +
> +    for i in $(seq 1 8); do
> +        echo $i > write_event
> +    done
> +
> +    check_trace 1 8 trace
> +
> +    #
> +    # Test interaction with lost events
> +    #
> +
> +    # Ensure the writer is not on the reader page by reloading the buffer
> +    echo 0 > tracing_on
> +    echo 0 > trace
> +    assert_unloaded
> +    echo 1 > tracing_on
> +    assert_loaded
> +
> +    # Ensure ring-buffer overflow by emitting events from the same CPU
> +    for cpu in $(get_cpu_ids); do
> +        break
> +    done
> +
> +    events_per_page=$(($(get_page_size) / $(get_selftest_event_size))) # Approx: does not take TS into account
> +    nr_events=$(($events_per_page * 2))
> +    for i in $(seq 1 $nr_events); do
> +        taskset -c $cpu echo $i > write_event
> +    done
> +
> +    id=$(sed -n -e '1s/\[[0-9]*\]\s*[0-9]*.[0-9]*: [a-z]* id=\([0-9]*\)/\1/p' trace)
> +    test $id -ne 1
> +
> +    check_trace $id $nr_events trace
> +
> +    #
> +    # Test per-CPU interface
> +    #
> +    echo 0 > trace
> +
> +    for cpu in $(get_cpu_ids) ; do
> +        taskset -c $cpu echo $cpu > write_event
> +    done
> +
> +    for cpu in $(get_cpu_ids); do
> +        cd per_cpu/cpu$cpu/
> +
> +        check_trace $cpu $cpu trace
> +
> +        cd - > /dev/null
> +    done
> +
> +    #
> +    # Test with hotplug
> +    #
> +
> +    [ "$(get_cpu_ids | wc -l)" -ge 2 ] || return 0
> +
> +    echo 0 > trace
> +
> +    for cpu in $(get_cpu_ids); do
> +        echo 0 > /sys/devices/system/cpu/cpu$cpu/online

Note, my test VM doesn't have cpu0/online, so this needs to test for the
existence of these files:

 ./ftracetest: 105: /work/git/linux.git/tools/testing/selftests/ftrace/test.d/remotes/trace_pipe.tc: cannot create /sys/devices/system/cpu/cpu0/online: Permission denied

-- Steve


> +        break
> +    done
> +
> +    for i in $(seq 1 8); do
> +        echo $i > write_event
> +    done
> +
> +    check_trace 1 8 trace
> +
> +    echo 1 > /sys/devices/system/cpu/cpu$cpu/online
> +}
> +
> +if [ -z "$SOURCE_REMOTE_TEST" ]; then
> +    set -e
> +
> +    setup_remote_test
> +    test_trace
> +fi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ