OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 Google Inc. All Rights Reserved. |
| 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at |
| 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 // See the License for the specific language governing permissions and |
| 13 // limitations under the License. |
| 14 // |
| 15 // This transform redirects the '__report_gsfailure' function to |
| 16 // the following assembly stub: 'mov [deadbeef], 0'. |
| 17 // The function __report_gsfailure raises an exception that an EH |
| 18 // cannot intercept (for security reasons); this transform allows |
| 19 // an EH to catch the GS failures. |
| 20 |
| 21 #ifndef SYZYGY_INSTRUMENT_TRANSFORMS_SECURITY_COOKIE_CHECK_HOOK_TRANSFORM_H_ |
| 22 #define SYZYGY_INSTRUMENT_TRANSFORMS_SECURITY_COOKIE_CHECK_HOOK_TRANSFORM_H_ |
| 23 |
| 24 #include "base/logging.h" |
| 25 #include "syzygy/block_graph/basic_block_assembler.h" |
| 26 #include "syzygy/block_graph/basic_block_subgraph.h" |
| 27 #include "syzygy/block_graph/block_builder.h" |
| 28 #include "syzygy/block_graph/transform_policy.h" |
| 29 #include "syzygy/block_graph/transforms/named_transform.h" |
| 30 |
| 31 namespace instrument { |
| 32 namespace transforms { |
| 33 |
| 34 typedef block_graph::BasicBlockAssembler BasicBlockAssembler; |
| 35 typedef block_graph::BasicBlockSubGraph BasicBlockSubGraph; |
| 36 typedef block_graph::BasicCodeBlock BasicCodeBlock; |
| 37 typedef block_graph::BlockGraph BlockGraph; |
| 38 typedef block_graph::BlockBuilder BlockBuilder; |
| 39 typedef block_graph::TransformPolicyInterface TransformPolicyInterface; |
| 40 |
| 41 class SecurityCookieCheckHookTransform |
| 42 : public block_graph::transforms::NamedBlockGraphTransformImpl< |
| 43 SecurityCookieCheckHookTransform> { |
| 44 public: |
| 45 SecurityCookieCheckHookTransform() {} |
| 46 |
| 47 static const char kTransformName[]; |
| 48 static const char kReportGsFailure[]; |
| 49 static const char kSyzygyReportGsFailure[]; |
| 50 static const uint32_t kInvalidUserAddress; |
| 51 |
| 52 // BlockGraphTransformInterface implementation. |
| 53 bool TransformBlockGraph(const TransformPolicyInterface* policy, |
| 54 BlockGraph* block_graph, |
| 55 BlockGraph::Block* header_block) final; |
| 56 }; |
| 57 |
| 58 } // namespace transforms |
| 59 } // namespace instrument |
| 60 |
| 61 #endif // SYZYGY_INSTRUMENT_TRANSFORMS_SECURITY_COOKIE_CHECK_HOOK_TRANSFORM_H_ |
OLD | NEW |