From b0af95200a37d76eccf285dcb45b4ed6162212d0 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 12 Apr 2021 18:37:48 -0700 Subject: Fuzzer: Distinguish traps from host limitations (#3801) Host limitations are arbitrary and can be modified by optimizations, so ignore them. For example, if the optimizer removes allocations then a host limit on an allocation error may vanish. Or, an optimization that removes recursion and replaces it with a loop may avoid a host limit on call depth (that is not done currently, but might some day). This removes a class of annoying false positives in the fuzzer. --- src/tools/execution-results.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/tools/execution-results.h') diff --git a/src/tools/execution-results.h b/src/tools/execution-results.h index a183ad93b..50f627baf 100644 --- a/src/tools/execution-results.h +++ b/src/tools/execution-results.h @@ -90,6 +90,9 @@ struct ExecutionResults { std::map results; Loggings loggings; + // If set, we should ignore this and not compare it to anything. + bool ignore = false; + // get results of execution void get(Module& wasm) { LoggingExternalInterface interface(loggings); @@ -176,6 +179,10 @@ struct ExecutionResults { } bool operator==(ExecutionResults& other) { + if (ignore || other.ignore) { + std::cout << "ignoring comparison of ExecutionResults!\n"; + return true; + } for (auto& iter : other.results) { auto name = iter.first; if (results.find(name) == results.end()) { @@ -231,6 +238,11 @@ struct ExecutionResults { return instance.callFunction(func->name, arguments); } catch (const TrapException&) { return {}; + } catch (const HostLimitException&) { + // This should be ignored and not compared with, as optimizations can + // change whether a host limit is reached. + ignore = true; + return {}; } } }; -- cgit v1.2.3