~ubuntu-branches/ubuntu/lucid/apport/lucid

« back to all changes in this revision

Viewing changes to data/general-hooks/parse_segv.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2010-04-14 14:42:28 UTC
  • mfrom: (148.1.27)
  • Revision ID: package-import@ubuntu.com-20100414144228-2pozsl0xma2816ns
Tags: 1.13.3-0ubuntu1
* New upstream bug fix release:
  - data/general-hooks/parse_segv.py: suggest segv-in-kernel possibility.
  - ui.py: When running as root, only show system crash reports, to avoid
    restarting user programs as root. (LP: #445017)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# of a segfault.  Currently very very simplistic, and only finds commonly
4
4
# understood situations for x86/x86_64.
5
5
#
6
 
# Copyright 2009  Canonical, Ltd.
 
6
# Copyright 2009-2010  Canonical, Ltd.
7
7
# Author: Kees Cook <kees@ubuntu.com>
8
8
#
9
9
# This program is free software; you can redistribute it and/or modify it
312
312
                understood = True
313
313
 
314
314
        if not understood:
315
 
            reason.append('Reason could not be automatically determined.')
316
 
            details.append('Reason could not be automatically determined.')
 
315
            vma = self.find_vma(self.pc)
 
316
            if vma and (vma['name'] == '[vdso]' or vma['name'] == '[vsyscall]'):
 
317
                reason.append('Reason could not be automatically determined. (Unhandled exception in kernel code?)')
 
318
                details.append('Reason could not be automatically determined. (Unhandled exception in kernel code?)')
 
319
            else:
 
320
                reason.append('Reason could not be automatically determined.')
 
321
                details.append('Reason could not be automatically determined.')
317
322
        return understood, '\n'.join(reason), '\n'.join(details)
318
323
 
319
324
 
880
885
                self.assertTrue(understood, details)
881
886
                self.assertTrue('SP (0xbfc56000) not located in a known VMA region (needed readable region)!' in details, details)
882
887
 
 
888
            def test_segv_stack_failure(self):
 
889
                '''Handles unknown segfaults in kernel'''
 
890
 
 
891
                # Crash in valid code path
 
892
                disasm = '''0x0056e010: ret'''
 
893
                segv = ParseSegv(regs, disasm, maps)
 
894
                understood, reason, details = segv.report()
 
895
                self.assertFalse(understood, details)
 
896
                self.assertTrue('Reason could not be automatically determined.' in details, details)
 
897
                self.assertFalse('(Unhandled exception in kernel code?)' in details, details)
 
898
 
 
899
                # Crash from kernel code path
 
900
                disasm = '''0x00b67422 <__kernel_vsyscall+2>: ret'''
 
901
                segv = ParseSegv(regs, disasm, maps)
 
902
                understood, reason, details = segv.report()
 
903
                self.assertFalse(understood, details)
 
904
                self.assertTrue('Reason could not be automatically determined. (Unhandled exception in kernel code?)' in details, details)
 
905
 
 
906
 
883
907
    unittest.main()