From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796213799; b=cGuKPlgAHwTvEMkLstWDdtoSqZV5DC7qN14YrsEQ20r/hEgQP4b1avHCqs9zqXI8cpVl ztkNdIfMAtRJqAS6oPDDvzgR3zvSLkjkEpSes3O8OiuLu7+/vMnyye+l1g5sCcCYVYmz2 /vXTJ0kacVq4B2VbhRaSkrJUgt3P9t+1EdfFvc/2lN0wNI46/rb8YSneZM2oLO3/CtwCV 9IZh5kiGlOxft6e5FxuetouX0baLZYp4dUR+Efa96YTDmIIRdMHPZU4Mk/2uf/K3D4jfU D+PryvsNaJ1KZjRl8mwLtI0bkyz8+DQx9zhmdPyNMTe/SPI135350YR4HyD1Q7p1h9Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796213799; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:From:To:Cc:Subject:Date: Message-ID:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Scanned-By; bh=2gmkW+yC6fQma0+SwUxi2G+Z6PuoZ5a3p9LT6sbghDk=; b=uu72WVm1TxP6qfTR0ZGRR8lWwafySniVV3S9pgWAR5WsQyNkG9TBZ3GeiyDLtDJoGb1U 8qWktWE3C5GJnyMoYqOEm8FqDO+4yWZZ7uCTuyQ6hlsqRruB2m7sxC0ZUqQ7uNj97dim8 0RLlkjtgOl1B9fTrY+vaa3/rtpmKPioOH6JJNVE2yAzIAKIEuo0R168e8uNyABXRYOL9+ r13pvjwCntkDdlflmzGx3xOSh4CD57cObZq2uoesNqhu64yy2Hg+9IdT15vCX/jE3YO53 C3V+rNFrPhN/xe3FpsGjRpLTa7KJ04fq8CuhYQtJIVsDFx6bSNf46LGAgJQpN5Bg6Lw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P590dsce; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90891606A687 for ; Wed, 2 Dec 2026 12:16:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 90891606A687 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P590dsce DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796213798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2gmkW+yC6fQma0+SwUxi2G+Z6PuoZ5a3p9LT6sbghDk=; b=P590dscezYEbXk0enuEkFSz3eqXPKmD3a+dXs1/exaQNgO58eWczxc6I5s7ko8QTcdmq3W grTa6I4un0Xfw8CsFSAJadjoEmKElnUMjsML3YcrxICPdy7K+coTlubXa80VWPl7vKWocO CXinYxnQA0DjcPIYjX9I0cLv6/1R8hE= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-6-wkEINobBP3Wt7RdQ3utQFQ-1; Wed, 2 Dec 2026 12:16:31 +0000 X-MC-Unique: wkEINobBP3Wt7RdQ3utQFQ-1 X-Mimecast-MFC-AGG-ID: wkEINobBP3Wt7RdQ3utQFQ_1796213789 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A4C81192E273; Wed, 2 Dec 2026 12:16:29 +0000 (UTC) Received: from mpazur-thinkpadt14gen6.redhat.corp (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9FF35180157B; Wed, 2 Dec 2026 12:16:27 +0000 (UTC) From: Marek Pazur To: Arnaldo Carvalho de Melo , Namhyung Kim Cc: Jiri Olsa , Ian Rogers , Adrian Hunter , Howard Chu , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] perf test trace_btf_general: Use %s format specifier when printing test output Date: Wed, 2 Dec 2026 13:16:21 +0100 Message-ID: <20261202121622.30071-2-mpazur@redhat.com> In-Reply-To: <20261202121622.30071-1-mpazur@redhat.com> References: <20261202121622.30071-1-mpazur@redhat.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 The shell tests insert the captured perf trace output directly into the printf format string as follows: printf "Buffer augmentation test failed, output: \n$output\n" As a result, printf interprets any possible escape sequences and conversion specifications within the payload. Because perf trace prints non-printable characters in decimal while printf parses backslash escapes as octal, a newline character printed by perf as "\10" (decimal 10) is interpreted by printf as a backspace (octal 10), corrupting the failure message: Buffer augmentation test failed, output: buffer content echo/129407 write(1, buffer conten, 15, 0) = 15 instead of: echo/129407 write(1, buffer content\10, 15, 0) = 15 Pass the output as an argument to a "%s" conversion specifier instead across all failure messages in the test. Signed-off-by: Marek Pazur --- tools/perf/tests/shell/trace_btf_general.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/shell/trace_btf_general.sh b/tools/perf/tests/shell/trace_btf_general.sh index d1fa7c846478..0941459a7137 100755 --- a/tools/perf/tests/shell/trace_btf_general.sh +++ b/tools/perf/tests/shell/trace_btf_general.sh @@ -22,42 +22,42 @@ check_vmlinux() { return 2 fi return 0 } trace_test_string() { echo "Testing perf trace's string augmentation" output="$(perf trace --sort-events -e renameat* -- mv ${file1} ${file2} 2>&1)" if ! echo "$output" | grep -q -E "^mv/[0-9]+ renameat(2)?\(.*, \"${file1}\", .*, \"${file2}\", .*\) += +[0-9]+$" then - printf "String augmentation test failed, output:\n$output\n" + printf "String augmentation test failed, output:\n%s\n" "$output" err=1 fi } trace_test_buffer() { echo "Testing perf trace's buffer augmentation" # echo will insert a newline (\10) at the end of the buffer output="$(perf trace --sort-events -e write -- echo "${buffer}" 2>&1)" if ! echo "$output" | grep -q -E "^echo/[0-9]+ write\([0-9]+, ${buffer}.*, [0-9]+\) += +[0-9]+$" then - printf "Buffer augmentation test failed, output:\n$output\n" + printf "Buffer augmentation test failed, output:\n%s\n" "$output" err=1 fi } trace_test_struct_btf() { echo "Testing perf trace's struct augmentation" output="$(perf trace --sort-events -e clock_nanosleep --force-btf -- sleep 1 2>&1)" if ! echo "$output" | grep -q -E "^sleep/[0-9]+ clock_nanosleep\(0, 0, \{1,.*\}, 0x[0-9a-f]+\) += +[0-9]+$" then - printf "BTF struct augmentation test failed, output:\n$output\n" + printf "BTF struct augmentation test failed, output:\n%s\n" "$output" err=1 fi } cleanup() { rm -rf ${file1} ${file2} ${perf_config_tmp} } trap_cleanup() { echo "Unexpected signal in ${FUNCNAME[1]}" -- 2.55.0