Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 Google Inc. | 1 // Copyright (c) 2013 Google Inc. |
| 2 // All rights reserved. | 2 // All rights reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
| 6 // met: | 6 // met: |
| 7 // | 7 // |
| 8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
| 9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
| 10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 // exploitability_linux.h: Linux specific exploitability engine. | 30 // exploitability_linux.h: Linux specific exploitability engine. |
| 31 // | 31 // |
| 32 // Provides a guess at the exploitability of the crash for the Linux | 32 // Provides a guess at the exploitability of the crash for the Linux |
| 33 // platform given a minidump and process_state. | 33 // platform given a minidump and process_state. |
| 34 // | 34 // |
| 35 // Author: Matthew Riley | 35 // Author: Matthew Riley |
| 36 | 36 |
| 37 #ifndef GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ | 37 #ifndef GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ |
| 38 #define GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ | 38 #define GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ |
| 39 | 39 |
| 40 #include <elf.h> | |
| 41 | |
| 40 #include "google_breakpad/common/breakpad_types.h" | 42 #include "google_breakpad/common/breakpad_types.h" |
| 41 #include "google_breakpad/processor/exploitability.h" | 43 #include "google_breakpad/processor/exploitability.h" |
| 42 | 44 |
| 43 namespace google_breakpad { | 45 namespace google_breakpad { |
| 44 | 46 |
| 45 class ExploitabilityLinux : public Exploitability { | 47 class ExploitabilityLinux : public Exploitability { |
| 46 public: | 48 public: |
| 47 ExploitabilityLinux(Minidump *dump, | 49 ExploitabilityLinux(Minidump *dump, |
| 48 ProcessState *process_state); | 50 ProcessState *process_state); |
| 49 | 51 |
| 50 virtual ExploitabilityRating CheckPlatformExploitability(); | 52 virtual ExploitabilityRating CheckPlatformExploitability(); |
| 51 | 53 |
| 52 private: | 54 private: |
| 53 // This method takes the address of the instruction pointer and returns | 55 // This method takes the address of the instruction pointer and returns |
| 54 // whether the instruction pointer lies in a valid instruction region. | 56 // whether the instruction pointer lies in a valid instruction region. |
| 55 bool InstructionPointerInCode(uint64_t instruction_ptr); | 57 bool InstructionPointerInCode(uint64_t instruction_ptr); |
| 56 | 58 |
| 57 // This method checks the exception that triggered the creation of the | 59 // This method checks the exception that triggered the creation of the |
| 58 // minidump and reports whether the exception suggests no exploitability. | 60 // minidump and reports whether the exception suggests no exploitability. |
| 59 bool BenignCrashTrigger(const MDRawExceptionStream *raw_exception_stream); | 61 bool BenignCrashTrigger(const MDRawExceptionStream *raw_exception_stream); |
| 62 | |
| 63 // Checks if the minidump architecture is 32-bit or 64-bit. | |
| 64 bool Architecture32Bit(); | |
|
ivanpe
2015/07/14 00:23:02
Maybe a better name would be: Is32BitArchitecture(
liuandrew
2015/07/15 21:50:14
I changed the method name to ArchitectureType() to
| |
| 65 | |
| 66 // Copies ELF header data from the minidump's memory to a pointer. | |
|
ivanpe
2015/07/14 00:23:02
It is a bit unclear which ones are input and which
ahonig
2015/07/14 19:32:18
To clarify Ivan's point
It looks from the interfa
liuandrew
2015/07/15 21:50:14
Done.
| |
| 67 // This method takes in the region of memory to be copied, the starting | |
| 68 // memory address to copy, and the number of bytes to copy. | |
| 69 void *LoadElfHeader(MinidumpMemoryRegion *memory, | |
| 70 const uint64_t base_address, | |
| 71 size_t header_size); | |
| 72 | |
| 73 // Copies the ELF header of a 32-bit module. | |
| 74 // This method takes in the region of memory to be copied, and the | |
| 75 // starting memory address to copy. | |
| 76 Elf32_Ehdr *LoadElf32Header(MinidumpMemoryRegion *memory, | |
|
ivanpe
2015/07/14 00:23:02
Please, document the return value and clarify whet
liuandrew
2015/07/15 21:50:14
method removed
| |
| 77 const uint64_t base_address); | |
| 78 | |
| 79 // Copies the ELF header of a 64-bit module. | |
| 80 // This method takes in the region of memory to be copied, and the | |
| 81 // starting memory address to copy. | |
| 82 Elf64_Ehdr *LoadElf64Header(MinidumpMemoryRegion *memory, | |
|
ivanpe
2015/07/14 00:23:02
Please, document the return value and clarify whet
liuandrew
2015/07/15 21:50:14
method removed
| |
| 83 const uint64_t base_address); | |
| 84 | |
| 85 // Copies over a 32-bit module's program header table. | |
| 86 // This method takes in the region of memory to be copied, the base | |
| 87 // address of the module, the offset from the base address to the | |
| 88 // starting memory address to copy, the size of an entry in the program | |
| 89 // header table, and the number of entries in the program header table. | |
| 90 Elf32_Phdr *LoadElf32PHeader(MinidumpMemoryRegion *memory, | |
|
ivanpe
2015/07/14 00:23:02
Please, document the return value and clarify whet
liuandrew
2015/07/15 21:50:14
method removed
| |
| 91 const uint64_t base_address, | |
| 92 const uint64_t e_phoff, | |
| 93 const uint16_t e_phentsize, | |
| 94 const uint16_t e_phnum); | |
| 95 | |
| 96 // Copies over a 64-bit module's program header table. | |
| 97 // This method takes in the region of memory to be copied, the base | |
| 98 // address of the module, the offset from the base address to the | |
| 99 // starting memory address to copy, the size of an entry in the program | |
| 100 // header table, and the number of entries in the program header table. | |
| 101 Elf64_Phdr *LoadElf64PHeader(MinidumpMemoryRegion *memory, | |
|
ivanpe
2015/07/14 00:23:02
Please, document the return value and clarify whet
liuandrew
2015/07/15 21:50:14
method removed
| |
| 102 const uint64_t base_address, | |
| 103 const uint64_t e_phoff, | |
| 104 const uint16_t e_phentsize, | |
| 105 const uint16_t e_phnum); | |
| 60 }; | 106 }; |
| 61 | 107 |
| 62 } // namespace google_breakpad | 108 } // namespace google_breakpad |
| 63 | 109 |
| 64 #endif // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ | 110 #endif // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ |
| OLD | NEW |