diff options
author | Fabian Meumertzheim <meumertzheim@code-intelligence.com> | 2021-05-05 12:09:32 +0200 |
---|---|---|
committer | Fabian Meumertzheim <fabian@meumertzhe.im> | 2021-05-07 16:38:22 +0200 |
commit | f1c4bb507733710bbf292e474e173fcd0d6e8ff5 (patch) | |
tree | 1f4acc7f6380454b3965183e3937ce9a1635753d /driver/jvm_tooling.cpp | |
parent | cca74efb030f4bfe941decd218bdfb489f490523 (diff) | |
download | jazzer-api-f1c4bb507733710bbf292e474e173fcd0d6e8ff5.tar.gz |
Ensure default -Xmx value is below -rss_limit_mb
libFuzzer defaults to an rss_limit_mb of 2048, but we start the JVM with
-Xmx4096m. This can lead to libFuzzer OOM reports when a single
allocation in Java exceeds 2 GB but still fits into the JVM heap.
This is solved by letting the JVM heap size default to slightly less
than 2 GB.
This change is not fully backwards compatible, but will only cause
targets to crash more often than they used to.
Diffstat (limited to 'driver/jvm_tooling.cpp')
-rw-r--r-- | driver/jvm_tooling.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/driver/jvm_tooling.cpp b/driver/jvm_tooling.cpp index 0ee18f48..fee54377 100644 --- a/driver/jvm_tooling.cpp +++ b/driver/jvm_tooling.cpp @@ -153,8 +153,9 @@ JVM::JVM(const std::string &executable_path) { std::vector<JavaVMOption> options; options.push_back( JavaVMOption{.optionString = const_cast<char *>(class_path.c_str())}); - // set the maximum heap size - options.push_back(JavaVMOption{.optionString = (char *)"-Xmx4096m"}); + // Set the maximum heap size to a value that is slightly smaller than + // libFuzzer's default rss_limit_mb. This prevents erroneous oom reports. + options.push_back(JavaVMOption{.optionString = (char *)"-Xmx2040m"}); options.push_back(JavaVMOption{.optionString = (char *)"-enableassertions"}); // Preserve and emit stack trace information even on hot paths. // This may hurt performance, but also helps find flaky bugs. |