Skip to contentSkip to conversation

scripts: add ksymbolize.py

PATCH In review Alexander Potapenko 4 participants 5 messages Aug 24, 2016 – Sep 8, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: add ksymbolize.py

Commit the script that symbolizes BUG messages and KASAN error reports by adding file:line information to each stack frame.
The script is a copy of
https://github.com/google/sanitizers/blob/master/address-sanitizer/tools/kasan_symbolize.py
, originally written by Andrey Konovalov.

Cc Andrey Ryabinin <[email protected]>
Cc Dmitry Vyukov <[email protected]>
---
 MAINTAINERS           |   1 +
 scripts/ksymbolize.py | 320 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 321 insertions(+)
 create mode 100755 scripts/ksymbolize.py
MAINTAINERS +1 -0
index 20bb1d0..35ae6dd 100644
@@ -6592,6 +6592,7 @@ F:	include/linux/kasan*.h
 F:	lib/test_kasan.c
 F:	mm/kasan/
 F:	scripts/Makefile.kasan
+F:	scripts/ksymbolize.py
 
 KCONFIG
 M:	"Yann E. MORIN" <[email protected]>
scripts/ksymbolize.py new file +320 -0

320 lines not on this page · raw message

Signature · 1 line
2.8.0.rc3.226.g39d4020
#1 lore raw

Hello, Alexander.

Quoted 5 lines · Alexander Potapenko

Commit the script that symbolizes BUG messages and KASAN error reports by adding file:line information to each stack frame.
The script is a copy of
https://github.com/google/sanitizers/blob/master/address-sanitizer/tools/kasan_symbolize.py
, originally written by Andrey Konovalov.

I really like the idea of having the script in the tree but can you please be more detailed in the patch description (and possibly in the help message of the tool)? e.g. describe what it can do and show some examples. It's difficult to tell what the script is about from this posting.

Thanks.

Signature · 1 line
tejun
#2 lore raw
Quoted 9 lines · Tejun Heo

Hello, Alexander.

Quoted 5 lines · Alexander Potapenko

Commit the script that symbolizes BUG messages and KASAN error reports by adding file:line information to each stack frame.
The script is a copy of
https://github.com/google/sanitizers/blob/master/address-sanitizer/tools/kasan_symbolize.py
, originally written by Andrey Konovalov.

Quoted 5 lines

I really like the idea of having the script in the tree but can you please be more detailed in the patch description (and possibly in the help message of the tool)? e.g. describe what it can do and show some examples. It's difficult to tell what the script is about from this posting.

I've tried to use the script but had to read the code to understand how exactly to run it. So I also second that a more verbose help is needed in the script.

Quoted 3 lines

Thanks.

#3 lore raw
In reply to Alexander Potapenko
Quoted 5 lines · Alexander Potapenko

he script that symbolizes BUG messages and KASAN error reports by adding file:line information to each stack frame. The script is a copy of
https://github.com/google/sanitizers/blob/master/address-sanitizer/tools/kasan_symbolize.py
, originally written by Andrey Konovalov.

So what's the difference between this script and scripts/decode_stacktrace.sh that already lives upstream?

Thanks,
Sasha

#4 lore raw
Quoted 8 lines · Alexander
Quoted 5 lines · Alexander Potapenko

he script that symbolizes BUG messages and KASAN error reports by adding file:line information to each stack frame. The script is a copy of
https://github.com/google/sanitizers/blob/master/address-sanitizer/tools/kasan_symbolize.py
, originally written by Andrey Konovalov.

So what's the difference between this script and scripts/decode_stacktrace.sh that already lives upstream?

The biggest problem is that decode_stacktrace.sh invokes addr2line for each output line.
It took the script 30 seconds to symbolize a report with 57 stack frames on my machine, whereas ksymbolize.py did that in 1.5 seconds. I've taken a look at the decode_stacktrace.sh output, and found it not differing much from that of ksymbolize.py
There are a few minor differences that could be probably fixed in decode_stacktrace.sh (the way how inlined frames are printed, symbolization of RIP addresses or KASAN report headings), so I don't have a strong opinion about whether we need to replace one with another.
In my opinion it's easier to hack a Python script, but YMMV.

Quoted 3 lines

Thanks,
Sasha

Signature · 10 lines
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg