From d6aba2fa4e9527af1220f7f0d7fae64462f6e05f Mon Sep 17 00:00:00 2001 From: maflcko <6399679+maflcko@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:00:27 +0200 Subject: [PATCH] openweave: Avoid OOM in make -j (#12174) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Required for the compiler bump in https://github.com/google/oss-fuzz/pull/12077 See https://oss-fuzz-gcb-logs.storage.googleapis.com/log-7213ec9e-cac7-4eec-bd21-472547b52220.txt ``` Step #21 - "compile-libfuzzer-coverage-x86_64": CXXLD TestBinding Step #21 - "compile-libfuzzer-coverage-x86_64": CXXLD TestEventLogging Step #21 - "compile-libfuzzer-coverage-x86_64": CXXLD TestInetLayer Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4371: TestWeaveCert] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** Waiting for unfinished jobs.... Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4188: TestTAKE] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4078: TestInetEndPoint] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4098: TestKeyExport] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4106: TestMsgEnc] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4048: TestECMath] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: unable to execute command: Killed Step #21 - "compile-libfuzzer-coverage-x86_64": clang++: error: linker command failed due to signal (use -v to see invocation) Step #21 - "compile-libfuzzer-coverage-x86_64": make[4]: *** [Makefile:4044: TestECDSA] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": make[3]: *** [Makefile:6509: all-recursive] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": make[2]: *** [Makefile:642: all-recursive] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": make[1]: *** [Makefile:739: all-recursive] Error 1 Step #21 - "compile-libfuzzer-coverage-x86_64": make: *** [Makefile:665: all] Error 2 Step #21 - "compile-libfuzzer-coverage-x86_64": ******************************************************************************** Step #21 - "compile-libfuzzer-coverage-x86_64": Failed to build. Step #21 - "compile-libfuzzer-coverage-x86_64": To reproduce, run: Step #21 - "compile-libfuzzer-coverage-x86_64": python infra/helper.py build_image openweave Step #21 - "compile-libfuzzer-coverage-x86_64": python infra/helper.py build_fuzzers --sanitizer coverage --engine libfuzzer --architecture x86_64 openweave Step #21 - "compile-libfuzzer-coverage-x86_64": ******************************************************************************** Finished Step #21 - "compile-libfuzzer-coverage-x86_64" ERROR ERROR: build step 21 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1 --------- Co-authored-by: MarcoFalke <6399679+MarcoFalke@users.noreply.github.com> Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> --- projects/openweave/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/openweave/build.sh b/projects/openweave/build.sh index 9b366d2ba..551721614 100755 --- a/projects/openweave/build.sh +++ b/projects/openweave/build.sh @@ -45,7 +45,9 @@ sed -i 's/sys\/stat.h>/sys\/stat.h>\n#include /g' ./third_part # OpenSSL now declares RAND_bytes so we must patch find ./src/test-apps/fuzz/ -name "FuzzP*.cpp" -exec sed -i 's/RAND_bytes/RAND_bytes2/g' {} \; -make -j$(nproc) +# Don't use all cores to avoid OOM. +# See https://github.com/google/oss-fuzz/pull/12174 +make -j$(expr $(nproc) / 2) find src/test-apps/fuzz/ -type f -executable -name "Fuzz*" | while read i; do patchelf --set-rpath '$ORIGIN/lib' ${i}