2019-07-15 18:34:09 +02:00
|
|
|
// Copyright 2016 Google Inc. All rights reserved.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package cc
|
|
|
|
|
|
|
|
import (
|
2019-08-29 01:04:36 +02:00
|
|
|
"path/filepath"
|
2019-10-18 04:20:41 +02:00
|
|
|
"sort"
|
2019-09-27 23:00:06 +02:00
|
|
|
"strings"
|
2019-08-29 01:04:36 +02:00
|
|
|
|
2021-02-09 13:30:33 +01:00
|
|
|
"github.com/google/blueprint/proptools"
|
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
"android/soong/android"
|
|
|
|
"android/soong/cc/config"
|
2021-07-22 21:05:08 +02:00
|
|
|
"android/soong/fuzz"
|
2019-07-15 18:34:09 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2022-06-07 22:12:06 +02:00
|
|
|
android.RegisterModuleType("cc_fuzz", LibFuzzFactory)
|
2023-05-16 02:58:37 +02:00
|
|
|
android.RegisterParallelSingletonType("cc_fuzz_packaging", fuzzPackagingFactory)
|
2023-07-07 20:11:51 +02:00
|
|
|
android.RegisterParallelSingletonType("cc_fuzz_presubmit_packaging", fuzzPackagingFactoryPresubmit)
|
2022-06-07 22:12:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type FuzzProperties struct {
|
2022-07-22 19:22:02 +02:00
|
|
|
FuzzFramework fuzz.Framework `blueprint:"mutated"`
|
2022-06-07 22:12:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type fuzzer struct {
|
|
|
|
Properties FuzzProperties
|
|
|
|
}
|
|
|
|
|
|
|
|
func (fuzzer *fuzzer) flags(ctx ModuleContext, flags Flags) Flags {
|
2022-07-22 19:22:02 +02:00
|
|
|
if fuzzer.Properties.FuzzFramework == fuzz.AFL {
|
|
|
|
flags.Local.CFlags = append(flags.Local.CFlags, []string{
|
|
|
|
"-fsanitize-coverage=trace-pc-guard",
|
|
|
|
"-Wno-unused-result",
|
|
|
|
"-Wno-unused-parameter",
|
|
|
|
"-Wno-unused-function",
|
|
|
|
}...)
|
2022-06-07 22:12:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return flags
|
|
|
|
}
|
|
|
|
|
|
|
|
func (fuzzer *fuzzer) props() []interface{} {
|
|
|
|
return []interface{}{&fuzzer.Properties}
|
|
|
|
}
|
|
|
|
|
|
|
|
func fuzzMutatorDeps(mctx android.TopDownMutatorContext) {
|
|
|
|
currentModule, ok := mctx.Module().(*Module)
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-07-22 19:22:02 +02:00
|
|
|
if currentModule.fuzzer == nil {
|
2022-06-07 22:12:06 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
mctx.WalkDeps(func(child android.Module, parent android.Module) bool {
|
|
|
|
c, ok := child.(*Module)
|
|
|
|
if !ok {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.sanitize == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
isFuzzerPointer := c.sanitize.getSanitizerBoolPtr(Fuzzer)
|
|
|
|
if isFuzzerPointer == nil || !*isFuzzerPointer {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.fuzzer == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-07-22 19:22:02 +02:00
|
|
|
c.fuzzer.Properties.FuzzFramework = currentModule.fuzzer.Properties.FuzzFramework
|
2022-06-07 22:12:06 +02:00
|
|
|
return true
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
// cc_fuzz creates a host/device fuzzer binary. Host binaries can be found at
|
|
|
|
// $ANDROID_HOST_OUT/fuzz/, and device binaries can be found at /data/fuzz on
|
|
|
|
// your device, or $ANDROID_PRODUCT_OUT/data/fuzz in your build tree.
|
2022-06-07 22:12:06 +02:00
|
|
|
func LibFuzzFactory() android.Module {
|
2022-07-22 19:22:02 +02:00
|
|
|
module := NewFuzzer(android.HostAndDeviceSupported)
|
2023-11-17 16:27:06 +01:00
|
|
|
module.testModule = true
|
2022-06-07 22:12:06 +02:00
|
|
|
return module.Init()
|
2019-07-15 18:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type fuzzBinary struct {
|
|
|
|
*binaryDecorator
|
|
|
|
*baseCompiler
|
2022-06-07 22:12:06 +02:00
|
|
|
fuzzPackagedModule fuzz.FuzzPackagedModule
|
2021-07-07 23:00:07 +02:00
|
|
|
installedSharedDeps []string
|
2023-04-06 00:08:46 +02:00
|
|
|
sharedLibraries android.RuleBuilderInstalls
|
2023-11-15 21:39:40 +01:00
|
|
|
data []android.DataPath
|
2019-07-15 18:34:09 +02:00
|
|
|
}
|
|
|
|
|
2021-11-01 20:32:43 +01:00
|
|
|
func (fuzz *fuzzBinary) fuzzBinary() bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
func (fuzz *fuzzBinary) linkerProps() []interface{} {
|
|
|
|
props := fuzz.binaryDecorator.linkerProps()
|
2021-07-07 23:00:07 +02:00
|
|
|
props = append(props, &fuzz.fuzzPackagedModule.FuzzProperties)
|
2022-07-22 19:22:02 +02:00
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
return props
|
|
|
|
}
|
|
|
|
|
|
|
|
func (fuzz *fuzzBinary) linkerInit(ctx BaseModuleContext) {
|
|
|
|
fuzz.binaryDecorator.linkerInit(ctx)
|
|
|
|
}
|
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
func (fuzzBin *fuzzBinary) linkerDeps(ctx DepsContext, deps Deps) Deps {
|
2022-07-22 19:22:02 +02:00
|
|
|
if ctx.Config().Getenv("FUZZ_FRAMEWORK") == "AFL" {
|
2022-06-07 22:12:06 +02:00
|
|
|
deps.HeaderLibs = append(deps.HeaderLibs, "libafl_headers")
|
|
|
|
} else {
|
2024-05-07 07:47:35 +02:00
|
|
|
deps.StaticLibs = append(deps.StaticLibs, config.LibFuzzerRuntimeLibrary())
|
2022-10-21 18:34:21 +02:00
|
|
|
// Fuzzers built with HWASAN should use the interceptors for better
|
|
|
|
// mutation based on signals in strcmp, memcpy, etc. This is only needed for
|
|
|
|
// fuzz targets, not generic HWASAN-ified binaries or libraries.
|
|
|
|
if module, ok := ctx.Module().(*Module); ok {
|
|
|
|
if module.IsSanitizerEnabled(Hwasan) {
|
2024-05-07 07:47:35 +02:00
|
|
|
deps.StaticLibs = append(deps.StaticLibs, config.LibFuzzerRuntimeInterceptors())
|
2022-10-21 18:34:21 +02:00
|
|
|
}
|
|
|
|
}
|
2022-06-07 22:12:06 +02:00
|
|
|
}
|
2022-07-22 19:22:02 +02:00
|
|
|
|
|
|
|
deps = fuzzBin.binaryDecorator.linkerDeps(ctx, deps)
|
|
|
|
return deps
|
2019-07-15 18:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (fuzz *fuzzBinary) linkerFlags(ctx ModuleContext, flags Flags) Flags {
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
subdir := "lib"
|
|
|
|
if ctx.inVendor() {
|
|
|
|
subdir = "lib/vendor"
|
|
|
|
}
|
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
flags = fuzz.binaryDecorator.linkerFlags(ctx, flags)
|
2019-11-14 23:50:47 +01:00
|
|
|
// RunPaths on devices isn't instantiated by the base linker. `../lib` for
|
|
|
|
// installed fuzz targets (both host and device), and `./lib` for fuzz
|
|
|
|
// target packages.
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
flags.Local.LdFlags = append(flags.Local.LdFlags, `-Wl,-rpath,\$$ORIGIN/`+subdir)
|
2022-06-07 22:12:06 +02:00
|
|
|
|
2022-10-25 19:58:59 +02:00
|
|
|
// When running on device, fuzz targets with vendor: true set will be in
|
|
|
|
// fuzzer_name/vendor/fuzzer_name (note the extra 'vendor' and thus need to
|
|
|
|
// link with libraries in ../../lib/. Non-vendor binaries only need to look
|
|
|
|
// one level up, in ../lib/.
|
|
|
|
if ctx.inVendor() {
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
flags.Local.LdFlags = append(flags.Local.LdFlags, `-Wl,-rpath,\$$ORIGIN/../../`+subdir)
|
2022-10-25 19:58:59 +02:00
|
|
|
} else {
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
flags.Local.LdFlags = append(flags.Local.LdFlags, `-Wl,-rpath,\$$ORIGIN/../`+subdir)
|
2022-10-25 19:58:59 +02:00
|
|
|
}
|
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
return flags
|
|
|
|
}
|
|
|
|
|
2023-12-19 00:29:41 +01:00
|
|
|
func (fuzz *fuzzBinary) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON) {
|
|
|
|
fuzz.binaryDecorator.moduleInfoJSON(ctx, moduleInfoJSON)
|
|
|
|
moduleInfoJSON.Class = []string{"EXECUTABLES"}
|
|
|
|
}
|
|
|
|
|
2021-10-14 18:22:09 +02:00
|
|
|
// IsValidSharedDependency takes a module and determines if it is a unique shared library
|
2019-10-18 04:20:41 +02:00
|
|
|
// that should be installed in the fuzz target output directories. This function
|
|
|
|
// returns true, unless:
|
2022-08-16 19:27:33 +02:00
|
|
|
// - The module is not an installable shared library, or
|
|
|
|
// - The module is a header or stub, or
|
|
|
|
// - The module is a prebuilt and its source is available, or
|
|
|
|
// - The module is a versioned member of an SDK snapshot.
|
2021-10-14 18:22:09 +02:00
|
|
|
func IsValidSharedDependency(dependency android.Module) bool {
|
2019-10-18 04:20:41 +02:00
|
|
|
// TODO(b/144090547): We should be parsing these modules using
|
|
|
|
// ModuleDependencyTag instead of the current brute-force checking.
|
|
|
|
|
2020-10-24 02:22:06 +02:00
|
|
|
linkable, ok := dependency.(LinkableInterface)
|
|
|
|
if !ok || !linkable.CcLibraryInterface() {
|
|
|
|
// Discard non-linkables.
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if !linkable.Shared() {
|
|
|
|
// Discard static libs.
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
if lib := moduleLibraryInterface(dependency); lib != nil && lib.buildStubs() && linkable.CcLibrary() {
|
2019-11-12 23:03:31 +01:00
|
|
|
// Discard stubs libs (only CCLibrary variants). Prebuilt libraries should not
|
|
|
|
// be excluded on the basis of they're not CCLibrary()'s.
|
2019-10-18 04:20:41 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-11-12 23:03:31 +01:00
|
|
|
// We discarded module stubs libraries above, but the LLNDK prebuilts stubs
|
|
|
|
// libraries must be handled differently - by looking for the stubDecorator.
|
|
|
|
// Discard LLNDK prebuilts stubs as well.
|
|
|
|
if ccLibrary, isCcLibrary := dependency.(*Module); isCcLibrary {
|
|
|
|
if _, isLLndkStubLibrary := ccLibrary.linker.(*stubDecorator); isLLndkStubLibrary {
|
|
|
|
return false
|
|
|
|
}
|
2021-02-09 13:30:33 +01:00
|
|
|
// Discard installable:false libraries because they are expected to be absent
|
|
|
|
// in runtime.
|
2021-10-28 22:25:54 +02:00
|
|
|
if !proptools.BoolDefault(ccLibrary.Installable(), true) {
|
2021-02-09 13:30:33 +01:00
|
|
|
return false
|
|
|
|
}
|
2019-11-12 23:03:31 +01:00
|
|
|
}
|
|
|
|
|
2020-10-06 03:36:43 +02:00
|
|
|
// If the same library is present both as source and a prebuilt we must pick
|
|
|
|
// only one to avoid a conflict. Always prefer the source since the prebuilt
|
|
|
|
// probably won't be built with sanitizers enabled.
|
2021-04-28 11:41:21 +02:00
|
|
|
if prebuilt := android.GetEmbeddedPrebuilt(dependency); prebuilt != nil && prebuilt.SourceExists() {
|
2020-10-06 03:36:43 +02:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2019-10-18 04:20:41 +02:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
func SharedLibraryInstallLocation(
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
libraryBase string, isHost bool, isVendor bool, fuzzDir string, archString string) string {
|
2019-10-18 04:20:41 +02:00
|
|
|
installLocation := "$(PRODUCT_OUT)/data"
|
|
|
|
if isHost {
|
|
|
|
installLocation = "$(HOST_OUT)"
|
|
|
|
}
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
subdir := "lib"
|
|
|
|
if isVendor {
|
|
|
|
subdir = "lib/vendor"
|
|
|
|
}
|
2019-10-18 04:20:41 +02:00
|
|
|
installLocation = filepath.Join(
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
installLocation, fuzzDir, archString, subdir, libraryBase)
|
2019-10-18 04:20:41 +02:00
|
|
|
return installLocation
|
|
|
|
}
|
|
|
|
|
2020-03-06 18:38:12 +01:00
|
|
|
// Get the device-only shared library symbols install directory.
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
func SharedLibrarySymbolsInstallLocation(libraryBase string, isVendor bool, fuzzDir string, archString string) string {
|
|
|
|
subdir := "lib"
|
|
|
|
if isVendor {
|
|
|
|
subdir = "lib/vendor"
|
|
|
|
}
|
|
|
|
return filepath.Join("$(PRODUCT_OUT)/symbols/data/", fuzzDir, archString, subdir, libraryBase)
|
2020-03-06 18:38:12 +01:00
|
|
|
}
|
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
func (fuzzBin *fuzzBinary) install(ctx ModuleContext, file android.Path) {
|
2023-02-06 19:31:02 +01:00
|
|
|
fuzzBin.fuzzPackagedModule = PackageFuzzModule(ctx, fuzzBin.fuzzPackagedModule, pctx)
|
|
|
|
|
2023-11-15 21:39:40 +01:00
|
|
|
installBase := "fuzz"
|
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
// Grab the list of required shared libraries.
|
|
|
|
fuzzBin.sharedLibraries, _ = CollectAllSharedDependencies(ctx)
|
|
|
|
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
// TODO: does not mirror Android linkernamespaces
|
|
|
|
// the logic here has special cases for vendor, but it would need more work to
|
|
|
|
// work in arbitrary partitions, so just surface errors early for a few cases
|
|
|
|
//
|
|
|
|
// Even without these, there are certain situations across linkernamespaces
|
|
|
|
// that this won't support. For instance, you might have:
|
|
|
|
//
|
|
|
|
// my_fuzzer (vendor) -> libbinder_ndk (core) -> libbinder (vendor)
|
|
|
|
//
|
|
|
|
// This dependency chain wouldn't be possible to express in the current
|
|
|
|
// logic because all the deps currently match the variant of the source
|
|
|
|
// module.
|
|
|
|
|
2023-04-06 00:08:46 +02:00
|
|
|
for _, ruleBuilderInstall := range fuzzBin.sharedLibraries {
|
|
|
|
install := ruleBuilderInstall.To
|
2023-02-06 19:31:02 +01:00
|
|
|
fuzzBin.installedSharedDeps = append(fuzzBin.installedSharedDeps,
|
|
|
|
SharedLibraryInstallLocation(
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
install, ctx.Host(), ctx.inVendor(), installBase, ctx.Arch().ArchType.String()))
|
2023-02-06 19:31:02 +01:00
|
|
|
|
|
|
|
// Also add the dependency on the shared library symbols dir.
|
|
|
|
if !ctx.Host() {
|
|
|
|
fuzzBin.installedSharedDeps = append(fuzzBin.installedSharedDeps,
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
SharedLibrarySymbolsInstallLocation(install, ctx.inVendor(), installBase, ctx.Arch().ArchType.String()))
|
2023-02-06 19:31:02 +01:00
|
|
|
}
|
|
|
|
}
|
2023-11-15 21:39:40 +01:00
|
|
|
|
|
|
|
for _, d := range fuzzBin.fuzzPackagedModule.Corpus {
|
|
|
|
fuzzBin.data = append(fuzzBin.data, android.DataPath{SrcPath: d, RelativeInstallPath: "corpus", WithoutRel: true})
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, d := range fuzzBin.fuzzPackagedModule.Data {
|
|
|
|
fuzzBin.data = append(fuzzBin.data, android.DataPath{SrcPath: d, RelativeInstallPath: "data"})
|
|
|
|
}
|
|
|
|
|
|
|
|
if d := fuzzBin.fuzzPackagedModule.Dictionary; d != nil {
|
|
|
|
fuzzBin.data = append(fuzzBin.data, android.DataPath{SrcPath: d, WithoutRel: true})
|
|
|
|
}
|
|
|
|
|
|
|
|
if d := fuzzBin.fuzzPackagedModule.Config; d != nil {
|
|
|
|
fuzzBin.data = append(fuzzBin.data, android.DataPath{SrcPath: d, WithoutRel: true})
|
|
|
|
}
|
|
|
|
|
|
|
|
fuzzBin.binaryDecorator.baseInstaller.dir = filepath.Join(
|
|
|
|
installBase, ctx.Target().Arch.ArchType.String(), ctx.ModuleName())
|
|
|
|
fuzzBin.binaryDecorator.baseInstaller.dir64 = filepath.Join(
|
|
|
|
installBase, ctx.Target().Arch.ArchType.String(), ctx.ModuleName())
|
|
|
|
fuzzBin.binaryDecorator.baseInstaller.installTestData(ctx, fuzzBin.data)
|
|
|
|
fuzzBin.binaryDecorator.baseInstaller.install(ctx, file)
|
2023-02-06 19:31:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func PackageFuzzModule(ctx android.ModuleContext, fuzzPackagedModule fuzz.FuzzPackagedModule, pctx android.PackageContext) fuzz.FuzzPackagedModule {
|
|
|
|
fuzzPackagedModule.Corpus = android.PathsForModuleSrc(ctx, fuzzPackagedModule.FuzzProperties.Corpus)
|
2019-10-18 00:04:01 +02:00
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
fuzzPackagedModule.Data = android.PathsForModuleSrc(ctx, fuzzPackagedModule.FuzzProperties.Data)
|
2019-11-27 22:45:45 +01:00
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
if fuzzPackagedModule.FuzzProperties.Dictionary != nil {
|
|
|
|
fuzzPackagedModule.Dictionary = android.PathForModuleSrc(ctx, *fuzzPackagedModule.FuzzProperties.Dictionary)
|
|
|
|
if fuzzPackagedModule.Dictionary.Ext() != ".dict" {
|
2019-09-14 02:32:50 +02:00
|
|
|
ctx.PropertyErrorf("dictionary",
|
|
|
|
"Fuzzer dictionary %q does not have '.dict' extension",
|
2023-02-06 19:31:02 +01:00
|
|
|
fuzzPackagedModule.Dictionary.String())
|
2019-09-14 02:32:50 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-22 19:52:01 +02:00
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
if fuzzPackagedModule.FuzzProperties.Fuzz_config != nil {
|
2019-10-30 18:17:04 +01:00
|
|
|
configPath := android.PathForModuleOut(ctx, "config").Join(ctx, "config.json")
|
2023-02-06 19:31:02 +01:00
|
|
|
android.WriteFileRule(ctx, configPath, fuzzPackagedModule.FuzzProperties.Fuzz_config.String())
|
|
|
|
fuzzPackagedModule.Config = configPath
|
2019-10-18 04:20:41 +02:00
|
|
|
}
|
2023-02-06 19:31:02 +01:00
|
|
|
return fuzzPackagedModule
|
2019-07-15 18:34:09 +02:00
|
|
|
}
|
|
|
|
|
2022-07-22 19:22:02 +02:00
|
|
|
func NewFuzzer(hod android.HostOrDeviceSupported) *Module {
|
2023-12-07 22:10:56 +01:00
|
|
|
module, binary := newBinary(hod)
|
2022-06-07 22:12:06 +02:00
|
|
|
baseInstallerPath := "fuzz"
|
2019-07-15 18:34:09 +02:00
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
binary.baseInstaller = NewBaseInstaller(baseInstallerPath, baseInstallerPath, InstallInData)
|
2019-07-15 18:34:09 +02:00
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
fuzzBin := &fuzzBinary{
|
2019-07-15 18:34:09 +02:00
|
|
|
binaryDecorator: binary,
|
|
|
|
baseCompiler: NewBaseCompiler(),
|
|
|
|
}
|
2022-06-07 22:12:06 +02:00
|
|
|
module.compiler = fuzzBin
|
|
|
|
module.linker = fuzzBin
|
|
|
|
module.installer = fuzzBin
|
2019-07-19 01:20:52 +02:00
|
|
|
|
2022-07-22 19:22:02 +02:00
|
|
|
module.fuzzer.Properties.FuzzFramework = fuzz.LibFuzzer
|
|
|
|
|
2019-07-19 01:20:52 +02:00
|
|
|
// The fuzzer runtime is not present for darwin host modules, disable cc_fuzz modules when targeting darwin.
|
|
|
|
android.AddLoadHook(module, func(ctx android.LoadHookContext) {
|
2022-10-03 21:07:37 +02:00
|
|
|
|
|
|
|
extraProps := struct {
|
|
|
|
Sanitize struct {
|
|
|
|
Fuzzer *bool
|
|
|
|
}
|
2019-07-19 01:20:52 +02:00
|
|
|
Target struct {
|
|
|
|
Darwin struct {
|
|
|
|
Enabled *bool
|
|
|
|
}
|
2019-07-24 22:34:19 +02:00
|
|
|
Linux_bionic struct {
|
|
|
|
Enabled *bool
|
|
|
|
}
|
2019-07-19 01:20:52 +02:00
|
|
|
}
|
|
|
|
}{}
|
2022-10-03 21:07:37 +02:00
|
|
|
extraProps.Sanitize.Fuzzer = BoolPtr(true)
|
|
|
|
extraProps.Target.Darwin.Enabled = BoolPtr(false)
|
|
|
|
extraProps.Target.Linux_bionic.Enabled = BoolPtr(false)
|
|
|
|
ctx.AppendProperties(&extraProps)
|
2022-06-07 22:12:06 +02:00
|
|
|
|
2022-07-22 19:22:02 +02:00
|
|
|
targetFramework := fuzz.GetFramework(ctx, fuzz.Cc)
|
|
|
|
if !fuzz.IsValidFrameworkForModule(targetFramework, fuzz.Cc, fuzzBin.fuzzPackagedModule.FuzzProperties.Fuzzing_frameworks) {
|
|
|
|
ctx.Module().Disable()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if targetFramework == fuzz.AFL {
|
|
|
|
fuzzBin.baseCompiler.Properties.Srcs = append(fuzzBin.baseCompiler.Properties.Srcs, ":aflpp_driver", ":afl-compiler-rt")
|
|
|
|
module.fuzzer.Properties.FuzzFramework = fuzz.AFL
|
|
|
|
}
|
|
|
|
})
|
2022-08-08 17:55:12 +02:00
|
|
|
|
2019-07-15 18:34:09 +02:00
|
|
|
return module
|
|
|
|
}
|
2019-09-24 22:03:28 +02:00
|
|
|
|
|
|
|
// Responsible for generating GNU Make rules that package fuzz targets into
|
|
|
|
// their architecture & target/host specific zip file.
|
2023-02-06 19:31:02 +01:00
|
|
|
type ccRustFuzzPackager struct {
|
2021-07-22 21:05:08 +02:00
|
|
|
fuzz.FuzzPackager
|
2023-10-19 02:38:40 +02:00
|
|
|
fuzzPackagingArchModules string
|
|
|
|
fuzzTargetSharedDepsInstallPairs string
|
|
|
|
allFuzzTargetsName string
|
|
|
|
onlyIncludePresubmits bool
|
2019-09-24 22:03:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func fuzzPackagingFactory() android.Singleton {
|
2022-06-07 22:12:06 +02:00
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
fuzzPackager := &ccRustFuzzPackager{
|
2022-06-07 22:12:06 +02:00
|
|
|
fuzzPackagingArchModules: "SOONG_FUZZ_PACKAGING_ARCH_MODULES",
|
|
|
|
fuzzTargetSharedDepsInstallPairs: "FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS",
|
|
|
|
allFuzzTargetsName: "ALL_FUZZ_TARGETS",
|
2023-10-19 02:38:40 +02:00
|
|
|
onlyIncludePresubmits: false,
|
2023-07-07 20:11:51 +02:00
|
|
|
}
|
|
|
|
return fuzzPackager
|
|
|
|
}
|
|
|
|
|
|
|
|
func fuzzPackagingFactoryPresubmit() android.Singleton {
|
|
|
|
|
|
|
|
fuzzPackager := &ccRustFuzzPackager{
|
|
|
|
fuzzPackagingArchModules: "SOONG_PRESUBMIT_FUZZ_PACKAGING_ARCH_MODULES",
|
|
|
|
fuzzTargetSharedDepsInstallPairs: "PRESUBMIT_FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS",
|
|
|
|
allFuzzTargetsName: "ALL_PRESUBMIT_FUZZ_TARGETS",
|
2023-10-19 02:38:40 +02:00
|
|
|
onlyIncludePresubmits: true,
|
2022-06-07 22:12:06 +02:00
|
|
|
}
|
|
|
|
return fuzzPackager
|
2019-10-18 04:20:41 +02:00
|
|
|
}
|
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
func (s *ccRustFuzzPackager) GenerateBuildActions(ctx android.SingletonContext) {
|
2019-09-24 22:03:28 +02:00
|
|
|
// Map between each architecture + host/device combination, and the files that
|
|
|
|
// need to be packaged (in the tuple of {source file, destination folder in
|
|
|
|
// archive}).
|
2021-07-22 21:05:08 +02:00
|
|
|
archDirs := make(map[fuzz.ArchOs][]fuzz.FileToZip)
|
2019-09-24 22:03:28 +02:00
|
|
|
|
2019-10-18 04:20:41 +02:00
|
|
|
// List of individual fuzz targets, so that 'make fuzz' also installs the targets
|
|
|
|
// to the correct output directories as well.
|
2021-07-07 23:00:07 +02:00
|
|
|
s.FuzzTargets = make(map[string]bool)
|
2019-10-18 04:20:41 +02:00
|
|
|
|
2021-10-14 18:22:09 +02:00
|
|
|
// Map tracking whether each shared library has an install rule to avoid duplicate install rules from
|
|
|
|
// multiple fuzzers that depend on the same shared library.
|
|
|
|
sharedLibraryInstalled := make(map[string]bool)
|
|
|
|
|
2019-09-24 22:03:28 +02:00
|
|
|
ctx.VisitAllModules(func(module android.Module) {
|
2023-02-06 19:31:02 +01:00
|
|
|
ccModule, ok := module.(LinkableInterface)
|
|
|
|
if !ok || ccModule.PreventInstall() {
|
2019-09-24 22:03:28 +02:00
|
|
|
return
|
|
|
|
}
|
2021-07-07 23:00:07 +02:00
|
|
|
// Discard non-fuzz targets.
|
2024-04-12 02:43:00 +02:00
|
|
|
if ok := fuzz.IsValid(ctx, ccModule.FuzzModuleStruct()); !ok {
|
2019-09-24 22:03:28 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
sharedLibsInstallDirPrefix := "lib"
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
if ccModule.InVendor() {
|
|
|
|
sharedLibsInstallDirPrefix = "lib/vendor"
|
|
|
|
}
|
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
if !ccModule.IsFuzzModule() {
|
2019-12-05 16:36:11 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-09-24 22:03:28 +02:00
|
|
|
hostOrTargetString := "target"
|
2023-05-17 02:54:27 +02:00
|
|
|
if ccModule.Target().HostCross {
|
|
|
|
hostOrTargetString = "host_cross"
|
|
|
|
} else if ccModule.Host() {
|
2019-09-24 22:03:28 +02:00
|
|
|
hostOrTargetString = "host"
|
|
|
|
}
|
2023-07-07 20:11:51 +02:00
|
|
|
if s.onlyIncludePresubmits == true {
|
|
|
|
hostOrTargetString = "presubmit-" + hostOrTargetString
|
|
|
|
}
|
2019-09-24 22:03:28 +02:00
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
fpm := fuzz.FuzzPackagedModule{}
|
|
|
|
if ok {
|
2023-02-06 19:31:02 +01:00
|
|
|
fpm = ccModule.FuzzPackagedModule()
|
2022-06-07 22:12:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
intermediatePath := "fuzz"
|
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
archString := ccModule.Target().Arch.ArchType.String()
|
2022-06-07 22:12:06 +02:00
|
|
|
archDir := android.PathForIntermediates(ctx, intermediatePath, hostOrTargetString, archString)
|
2021-07-22 21:05:08 +02:00
|
|
|
archOs := fuzz.ArchOs{HostOrTarget: hostOrTargetString, Arch: archString, Dir: archDir.String()}
|
2019-09-24 22:03:28 +02:00
|
|
|
|
2021-07-22 21:05:08 +02:00
|
|
|
var files []fuzz.FileToZip
|
2020-11-17 02:32:30 +01:00
|
|
|
builder := android.NewRuleBuilder(pctx, ctx)
|
2019-11-13 17:36:07 +01:00
|
|
|
|
2021-07-07 23:00:07 +02:00
|
|
|
// Package the corpus, data, dict and config into a zipfile.
|
2022-06-07 22:12:06 +02:00
|
|
|
files = s.PackageArtifacts(ctx, module, fpm, archDir, builder)
|
2019-11-27 22:45:45 +01:00
|
|
|
|
2021-10-14 18:22:09 +02:00
|
|
|
// Package shared libraries
|
2023-02-06 19:31:02 +01:00
|
|
|
files = append(files, GetSharedLibsToZip(ccModule.FuzzSharedLibraries(), ccModule, &s.FuzzPackager, archString, sharedLibsInstallDirPrefix, &sharedLibraryInstalled)...)
|
2019-10-18 04:20:41 +02:00
|
|
|
|
2019-09-24 22:03:28 +02:00
|
|
|
// The executable.
|
2023-05-09 00:09:31 +02:00
|
|
|
files = append(files, fuzz.FileToZip{SourceFilePath: android.OutputFileForModule(ctx, ccModule, "unstripped")})
|
2019-09-24 22:03:28 +02:00
|
|
|
|
2023-07-07 20:11:51 +02:00
|
|
|
if s.onlyIncludePresubmits == true {
|
|
|
|
if fpm.FuzzProperties.Fuzz_config == nil {
|
|
|
|
return
|
|
|
|
}
|
2023-10-19 02:38:40 +02:00
|
|
|
if !BoolDefault(fpm.FuzzProperties.Fuzz_config.Use_for_presubmit, false) {
|
2023-07-07 20:11:51 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
2022-06-07 22:12:06 +02:00
|
|
|
archDirs[archOs], ok = s.BuildZipFile(ctx, module, fpm, files, builder, archDir, archString, hostOrTargetString, archOs, archDirs)
|
2021-07-07 23:00:07 +02:00
|
|
|
if !ok {
|
|
|
|
return
|
2020-02-24 17:26:20 +01:00
|
|
|
}
|
2019-09-24 22:03:28 +02:00
|
|
|
})
|
|
|
|
|
2022-07-22 19:22:02 +02:00
|
|
|
s.CreateFuzzPackage(ctx, archDirs, fuzz.Cc, pctx)
|
2019-09-27 23:00:06 +02:00
|
|
|
}
|
2019-09-24 22:03:28 +02:00
|
|
|
|
2023-02-06 19:31:02 +01:00
|
|
|
func (s *ccRustFuzzPackager) MakeVars(ctx android.MakeVarsContext) {
|
2021-07-07 23:00:07 +02:00
|
|
|
packages := s.Packages.Strings()
|
2019-10-18 04:20:41 +02:00
|
|
|
sort.Strings(packages)
|
2021-10-14 18:22:09 +02:00
|
|
|
sort.Strings(s.FuzzPackager.SharedLibInstallStrings)
|
2019-09-27 23:00:06 +02:00
|
|
|
// TODO(mitchp): Migrate this to use MakeVarsContext::DistForGoal() when it's
|
|
|
|
// ready to handle phony targets created in Soong. In the meantime, this
|
|
|
|
// exports the phony 'fuzz' target and dependencies on packages to
|
|
|
|
// core/main.mk so that we can use dist-for-goals.
|
2022-06-07 22:12:06 +02:00
|
|
|
|
|
|
|
ctx.Strict(s.fuzzPackagingArchModules, strings.Join(packages, " "))
|
|
|
|
|
|
|
|
ctx.Strict(s.fuzzTargetSharedDepsInstallPairs,
|
2021-10-14 18:22:09 +02:00
|
|
|
strings.Join(s.FuzzPackager.SharedLibInstallStrings, " "))
|
2019-10-18 04:20:41 +02:00
|
|
|
|
|
|
|
// Preallocate the slice of fuzz targets to minimise memory allocations.
|
2022-06-07 22:12:06 +02:00
|
|
|
s.PreallocateSlice(ctx, s.allFuzzTargetsName)
|
2019-09-24 22:03:28 +02:00
|
|
|
}
|
2021-10-14 18:22:09 +02:00
|
|
|
|
|
|
|
// GetSharedLibsToZip finds and marks all the transiently-dependent shared libraries for
|
|
|
|
// packaging.
|
2023-04-06 00:08:46 +02:00
|
|
|
func GetSharedLibsToZip(sharedLibraries android.RuleBuilderInstalls, module LinkableInterface, s *fuzz.FuzzPackager, archString string, destinationPathPrefix string, sharedLibraryInstalled *map[string]bool) []fuzz.FileToZip {
|
2021-10-14 18:22:09 +02:00
|
|
|
var files []fuzz.FileToZip
|
|
|
|
|
2022-06-07 22:12:06 +02:00
|
|
|
fuzzDir := "fuzz"
|
|
|
|
|
2023-04-06 00:08:46 +02:00
|
|
|
for _, ruleBuilderInstall := range sharedLibraries {
|
|
|
|
library := ruleBuilderInstall.From
|
|
|
|
install := ruleBuilderInstall.To
|
2023-05-09 00:09:31 +02:00
|
|
|
files = append(files, fuzz.FileToZip{
|
|
|
|
SourceFilePath: library,
|
|
|
|
DestinationPathPrefix: destinationPathPrefix,
|
|
|
|
DestinationPath: install,
|
|
|
|
})
|
2021-10-14 18:22:09 +02:00
|
|
|
|
|
|
|
// For each architecture-specific shared library dependency, we need to
|
|
|
|
// install it to the output directory. Setup the install destination here,
|
|
|
|
// which will be used by $(copy-many-files) in the Make backend.
|
2023-02-06 19:31:02 +01:00
|
|
|
installDestination := SharedLibraryInstallLocation(
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
install, module.Host(), module.InVendor(), fuzzDir, archString)
|
2021-10-14 18:22:09 +02:00
|
|
|
if (*sharedLibraryInstalled)[installDestination] {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
(*sharedLibraryInstalled)[installDestination] = true
|
|
|
|
|
|
|
|
// Escape all the variables, as the install destination here will be called
|
|
|
|
// via. $(eval) in Make.
|
|
|
|
installDestination = strings.ReplaceAll(
|
|
|
|
installDestination, "$", "$$")
|
|
|
|
s.SharedLibInstallStrings = append(s.SharedLibInstallStrings,
|
|
|
|
library.String()+":"+installDestination)
|
|
|
|
|
|
|
|
// Ensure that on device, the library is also reinstalled to the /symbols/
|
|
|
|
// dir. Symbolized DSO's are always installed to the device when fuzzing, but
|
|
|
|
// we want symbolization tools (like `stack`) to be able to find the symbols
|
|
|
|
// in $ANDROID_PRODUCT_OUT/symbols automagically.
|
|
|
|
if !module.Host() {
|
fuzz packaging: implement system/vendor split
This wasn't needed when fuzzers had their own
lib directories, but because the lib directories
were combined, this caused interactions because
system and vendor libraries were mixed in the
same folder, sometimes overriding each other.
Comments are left with some details about
future issues. Bug has a series of recommendations
to prevent issue again.
The main goal of this patch is to get the fuzzers
working, not fix every issue here.
Bug: 307611931
Test: run vendor fuzzer and check lsof:
android.hardwar 22719 root txt REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 4350056 3455 /data/fuzz/x86_64/android.hardware.drm-service.<name>.aidl_fuzzer/vendor/android.hardware.drm-service.<name>.aidl_fuzzer
android.hardwar 22719 root mem REG 254,94 1047232 3464 /data/fuzz/x86_64/lib/vendor/libbase.so
android.hardwar 22719 root mem REG 254,94 4027304 3460 /data/fuzz/x86_64/lib/vendor/libcrypto.so
android.hardwar 22719 root mem REG 254,94 4021632 3467 /data/fuzz/x86_64/lib/vendor/libbinder.so
android.hardwar 22719 root mem REG 254,94 329408 3466 /data/fuzz/x86_64/lib/vendor/libcutils.so
android.hardwar 22719 root mem REG 254,94 508968 3463 /data/fuzz/x86_64/lib/vendor/libutils.so
android.hardwar 22719 root mem REG 254,94 592944 3465 /data/fuzz/x86_64/lib/vendor/libclang_rt.ubsan_standalone-x86_64-android.so
android.hardwar 22719 root mem REG 254,94 2328616 3462 /data/fuzz/x86_64/lib/vendor/libc++.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
and run a system fuzzer
servicemanager_ 27878 root txt REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 609736 67408 /data/fuzz/x86_64/servicemanager_fuzzer/servicemanager_fuzzer
servicemanager_ 27878 root mem REG 254,94 4390560 4074 /data/fuzz/x86_64/lib/libvintf.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 13872 4077 /data/fuzz/x86_64/lib/libvndksupport.so
servicemanager_ 27878 root mem REG 254,94 11584 4086 /data/fuzz/x86_64/lib/libdl.so
Change-Id: I91a51d2f1cb537cfaae8379998078188f2b10a98
2023-12-28 02:09:40 +01:00
|
|
|
symbolsInstallDestination := SharedLibrarySymbolsInstallLocation(install, module.InVendor(), fuzzDir, archString)
|
2021-10-14 18:22:09 +02:00
|
|
|
symbolsInstallDestination = strings.ReplaceAll(symbolsInstallDestination, "$", "$$")
|
|
|
|
s.SharedLibInstallStrings = append(s.SharedLibInstallStrings,
|
|
|
|
library.String()+":"+symbolsInstallDestination)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return files
|
|
|
|
}
|
2022-10-05 01:35:39 +02:00
|
|
|
|
|
|
|
// CollectAllSharedDependencies search over the provided module's dependencies using
|
|
|
|
// VisitDirectDeps and WalkDeps to enumerate all shared library dependencies.
|
|
|
|
// VisitDirectDeps is used first to avoid incorrectly using the core libraries (sanitizer
|
|
|
|
// runtimes, libc, libdl, etc.) from a dependency. This may cause issues when dependencies
|
|
|
|
// have explicit sanitizer tags, as we may get a dependency on an unsanitized libc, etc.
|
2023-04-06 00:08:46 +02:00
|
|
|
func CollectAllSharedDependencies(ctx android.ModuleContext) (android.RuleBuilderInstalls, []android.Module) {
|
2022-10-05 01:35:39 +02:00
|
|
|
seen := make(map[string]bool)
|
|
|
|
recursed := make(map[string]bool)
|
2022-10-20 02:55:58 +02:00
|
|
|
deps := []android.Module{}
|
2022-10-05 01:35:39 +02:00
|
|
|
|
2023-04-06 00:08:46 +02:00
|
|
|
var sharedLibraries android.RuleBuilderInstalls
|
2022-10-05 01:35:39 +02:00
|
|
|
|
|
|
|
// Enumerate the first level of dependencies, as we discard all non-library
|
|
|
|
// modules in the BFS loop below.
|
|
|
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
|
|
|
if !IsValidSharedDependency(dep) {
|
|
|
|
return
|
|
|
|
}
|
2023-12-13 22:47:44 +01:00
|
|
|
sharedLibraryInfo, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, dep, SharedLibraryInfoProvider)
|
|
|
|
if !hasSharedLibraryInfo {
|
2023-04-06 00:08:46 +02:00
|
|
|
return
|
|
|
|
}
|
2022-10-05 01:35:39 +02:00
|
|
|
if seen[ctx.OtherModuleName(dep)] {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
seen[ctx.OtherModuleName(dep)] = true
|
2022-10-20 02:55:58 +02:00
|
|
|
deps = append(deps, dep)
|
2023-04-06 00:08:46 +02:00
|
|
|
|
|
|
|
installDestination := sharedLibraryInfo.SharedLibrary.Base()
|
|
|
|
ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, dep, "unstripped"), installDestination}
|
|
|
|
sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
|
2022-10-05 01:35:39 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
ctx.WalkDeps(func(child, parent android.Module) bool {
|
2023-06-09 20:06:44 +02:00
|
|
|
|
|
|
|
// If this is a Rust module which is not rust_ffi_shared, we still want to bundle any transitive
|
2024-05-14 03:03:34 +02:00
|
|
|
// shared dependencies (even for rust_ffi_rlib or rust_ffi_static)
|
2023-06-09 20:06:44 +02:00
|
|
|
if rustmod, ok := child.(LinkableInterface); ok && rustmod.RustLibraryInterface() && !rustmod.Shared() {
|
|
|
|
if recursed[ctx.OtherModuleName(child)] {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
recursed[ctx.OtherModuleName(child)] = true
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2022-10-05 01:35:39 +02:00
|
|
|
if !IsValidSharedDependency(child) {
|
|
|
|
return false
|
|
|
|
}
|
2023-12-13 22:47:44 +01:00
|
|
|
sharedLibraryInfo, hasSharedLibraryInfo := android.OtherModuleProvider(ctx, child, SharedLibraryInfoProvider)
|
|
|
|
if !hasSharedLibraryInfo {
|
2023-04-06 00:08:46 +02:00
|
|
|
return false
|
|
|
|
}
|
2022-10-05 01:35:39 +02:00
|
|
|
if !seen[ctx.OtherModuleName(child)] {
|
|
|
|
seen[ctx.OtherModuleName(child)] = true
|
2022-10-20 02:55:58 +02:00
|
|
|
deps = append(deps, child)
|
2023-04-06 00:08:46 +02:00
|
|
|
|
|
|
|
installDestination := sharedLibraryInfo.SharedLibrary.Base()
|
|
|
|
ruleBuilderInstall := android.RuleBuilderInstall{android.OutputFileForModule(ctx, child, "unstripped"), installDestination}
|
|
|
|
sharedLibraries = append(sharedLibraries, ruleBuilderInstall)
|
2022-10-05 01:35:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if recursed[ctx.OtherModuleName(child)] {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
recursed[ctx.OtherModuleName(child)] = true
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
2022-10-20 02:55:58 +02:00
|
|
|
return sharedLibraries, deps
|
2022-10-05 01:35:39 +02:00
|
|
|
}
|