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

Side by Side Diff: Linux_x64/lib/clang/3.5.0/include/sanitizer/msan_interface.h

Issue 228113004: roll llvm-allocated-type 186332:204777. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/llvm-allocated-type/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 //===-- msan_interface.h --------------------------------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file is a part of MemorySanitizer.
11 //
12 // Public interface header.
13 //===----------------------------------------------------------------------===//
14 #ifndef MSAN_INTERFACE_H
15 #define MSAN_INTERFACE_H
16
17 #include <sanitizer/common_interface_defs.h>
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 /* Returns a string describing a stack origin.
23 Return NULL if the origin is invalid, or is not a stack origin. */
24 const char *__msan_get_origin_descr_if_stack(uint32_t id);
25
26 /* Set raw origin for the memory range. */
27 void __msan_set_origin(const volatile void *a, size_t size, uint32_t origin);
28
29 /* Get raw origin for an address. */
30 uint32_t __msan_get_origin(const volatile void *a);
31
32 /* Returns non-zero if tracking origins. */
33 int __msan_get_track_origins();
34
35 /* Returns the origin id of the latest UMR in the calling thread. */
36 uint32_t __msan_get_umr_origin();
37
38 /* Make memory region fully initialized (without changing its contents). */
39 void __msan_unpoison(const volatile void *a, size_t size);
40
41 /* Make a null-terminated string fully initialized (without changing its
42 contents). */
43 void __msan_unpoison_string(const volatile char *a);
44
45 /* Make memory region fully uninitialized (without changing its contents). */
46 void __msan_poison(const volatile void *a, size_t size);
47
48 /* Make memory region partially uninitialized (without changing its contents).
49 */
50 void __msan_partial_poison(const volatile void *data, void *shadow,
51 size_t size);
52
53 /* Returns the offset of the first (at least partially) poisoned byte in the
54 memory range, or -1 if the whole range is good. */
55 intptr_t __msan_test_shadow(const volatile void *x, size_t size);
56
57 /* Set exit code when error(s) were detected.
58 Value of 0 means don't change the program exit code. */
59 void __msan_set_exit_code(int exit_code);
60
61 /* For testing:
62 __msan_set_expect_umr(1);
63 ... some buggy code ...
64 __msan_set_expect_umr(0);
65 The last line will verify that a UMR happened. */
66 void __msan_set_expect_umr(int expect_umr);
67
68 /* Change the value of keep_going flag. Non-zero value means don't terminate
69 program execution when an error is detected. This will not affect error in
70 modules that were compiled without the corresponding compiler flag. */
71 void __msan_set_keep_going(int keep_going);
72
73 /* Print shadow and origin for the memory range to stderr in a human-readable
74 format. */
75 void __msan_print_shadow(const volatile void *x, size_t size);
76
77 /* Print current function arguments shadow and origin to stderr in a
78 human-readable format. */
79 void __msan_print_param_shadow();
80
81 /* Returns true if running under a dynamic tool (DynamoRio-based). */
82 int __msan_has_dynamic_component();
83
84 /* Tell MSan about newly allocated memory (ex.: custom allocator).
85 Memory will be marked uninitialized, with origin at the call site. */
86 void __msan_allocated_memory(const volatile void* data, size_t size);
87
88 /* This function may be optionally provided by user and should return
89 a string containing Msan runtime options. See msan_flags.h for details. */
90 const char* __msan_default_options();
91
92
93 /***********************************/
94 /* Allocator statistics interface. */
95
96 /* Returns the estimated number of bytes that will be reserved by allocator
97 for request of "size" bytes. If Msan allocator can't allocate that much
98 memory, returns the maximal possible allocation size, otherwise returns
99 "size". */
100 size_t __msan_get_estimated_allocated_size(size_t size);
101
102 /* Returns true if p was returned by the Msan allocator and
103 is not yet freed. */
104 int __msan_get_ownership(const volatile void *p);
105
106 /* Returns the number of bytes reserved for the pointer p.
107 Requires (get_ownership(p) == true) or (p == 0). */
108 size_t __msan_get_allocated_size(const volatile void *p);
109
110 /* Number of bytes, allocated and not yet freed by the application. */
111 size_t __msan_get_current_allocated_bytes();
112
113 /* Number of bytes, mmaped by msan allocator to fulfill allocation requests.
114 Generally, for request of X bytes, allocator can reserve and add to free
115 lists a large number of chunks of size X to use them for future requests.
116 All these chunks count toward the heap size. Currently, allocator never
117 releases memory to OS (instead, it just puts freed chunks to free
118 lists). */
119 size_t __msan_get_heap_size();
120
121 /* Number of bytes, mmaped by msan allocator, which can be used to fulfill
122 allocation requests. When a user program frees memory chunk, it can first
123 fall into quarantine and will count toward __msan_get_free_bytes()
124 later. */
125 size_t __msan_get_free_bytes();
126
127 /* Number of bytes in unmapped pages, that are released to OS. Currently,
128 always returns 0. */
129 size_t __msan_get_unmapped_bytes();
130
131 /* Malloc hooks that may be optionally provided by user.
132 __msan_malloc_hook(ptr, size) is called immediately after
133 allocation of "size" bytes, which returned "ptr".
134 __msan_free_hook(ptr) is called immediately before
135 deallocation of "ptr". */
136 void __msan_malloc_hook(const volatile void *ptr, size_t size);
137 void __msan_free_hook(const volatile void *ptr);
138 #ifdef __cplusplus
139 } // extern "C"
140 #endif
141
142 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698