diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 04:55:09 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-07-07 04:55:09 +0000 |
commit | a2052f0c207888a0b69a100542071aacece4d2af (patch) | |
tree | 3243e58e56d3a8dee60c582a2c917d18edc9bd5a /third_party | |
parent | a74c14e5721cfd85dd0d0ebc3789ac0657564b7b (diff) | |
parent | ba37c2e361c2ba91bacc47fcae5383c52e50f6be (diff) | |
download | jazzer-api-a2052f0c207888a0b69a100542071aacece4d2af.tar.gz |
Snap for 10453563 from ba37c2e361c2ba91bacc47fcae5383c52e50f6be to mainline-mediaprovider-releaseaml_mpr_341713020aml_mpr_341614010aml_mpr_341511070aml_mpr_341411070aml_mpr_341313030aml_mpr_341111030aml_mpr_341111020aml_mpr_341015090aml_mpr_341015030aml_mpr_340919000android14-mainline-mediaprovider-release
Change-Id: Ib1d6334af6df682c6fc3a4ff97050396a45ddffb
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/BUILD.bazel | 2 | ||||
-rw-r--r-- | third_party/asm.BUILD | 32 | ||||
-rw-r--r-- | third_party/jacoco-make-probe-inserter-subclassable.patch | 71 | ||||
-rw-r--r-- | third_party/jacoco_internal.BUILD | 31 | ||||
-rw-r--r-- | third_party/jacoco_internal.jarjar | 1 | ||||
-rw-r--r-- | third_party/libFuzzer.BUILD | 29 | ||||
-rw-r--r-- | third_party/libjpeg_turbo.BUILD | 11 |
7 files changed, 110 insertions, 67 deletions
diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel index 0643e4f6..a234e836 100644 --- a/third_party/BUILD.bazel +++ b/third_party/BUILD.bazel @@ -12,3 +12,5 @@ config_setting( }, visibility = ["//visibility:public"], ) + +exports_files(["jacoco_internal.jarjar"]) diff --git a/third_party/asm.BUILD b/third_party/asm.BUILD deleted file mode 100644 index 2f659fc6..00000000 --- a/third_party/asm.BUILD +++ /dev/null @@ -1,32 +0,0 @@ -java_library( - name = "asm", - srcs = glob(["asm/src/main/**/*.java"]), - visibility = ["//visibility:public"], -) - -java_library( - name = "asm_commons", - srcs = glob(["asm-commons/src/main/**/*.java"]), - deps = [ - ":asm", - ":asm_analysis", - ":asm_tree", - ], - visibility = ["//visibility:public"], -) - -java_library( - name = "asm_tree", - srcs = glob(["asm-tree/src/main/**/*.java"]), - deps = [":asm"], - visibility = ["//visibility:public"], -) - -java_library( - name = "asm_analysis", - srcs = glob(["asm-analysis/src/main/**/*.java"]), - deps = [ - ":asm", - ":asm_tree", - ], -) diff --git a/third_party/jacoco-make-probe-inserter-subclassable.patch b/third_party/jacoco-make-probe-inserter-subclassable.patch index 3885fa1f..03cfe5e6 100644 --- a/third_party/jacoco-make-probe-inserter-subclassable.patch +++ b/third_party/jacoco-make-probe-inserter-subclassable.patch @@ -63,21 +63,8 @@ index 00000000..19c2a7e2 + ProbeInserter makeProbeInserter(int access, String name, String desc, + MethodVisitor mv, IProbeArrayStrategy arrayStrategy); +} -diff --git org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java -index 71808ac8..3df93f63 100644 ---- org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java -+++ org.jacoco.core/src/org/jacoco/core/internal/instr/InstrSupport.java -@@ -78,7 +78,7 @@ public final class InstrSupport { - * Data type of the field that stores coverage information for a class ( - * <code>boolean[]</code>). - */ -- public static final String DATAFIELD_DESC = "[Z"; -+ public static final String DATAFIELD_DESC = "java/nio/ByteBuffer"; - - // === Init Method === - diff --git org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java -index 0f5b99ff..ba5daa6d 100644 +index 0f5b99ff..80965dfe 100644 --- org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java +++ org.jacoco.core/src/org/jacoco/core/internal/instr/ProbeInserter.java @@ -25,7 +25,7 @@ import org.objectweb.asm.TypePath; @@ -96,8 +83,8 @@ index 0f5b99ff..ba5daa6d 100644 - private final int variable; + protected final int variable; - /** Maximum stack usage of the code to access the probe array. */ - private int accessorStackSize; + /** Label for the new beginning of the method */ + private final Label beginLabel; @@ -56,7 +56,7 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter { * callback to create the code that retrieves the reference to * the probe array @@ -107,3 +94,55 @@ index 0f5b99ff..ba5daa6d 100644 final MethodVisitor mv, final IProbeArrayStrategy arrayStrategy) { super(InstrSupport.ASM_API_VERSION, mv); this.clinit = InstrSupport.CLINIT_NAME.equals(name); +@@ -91,6 +91,10 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter { + mv.visitInsn(Opcodes.BASTORE); + } + ++ protected Object getLocalVariableType() { ++ return InstrSupport.DATAFIELD_DESC; ++ } ++ + @Override + public void visitCode() { + mv.visitLabel(beginLabel); +@@ -118,6 +122,10 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter { + public AnnotationVisitor visitLocalVariableAnnotation(final int typeRef, + final TypePath typePath, final Label[] start, final Label[] end, + final int[] index, final String descriptor, final boolean visible) { ++ if (getLocalVariableType() == null) { ++ return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, descriptor, visible); ++ } ++ + final int[] newIndex = new int[index.length]; + for (int i = 0; i < newIndex.length; i++) { + newIndex[i] = map(index[i]); +@@ -137,6 +145,9 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter { + } + + private int map(final int var) { ++ if (getLocalVariableType() == null) { ++ return var; ++ } + if (var < variable) { + return var; + } else { +@@ -153,13 +164,18 @@ class ProbeInserter extends MethodVisitor implements IProbeInserter { + "ClassReader.accept() should be called with EXPAND_FRAMES flag"); + } + ++ if (getLocalVariableType() == null) { ++ mv.visitFrame(type, nLocal, local, nStack, stack); ++ return; ++ } ++ + final Object[] newLocal = new Object[Math.max(nLocal, variable) + 1]; + int idx = 0; // Arrays index for existing locals + int newIdx = 0; // Array index for new locals + int pos = 0; // Current variable position + while (idx < nLocal || pos <= variable) { + if (pos == variable) { +- newLocal[newIdx++] = InstrSupport.DATAFIELD_DESC; ++ newLocal[newIdx++] = getLocalVariableType(); + pos++; + } else { + if (idx < nLocal) { diff --git a/third_party/jacoco_internal.BUILD b/third_party/jacoco_internal.BUILD index 9e6140a7..38ac7f6c 100644 --- a/third_party/jacoco_internal.BUILD +++ b/third_party/jacoco_internal.BUILD @@ -1,18 +1,37 @@ -java_library( +load("@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl", "jar_jar") + +java_import( name = "jacoco_internal", + jars = ["jacoco_internal_shaded.jar"], + deps = [ + "@org_ow2_asm_asm//jar", + "@org_ow2_asm_asm_commons//jar", + "@org_ow2_asm_asm_tree//jar", + ], + visibility = ["//visibility:public"], +) + +jar_jar( + name = "jacoco_internal_shaded", + input_jar = "libjacoco_internal_unshaded.jar", + rules = "@jazzer//third_party:jacoco_internal.jarjar", +) + +java_library( + name = "jacoco_internal_unshaded", srcs = glob([ "org.jacoco.core/src/org/jacoco/core/**/*.java", ]), resources = glob([ - "org.jacoco.core/src/org/jacoco/core/internal/flow/java_no_throw_methods_list.dat", + "org.jacoco.core/src/org/jacoco/core/**/*.properties", ]), javacopts = [ "-Xep:EqualsHashCode:OFF", + "-Xep:ReturnValueIgnored:OFF", ], deps = [ - "@jazzer_ow2_asm//:asm", - "@jazzer_ow2_asm//:asm_commons", - "@jazzer_ow2_asm//:asm_tree", + "@org_ow2_asm_asm//jar", + "@org_ow2_asm_asm_commons//jar", + "@org_ow2_asm_asm_tree//jar", ], - visibility = ["//visibility:public"], ) diff --git a/third_party/jacoco_internal.jarjar b/third_party/jacoco_internal.jarjar new file mode 100644 index 00000000..04aa333c --- /dev/null +++ b/third_party/jacoco_internal.jarjar @@ -0,0 +1 @@ +rule org.jacoco.** com.code_intelligence.jazzer.third_party.@0 diff --git a/third_party/libFuzzer.BUILD b/third_party/libFuzzer.BUILD index e8559936..bf902f21 100644 --- a/third_party/libFuzzer.BUILD +++ b/third_party/libFuzzer.BUILD @@ -1,24 +1,35 @@ -# Based on https://github.com/llvm/llvm-project/blob/llvmorg-11.1.0/compiler-rt/lib/fuzzer/build.sh cc_library( - name = "libFuzzer", + name = "libfuzzer_no_main", srcs = glob([ "*.cpp", - ]), + ], exclude = ["FuzzerMain.cpp"]), hdrs = glob([ "*.h", "*.def", ]), - copts = select({ + copts = [ + # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L294-L309 + "-fno-builtin", + "-fno-exceptions", + "-funwind-tables", + "-fno-stack-protector", + "-fno-sanitize=safe-stack", + "-fvisibility=hidden", + "-fno-lto", + ] + select({ "@platforms//os:windows": [ - "/Ox", # Optimize for speed. - "/Oy-", # Do not omit frame pointer. + # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L362-L363 + "/Oy-", + "/GS-", "/std:c++17", ], "//conditions:default": [ - "-g", - "-O2", + # https://github.com/llvm/llvm-project/commit/29d3ba7576b30a37bd19a5d40f304fc39c6ab13d "-fno-omit-frame-pointer", - "-std=c++11", + # https://github.com/llvm/llvm-project/blob/eab395fa4074a5a0cbfebe811937dbb1816df9ef/compiler-rt/CMakeLists.txt#L392 + "-O3", + # Use the same C++ standard as Jazzer itself. + "-std=c++17", ], }), alwayslink = True, diff --git a/third_party/libjpeg_turbo.BUILD b/third_party/libjpeg_turbo.BUILD index 4621f862..e140bc07 100644 --- a/third_party/libjpeg_turbo.BUILD +++ b/third_party/libjpeg_turbo.BUILD @@ -23,13 +23,16 @@ cc_import( cmake( name = "libjpeg_turbo", cache_entries = { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_C_COMPILER": "clang", - "CMAKE_C_FLAGS": "-fsanitize=address,fuzzer-no-link", - "CMAKE_SHARED_LINKER_FLAGS": "-fsanitize=address,fuzzer-no-link", "WITH_JAVA": "1", }, + copts = [ + "-fsanitize=address,fuzzer-no-link", + "-fPIC", + ], lib_source = ":all_files", + linkopts = [ + "-fsanitize=address,fuzzer-no-link", + ], out_shared_libs = [ "libjpeg.so", "libturbojpeg.so", |