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

Unified Diff: runtime/szrt_asan.c

Issue 2108083002: Implemented aligning and poisoning global redzones (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Removed casts Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/IceASanInstrumentation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/szrt_asan.c
diff --git a/runtime/szrt_asan.c b/runtime/szrt_asan.c
index 7a056c459926f7ab78cad50e96b0772591d241df..797f1b99b2a7a03c01085770c6b3b466ad50f9e7 100644
--- a/runtime/szrt_asan.c
+++ b/runtime/szrt_asan.c
@@ -45,14 +45,14 @@
static char *shadow_offset = NULL;
-void __asan_init(void);
+void __asan_init(int, void **, int *);
void __asan_check(char *, int);
void *__asan_malloc(size_t);
void __asan_free(char *);
void __asan_poison(char *, int);
void __asan_unpoison(char *, int);
-void __asan_init(void) {
+void __asan_init(int n_rzs, void **rzs, int *rz_sizes) {
// ensure the redzones are large enough to hold metadata
assert(RZ_SIZE >= sizeof(void *) && RZ_SIZE >= sizeof(size_t));
assert(shadow_offset == NULL);
@@ -71,6 +71,13 @@ void __asan_init(void) {
fprintf(stderr, "could not protect bad region\n");
else
printf("protected bad region\n");
+
+ // poison global redzones
+ printf("poisioning %d global redzones\n", n_rzs);
+ for (int i = 0; i < n_rzs; i++) {
+ printf("(%d) poisoning redzone of size %d at %p\n", i, rz_sizes[i], rzs[i]);
+ __asan_poison(rzs[i], rz_sizes[i]);
+ }
}
void __asan_check(char *ptr, int size) {
« no previous file with comments | « no previous file | src/IceASanInstrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698