[kvm-unit-tests PATCH v2 1/3] pretty_print_stacks: prevent invalid address arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a return address is zero, the script will pass -1 to addr2line which
it considers an invalid flag.
Zero is an unlikely return address, but we might see it, for example
because the backtrace is unreliable on s390x if there is an interrupt
frame on the stack.

Fixes: a9143a24 ("scripts: pretty print stack traces")
Tested-by: Thomas Huth <thuth@xxxxxxxxxx>
Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>
---
 scripts/pretty_print_stacks.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/pretty_print_stacks.py b/scripts/pretty_print_stacks.py
index 1e59cde6..ba6f0825 100755
--- a/scripts/pretty_print_stacks.py
+++ b/scripts/pretty_print_stacks.py
@@ -22,7 +22,7 @@ def pretty_print_stack(binary, line):
         if addr.startswith('@'):
             addrs[i] = addr[1:]
         else:
-            addrs[i] = '%lx' % (int(addrs[i], 16) - 1)
+            addrs[i] = '%lx' % max((int(addrs[i], 16) - 1), 0)
 
     # Output like this:
     #        0x004002be: start64 at path/to/kvm-unit-tests/x86/cstart64.S:208
-- 
2.37.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux