Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: syzygy/agent/asan/memory_interceptors_impl_x64.cc

Issue 2316303008: Add probes for x64. (Closed)
Patch Set: Add missing "namespace" keyword. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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
Sébastien Marchand 2016/09/12 20:12:22 Please add a global comment describing the content
15 #include "syzygy/agent/asan/error_info.h"
16 #include "syzygy/agent/asan/rtl_utils.h"
17 #include "syzygy/agent/asan/runtime.h"
18 #include "syzygy/agent/asan/shadow.h"
19
20 template<size_t access_size, size_t heap_size,
21 agent::asan::AccessMode access_mode>
22 void asan_check(const void* addr) {
23 using namespace agent::asan;
24 if (reinterpret_cast<uintptr_t>(addr) >= heap_size ||
25 !AsanRuntime::runtime()->shadow()->IsRangeAccessible(addr, access_size)) {
26 CONTEXT ctx;
Sébastien Marchand 2016/09/12 20:12:22 Add " = {}" to initialize this variable.
27 ::RtlCaptureContext(&ctx);
28 AsanContext asan_ctx;
Sébastien Marchand 2016/09/12 20:12:22 Ditto.
29 ContextToAsanContext(ctx, &asan_ctx);
30 ReportBadMemoryAccess(addr, access_mode, access_size, asan_ctx);
31 }
32 }
33
34
Sébastien Marchand 2016/09/12 20:12:22 There's an extra BL
35 #define EXPORT_INTERCEPTOR_READ(access_size, suffix, heap_size) \
36 void asan_check_##access_size##_byte_read_access_no_flags_##suffix( \
Sébastien Marchand 2016/09/12 20:12:22 Can you add a comment describing the different var
37 const void* addr) { \
38 return asan_check<access_size, heap_size, \
39 agent::asan::ASAN_READ_ACCESS>(addr); \
40 } \
41 void asan_check_##access_size##_byte_read_access_##suffix(const void* addr) { \
42 return asan_check<access_size, heap_size, \
43 agent::asan::ASAN_READ_ACCESS>(addr); \
44 }
45
46 #define EXPORT_INTERCEPTOR_WRITE(access_size, suffix, heap_size) \
47 void asan_check_##access_size##_byte_write_access_no_flags_##suffix( \
48 const void* addr) { \
49 return asan_check<access_size, heap_size, \
50 agent::asan::ASAN_WRITE_ACCESS>(addr); \
51 } \
52 void asan_check_##access_size##_byte_write_access_##suffix(const void* addr) { \
53 return asan_check<access_size, heap_size, \
54 agent::asan::ASAN_WRITE_ACCESS>(addr); \
55 }
56
57 #define EXPORT_INTERCEPTOR(access_size, suffix, heap_size) \
58 EXPORT_INTERCEPTOR_READ(access_size, suffix, heap_size) \
59 EXPORT_INTERCEPTOR_WRITE(access_size, suffix, heap_size)
60
61 #define EXPORT_INTERCEPTORS_ALL_SIZES(suffix, heap_size) \
62 EXPORT_INTERCEPTOR(1, suffix, heap_size) \
63 EXPORT_INTERCEPTOR(2, suffix, heap_size) \
64 EXPORT_INTERCEPTOR(4, suffix, heap_size) \
65 EXPORT_INTERCEPTOR(8, suffix, heap_size) \
66 EXPORT_INTERCEPTOR(10, suffix, heap_size) \
67 EXPORT_INTERCEPTOR(16, suffix, heap_size) \
68 EXPORT_INTERCEPTOR(32, suffix, heap_size)
69
70 extern "C" {
71 void asan_no_check() { return; }
72 void asan_string_no_check() { return; }
73 void* asan_shadow_references[] = { nullptr };
74 EXPORT_INTERCEPTORS_ALL_SIZES(8tb, static_cast<size_t>(8) << 40)
75 EXPORT_INTERCEPTORS_ALL_SIZES(128tb, static_cast<size_t>(128) << 40)
76 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698