Index: syzygy/instrument/transforms/security_cookie_check_hook_transform.h |
diff --git a/syzygy/instrument/transforms/security_cookie_check_hook_transform.h b/syzygy/instrument/transforms/security_cookie_check_hook_transform.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8db2c1f7efebf1d4a3422eb0c4553c6d6c8beaa3 |
--- /dev/null |
+++ b/syzygy/instrument/transforms/security_cookie_check_hook_transform.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2017 Google Inc. All Rights Reserved. |
+// |
+// Licensed under the Apache License, Version 2.0 (the "License"); |
+// you may not use this file except in compliance with the License. |
+// You may obtain a copy of the License at |
+// |
+// http://www.apache.org/licenses/LICENSE-2.0 |
+// |
+// Unless required by applicable law or agreed to in writing, software |
+// distributed under the License is distributed on an "AS IS" BASIS, |
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+// See the License for the specific language governing permissions and |
+// limitations under the License. |
+// |
+// This transform redirects the '__report_gsfailure' function to |
+// the following assembly stub: 'mov [deadbeef], 0'. |
+// The function __report_gsfailure raises an exception that an EH |
+// cannot intercept (for security reasons); this transform allows |
+// an EH to catch the GS failures. |
+ |
+#ifndef SYZYGY_INSTRUMENT_TRANSFORMS_SECURITY_COOKIE_CHECK_HOOK_TRANSFORM_H_ |
+#define SYZYGY_INSTRUMENT_TRANSFORMS_SECURITY_COOKIE_CHECK_HOOK_TRANSFORM_H_ |
+ |
+#include "base/logging.h" |
+#include "syzygy/block_graph/basic_block_assembler.h" |
+#include "syzygy/block_graph/basic_block_subgraph.h" |
+#include "syzygy/block_graph/block_builder.h" |
+#include "syzygy/block_graph/transform_policy.h" |
+#include "syzygy/block_graph/transforms/named_transform.h" |
+ |
+namespace instrument { |
+namespace transforms { |
+ |
+typedef block_graph::BlockGraph BlockGraph; |
+typedef block_graph::BasicBlockSubGraph BasicBlockSubGraph; |
+typedef block_graph::TransformPolicyInterface TransformPolicyInterface; |
+typedef block_graph::BasicCodeBlock BasicCodeBlock; |
+typedef block_graph::BasicBlockAssembler BasicBlockAssembler; |
+typedef block_graph::BlockBuilder BlockBuilder; |
chrisha
2017/05/09 19:18:40
nit: We have a tendency to keep such typedefs in a
|
+ |
+class SecurityCookieCheckHookTransform : |
+public block_graph::transforms::NamedBlockGraphTransformImpl< |
chrisha
2017/05/09 19:18:40
Bring the : to the next line and indent +4:
class
|
+ SecurityCookieCheckHookTransform> { |
+ |
+public: |
chrisha
2017/05/09 19:18:40
Indent +1
|
+ SecurityCookieCheckHookTransform() { } |
chrisha
2017/05/09 19:18:40
No spaces in curly braces: {}
|
+ |
+ static const char kTransformName[]; |
+ |
+ // BlockGraphTransformInterface Implementation |
chrisha
2017/05/09 19:18:40
ubernit: s/Implementation/implementation./
|
+ bool TransformBlockGraph(const TransformPolicyInterface* policy, |
+ BlockGraph* block_graph, |
chrisha
2017/05/09 19:18:40
Align these two lines with 'const'.
|
+ BlockGraph::Block* header_block) final; |
+ |
+}; |
+ |
+} // namespace transforms |
+} // namespace instrument |
+ |
+#endif // SYZYGY_INSTRUMENT_TRANSFORMS_SECURITY_COOKIE_CHECK_HOOK_TRANSFORM_H_ |