[msan] Handle dlopen() failure in dlopen interceptor.
llvm-svn: 177728
This commit is contained in:
parent
be0d173099
commit
ecbf64648f
|
@ -807,7 +807,7 @@ INTERCEPTOR(void *, dlopen, const char *filename, int flag) {
|
||||||
EnterLoader();
|
EnterLoader();
|
||||||
link_map *map = (link_map *)REAL(dlopen)(filename, flag);
|
link_map *map = (link_map *)REAL(dlopen)(filename, flag);
|
||||||
ExitLoader();
|
ExitLoader();
|
||||||
if (!__msan_has_dynamic_component()) {
|
if (!__msan_has_dynamic_component() && map) {
|
||||||
// If msandr didn't clear the shadow before the initializers ran, we do it
|
// If msandr didn't clear the shadow before the initializers ran, we do it
|
||||||
// ourselves afterwards.
|
// ourselves afterwards.
|
||||||
UnpoisonMappedDSO(map);
|
UnpoisonMappedDSO(map);
|
||||||
|
|
|
@ -1397,6 +1397,13 @@ TEST(MemorySanitizer, dlopen) {
|
||||||
|
|
||||||
delete[] path;
|
delete[] path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Regression test for a crash in dlopen() interceptor.
|
||||||
|
TEST(MemorySanitizer, dlopenFailed) {
|
||||||
|
const char *path = "/libmsan_loadable_does_not_exist.x86_64.so";
|
||||||
|
void *lib = dlopen(path, RTLD_LAZY);
|
||||||
|
ASSERT_EQ(0, lib);
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST(MemorySanitizer, scanf) {
|
TEST(MemorySanitizer, scanf) {
|
||||||
|
|
Loading…
Reference in New Issue