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-next>] [day] [month] [year] [list]
Message-Id: <20240719092619.274730-1-gankulkarni@os.amperecomputing.com>
Date: Fri, 19 Jul 2024 02:26:19 -0700
From: Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>
To: james.clark@....com,
	mike.leach@...aro.org,
	suzuki.poulose@....com
Cc: acme@...hat.com,
	coresight@...ts.linaro.org,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	darren@...amperecomputing.com,
	scclevenger@...amperecomputing.com,
	gankulkarni@...amperecomputing.com
Subject: [PATCH] perf scripts python arm-cs-trace-disasm.py: Skip disasm if address continuity is broken

To generate the instruction tracing, script uses 2 contiguous packets
address range. If there a continuity brake due to discontiguous branch
address, it is required to reset the tracing and start tracing with the
new set of contiguous packets.

Adding change to identify the break and complete the remaining tracing
of current packets and restart tracing from new set of packets, if
continuity is established.

Signed-off-by: Ganapatrao Kulkarni <gankulkarni@...amperecomputing.com>
---
 tools/perf/scripts/python/arm-cs-trace-disasm.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tools/perf/scripts/python/arm-cs-trace-disasm.py b/tools/perf/scripts/python/arm-cs-trace-disasm.py
index d973c2baed1c..ad10cee2c35e 100755
--- a/tools/perf/scripts/python/arm-cs-trace-disasm.py
+++ b/tools/perf/scripts/python/arm-cs-trace-disasm.py
@@ -198,6 +198,10 @@ def process_event(param_dict):
 		cpu_data[str(cpu) + 'addr'] = addr
 		return
 
+	if (cpu_data.get(str(cpu) + 'ip') == None):
+		cpu_data[str(cpu) + 'ip'] = ip
+
+	prev_ip = cpu_data[str(cpu) + 'ip']
 
 	if (options.verbose == True):
 		print("Event type: %s" % name)
@@ -243,12 +247,18 @@ def process_event(param_dict):
 
 	# Record for previous sample packet
 	cpu_data[str(cpu) + 'addr'] = addr
+	cpu_data[str(cpu) + 'ip'] = stop_addr
 
 	# Handle CS_ETM_TRACE_ON packet if start_addr=0 and stop_addr=4
 	if (start_addr == 0 and stop_addr == 4):
 		print("CPU%d: CS_ETM_TRACE_ON packet is inserted" % cpu)
 		return
 
+	if (stop_addr < start_addr):
+		# Continuity of the Packets broken, set start_addr to previous
+		# packet ip to complete the remaining tracing of the address range.
+		start_addr = prev_ip
+
 	if (start_addr < int(dso_start) or start_addr > int(dso_end)):
 		print("Start address 0x%x is out of range [ 0x%x .. 0x%x ] for dso %s" % (start_addr, int(dso_start), int(dso_end), dso))
 		return
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ