Workaround dawn_wire_server_and_frontend_fuzzer ASAN false positive
When discovering Vulkan adapters, if none is found, the vulkan loader DLL is loaded and then unloaded, which results in ASAN false positives when the loader's previously allocated memory is re-used, which happens in fuzzer::TracePC::ClearInlineCounters. Bug: chromium:1427723 Bug: chromium:1038952 Change-Id: Idb205607426a0af22daba363e2679afaa33204b9 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/127840 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
b8a3bac98b
commit
bacf44f964
|
@ -19,6 +19,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "dawn/common/Assert.h"
|
#include "dawn/common/Assert.h"
|
||||||
|
#include "dawn/common/DynamicLib.h"
|
||||||
#include "dawn/common/Log.h"
|
#include "dawn/common/Log.h"
|
||||||
#include "dawn/common/SystemUtils.h"
|
#include "dawn/common/SystemUtils.h"
|
||||||
#include "dawn/dawn_proc.h"
|
#include "dawn/dawn_proc.h"
|
||||||
|
@ -49,6 +50,9 @@ class DevNull : public dawn::wire::CommandSerializer {
|
||||||
|
|
||||||
std::unique_ptr<dawn::native::Instance> sInstance;
|
std::unique_ptr<dawn::native::Instance> sInstance;
|
||||||
static bool (*sAdapterSupported)(const dawn::native::Adapter&) = nullptr;
|
static bool (*sAdapterSupported)(const dawn::native::Adapter&) = nullptr;
|
||||||
|
#if DAWN_PLATFORM_IS(WINDOWS) && defined(ADDRESS_SANITIZER)
|
||||||
|
static DynamicLib sVulkanLoader;
|
||||||
|
#endif
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -57,6 +61,15 @@ int DawnWireServerFuzzer::Initialize(int* argc, char*** argv) {
|
||||||
// Swiftshader crashes libFuzzer. When this is fixed, move this into Run so that error injection
|
// Swiftshader crashes libFuzzer. When this is fixed, move this into Run so that error injection
|
||||||
// for adapter discovery can be fuzzed.
|
// for adapter discovery can be fuzzed.
|
||||||
sInstance = std::make_unique<dawn::native::Instance>();
|
sInstance = std::make_unique<dawn::native::Instance>();
|
||||||
|
|
||||||
|
// TODO(crbug.com/1038952): Although we keep a static instance, when discovering default Vulkan
|
||||||
|
// adapters, if no adapter is found, the vulkan loader DLL will be loaded and then unloaded,
|
||||||
|
// resulting in ASAN false positives. We work around this by explicitly loading the loader
|
||||||
|
// without unloading it here.
|
||||||
|
#if DAWN_PLATFORM_IS(WINDOWS) && defined(ADDRESS_SANITIZER)
|
||||||
|
sVulkanLoader.Open(GetExecutableDirectory().value_or("") + "vulkan-1.dll");
|
||||||
|
#endif
|
||||||
|
|
||||||
sInstance->DiscoverDefaultAdapters();
|
sInstance->DiscoverDefaultAdapters();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue