| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 44 namespace google_breakpad { | 44 namespace google_breakpad { | 
| 45 | 45 | 
| 46 class ExploitabilityLinux : public Exploitability { | 46 class ExploitabilityLinux : public Exploitability { | 
| 47  public: | 47  public: | 
| 48   ExploitabilityLinux(Minidump *dump, | 48   ExploitabilityLinux(Minidump *dump, | 
| 49                       ProcessState *process_state); | 49                       ProcessState *process_state); | 
| 50 | 50 | 
| 51   virtual ExploitabilityRating CheckPlatformExploitability(); | 51   virtual ExploitabilityRating CheckPlatformExploitability(); | 
| 52 | 52 | 
| 53  private: | 53  private: | 
|  | 54   friend class ExploitabilityLinuxTest; | 
|  | 55 | 
| 54   // Takes the address of the instruction pointer and returns | 56   // Takes the address of the instruction pointer and returns | 
| 55   // whether the instruction pointer lies in a valid instruction region. | 57   // whether the instruction pointer lies in a valid instruction region. | 
| 56   bool InstructionPointerInCode(uint64_t instruction_ptr); | 58   bool InstructionPointerInCode(uint64_t instruction_ptr); | 
| 57 | 59 | 
| 58   // Checks the exception that triggered the creation of the | 60   // Checks the exception that triggered the creation of the | 
| 59   // minidump and reports whether the exception suggests no exploitability. | 61   // minidump and reports whether the exception suggests no exploitability. | 
| 60   bool BenignCrashTrigger(const MDRawExceptionStream *raw_exception_stream); | 62   bool BenignCrashTrigger(const MDRawExceptionStream *raw_exception_stream); | 
| 61 | 63 | 
|  | 64   // This method checks if the crash occurred during a write to read-only or | 
|  | 65   // invalid memory. It does so by checking if the instruction at the | 
|  | 66   // instruction pointer is a write instruction, and if the target of the | 
|  | 67   // instruction is at a spot in memory that prohibits writes. | 
|  | 68   bool EndedOnIllegalWrite(uint64_t instruction_ptr); | 
|  | 69 | 
|  | 70 #ifndef _WIN32 | 
|  | 71   // Disassembles raw bytes via objdump and pipes the output into the provided | 
|  | 72   // buffer, given the desired architecture, the file from which objdump will | 
|  | 73   // read, and the buffer length. The method returns whether the disassembly | 
|  | 74   // was a success, and the caller owns all pointers. | 
|  | 75   static bool DisassembleBytes(const string &architecture, | 
|  | 76                                const uint8_t *raw_bytes, | 
|  | 77                                const unsigned int MAX_OBJDUMP_BUFFER_LEN, | 
|  | 78                                char *objdump_output_buffer); | 
|  | 79 | 
|  | 80   // Tokenizes out the operation and operands from a line of instruction | 
|  | 81   // disassembled by objdump. This method modifies the pointers to match the | 
|  | 82   // tokens of the instruction, and returns if the tokenizing was a success. | 
|  | 83   // The caller owns all pointers. | 
|  | 84   static bool TokenizeObjdumpInstruction(const string &line, | 
|  | 85                                          string *operation, | 
|  | 86                                          string *dest, | 
|  | 87                                          string *src); | 
|  | 88 | 
|  | 89   // Calculates the effective address of an expression in the form reg+a or | 
|  | 90   // reg-a, where 'reg' is a register and 'a' is a constant, and writes the | 
|  | 91   // result in the pointer. The method returns whether the calculation was | 
|  | 92   // a success. The caller owns the pointer. | 
|  | 93   static bool CalculateAddress(const string &address_expression, | 
|  | 94                                const DumpContext &context, | 
|  | 95                                uint64_t *write_address); | 
|  | 96 #endif  // _WIN32 | 
|  | 97 | 
| 62   // Checks if the stack pointer points to a memory mapping that is not | 98   // Checks if the stack pointer points to a memory mapping that is not | 
| 63   // labelled as the stack. | 99   // labelled as the stack. | 
| 64   bool StackPointerOffStack(uint64_t stack_ptr); | 100   bool StackPointerOffStack(uint64_t stack_ptr); | 
| 65 | 101 | 
| 66   // Checks if the stack or heap are marked executable according | 102   // Checks if the stack or heap are marked executable according | 
| 67   // to the memory mappings. | 103   // to the memory mappings. | 
| 68   bool ExecutableStackOrHeap(); | 104   bool ExecutableStackOrHeap(); | 
| 69 }; | 105 }; | 
| 70 | 106 | 
| 71 }  // namespace google_breakpad | 107 }  // namespace google_breakpad | 
| 72 | 108 | 
| 73 #endif  // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ | 109 #endif  // GOOGLE_BREAKPAD_PROCESSOR_EXPLOITABILITY_LINUX_H_ | 
| OLD | NEW | 
|---|