Status: Accepted
Owner: [email protected]
CC: [email protected]
Labels: Type-Defect Priority-Medium OpSys-Windows
New issue 305 by [email protected]: ASan shouldn't instrument globals
defined in ".CRT*$*" sections
http://code.google.com/p/address-sanitizer/issues/detail?id=305
Example program:
-------------------------
#include <stdio.h>
int met_you = 0;
void call_me_maybe() {
met_you = 1;
}
typedef void (*FPTR)();
#pragma data_seg(".CRT$XIB")
// Put a global callback in the right section
// to be invoked before the CRT initializers.
FPTR run_on_startup = call_me_maybe;
#pragma data_seg()
// Back to normal compilation.
// __xi_a and __xi_z are defined in VC/crt/src/crt0dat.c
// and are located in .CRT$XIA and .CRT$XIZ respectively.
extern "C" FPTR __xi_a, __xi_z;
int main() {
if (!met_you) {
printf("this is crazy\n");
return 1;
}
// Helps debugging.
printf("&run_on_startup = %p, call_me_maybe = %p\n",
&run_on_startup, call_me_maybe);
// Iterate through CRT initializers.
for (FPTR* it = &__xi_a; it < &__xi_z; ++it)
printf(".CRT$XI*: %p => %p\n", it, *it);
}
-------------------------
Background:
.CRT$XIA...XIZ sections are arrays of callbacks to be invoked at CRT
initialization time in a for loop (unless an entry is zero). One can add
an extra initialization callback simply by defining a global function
pointer in the appropriate section.
The problem is that ASan happily adds redzones after these globals, thus
breaks typical traversal of the list of callbacks. We should probably just
disable adding redzones for globals in ".CRT*$*" sections.
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
You received this message because you are subscribed to the Google Groups
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.