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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200720074429.29359-1-jslaby@suse.cz>
Date:   Mon, 20 Jul 2020 09:44:29 +0200
From:   Jiri Slaby <jslaby@...e.cz>
To:     akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org, Jiri Slaby <jslaby@...e.cz>,
        Sasha Levin <sashal@...nel.org>
Subject: [PATCH] scripts/decode_stacktrace: strip all base path prefixes

When addr2line returns more than one location, decode_stacktrace does
not currently remove base path from the paths. So the result might look
like (line wrapped here):
 ptrace_stop (include/linux/freezer.h:57
 /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../include/linux/freezer.h:67
 /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../include/linux/freezer.h:128
 /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../include/linux/freezer.h:173
 /home/abuild/rpmbuild/BUILD/kernel-default-5.8.rc5/linux-5.8-rc5/linux-obj/../kernel/signal.c:2217)

Make sure all the lines are processed, so the result now looks like
(line wrapped here again):
 ptrace_stop (include/linux/freezer.h:57 include/linux/freezer.h:67
 include/linux/freezer.h:128 include/linux/freezer.h:173
 kernel/signal.c:2217)

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Fixes: 67a28de47faa (scripts/decode_stacktrace: only strip base path when a prefix of the path)
Cc: Sasha Levin <sashal@...nel.org>
---
 scripts/decode_stacktrace.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh
index 4bdcb6d8c605..3fddcb48b464 100755
--- a/scripts/decode_stacktrace.sh
+++ b/scripts/decode_stacktrace.sh
@@ -140,14 +140,15 @@ parse_symbol() {
 		return
 	fi
 
-	# Strip out the base of the path
-	code=${code#$basepath/}
-
-	# In the case of inlines, move everything to same line
-	code=${code//$'\n'/' '}
+	declare -a output
+	while read LINE; do
+		# Strip out the base of the path
+		LINE=${LINE#$basepath/}
+		output+=("$LINE")
+	done <<< $code
 
 	# Replace old address with pretty line numbers
-	symbol="$segment$name ($code)"
+	symbol="$segment$name (${output[@]})"
 }
 
 decode_code() {
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ