Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf54f6b0 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12173239 from de5a8739 to 24Q4-release

Change-Id: I78132a106f84de17d4ef5283795245a5fb8fd9eb
parents 874b7086 de5a8739
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -17,13 +17,6 @@
#ifndef ANDROID_TRACE_H
#define ANDROID_TRACE_H

#if defined(_WIN32)

#define ATRACE_NAME(...)
#define ATRACE_CALL()

#else  // !_WIN32

#include <stdint.h>

#include <cutils/trace.h>
@@ -56,6 +49,4 @@ private:

}  // namespace android

#endif  // _WIN32

#endif // ANDROID_TRACE_H
+0 −53
Original line number Diff line number Diff line
@@ -134,56 +134,3 @@ llndk_libraries_txt {
sanitizer_libraries_txt {
    name: "sanitizer.libraries.txt",
}

EXPORT_GLOBAL_ASAN_OPTIONS = select(soong_config_variable("ANDROID", "ASAN_ENABLED"), {
    true: "export ASAN_OPTIONS include=/system/asan.options",
    default: "",
})

EXPORT_GLOBAL_HWASAN_OPTIONS = select((soong_config_variable("ANDROID", "HWASAN_ENABLED"), soong_config_variable("ANDROID", "HWADDRESS_SANITIZER_GLOBAL_OPTIONS")), {
    (true, ""): "",
    (true, any @ options): "export HWASAN_OPTIONS " + options,
    (default, default): "",
})

EXPORT_GLOBAL_GCOV_OPTIONS = select(soong_config_variable("ANDROID", "GCOV_COVERAGE"), {
    true: "export GCOV_PREFIX /data/misc/trace",
    default: "",
})

EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS = select((soong_config_variable("ANDROID", "CLANG_COVERAGE"), soong_config_variable("ANDROID", "CLANG_COVERAGE_CONTINUOUS_MODE")), {
    (true, true): "export LLVM_PROFILE_FILE /data/misc/trace/clang%c-%20m.profraw",
    (true, default): "export LLVM_PROFILE_FILE /data/misc/trace/clang-%20m.profraw",
    (default, default): "",
})

EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE = select(soong_config_variable("ANDROID", "SCUDO_ALLOCATION_RING_BUFFER_SIZE"), {
    "": "",
    any @ size: "export SCUDO_ALLOCATION_RING_BUFFER_SIZE " + size,
    default: "",
})

genrule {
    name: "init.environ.rc.gen",
    srcs: ["init.environ.rc.in"],
    out: ["init.environ.rc"],
    cmd: "cp -f $(in) $(out) && " +
        "sed -i -e 's?%EXPORT_GLOBAL_ASAN_OPTIONS%?" + EXPORT_GLOBAL_ASAN_OPTIONS + "?g' $(out) && " +
        "sed -i -e 's?%EXPORT_GLOBAL_GCOV_OPTIONS%?" + EXPORT_GLOBAL_GCOV_OPTIONS + "?g' $(out) && " +
        "sed -i -e 's?%EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS%?" + EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS + "?g' $(out) && " +
        "sed -i -e 's?%EXPORT_GLOBAL_HWASAN_OPTIONS%?" + EXPORT_GLOBAL_HWASAN_OPTIONS + "?g' $(out) && " +
        "sed -i -e 's?%EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE%?" + EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE + "?g' $(out)",
}

prebuilt_root {
    name: "init.environ.rc-soong",
    src: ":init.environ.rc.gen",
    filename: "init.environ.rc",
    install_in_root: true,
    no_full_install: true,
    required: select((soong_config_variable("ANDROID", "ASAN_ENABLED"), soong_config_variable("ANDROID", "SANITIZE_TARGET_SYSTEM_ENABLED")), {
        (true, true): ["asan.options", "asan_extract"],
        (true, default): ["asan.options"],
        (default, default): [],
    }),
}
+38 −6
Original line number Diff line number Diff line
@@ -11,7 +11,6 @@ endif
endif
#######################################
# init.environ.rc
# TODO(b/353429422): move LOCAL_POST_INSTALL_CMD to other rules and remove Android.mk module.

include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := ETC
@@ -20,8 +19,36 @@ LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
LOCAL_LICENSE_CONDITIONS := notice
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)

EXPORT_GLOBAL_ASAN_OPTIONS :=
ifneq ($(filter address,$(SANITIZE_TARGET)),)
  LOCAL_REQUIRED_MODULES := asan.options $(ASAN_EXTRACT_FILES)
  EXPORT_GLOBAL_ASAN_OPTIONS := export ASAN_OPTIONS include=/system/asan.options
  LOCAL_REQUIRED_MODULES := asan.options $(ASAN_OPTIONS_FILES) $(ASAN_EXTRACT_FILES)
endif

EXPORT_GLOBAL_HWASAN_OPTIONS :=
ifneq ($(filter hwaddress,$(SANITIZE_TARGET)),)
  ifneq ($(HWADDRESS_SANITIZER_GLOBAL_OPTIONS),)
    EXPORT_GLOBAL_HWASAN_OPTIONS := export HWASAN_OPTIONS $(HWADDRESS_SANITIZER_GLOBAL_OPTIONS)
  endif
endif

EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE :=
ifneq ($(PRODUCT_SCUDO_ALLOCATION_RING_BUFFER_SIZE),)
  EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE := export SCUDO_ALLOCATION_RING_BUFFER_SIZE $(PRODUCT_SCUDO_ALLOCATION_RING_BUFFER_SIZE)
endif

EXPORT_GLOBAL_GCOV_OPTIONS :=
ifeq ($(NATIVE_COVERAGE),true)
  EXPORT_GLOBAL_GCOV_OPTIONS := export GCOV_PREFIX /data/misc/trace
endif

EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS :=
ifeq ($(CLANG_COVERAGE),true)
  ifeq ($(CLANG_COVERAGE_CONTINUOUS_MODE),true)
    EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/misc/trace/clang%c-%20m.profraw
  else
    EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS := export LLVM_PROFILE_FILE /data/misc/trace/clang-%20m.profraw
  endif
endif

# Put it here instead of in init.rc module definition,
@@ -146,10 +173,15 @@ ALL_DEFAULT_INSTALLED_MODULES += $(ALL_ROOTDIR_SYMLINKS)
include $(BUILD_SYSTEM)/base_rules.mk

$(ALL_ROOTDIR_SYMLINKS): $(LOCAL_BUILT_MODULE)

init.environ.rc-soong := $(call intermediates-dir-for,ETC,init.environ.rc-soong)/init.environ.rc-soong
$(eval $(call copy-one-file,$(init.environ.rc-soong),$(LOCAL_BUILT_MODULE)))
init.environ.rc-soong :=
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/init.environ.rc.in
	@echo "Generate: $< -> $@"
	@mkdir -p $(dir $@)
	$(hide) cp $< $@
	$(hide) sed -i -e 's?%EXPORT_GLOBAL_ASAN_OPTIONS%?$(EXPORT_GLOBAL_ASAN_OPTIONS)?g' $@
	$(hide) sed -i -e 's?%EXPORT_GLOBAL_GCOV_OPTIONS%?$(EXPORT_GLOBAL_GCOV_OPTIONS)?g' $@
	$(hide) sed -i -e 's?%EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS%?$(EXPORT_GLOBAL_CLANG_COVERAGE_OPTIONS)?g' $@
	$(hide) sed -i -e 's?%EXPORT_GLOBAL_HWASAN_OPTIONS%?$(EXPORT_GLOBAL_HWASAN_OPTIONS)?g' $@
	$(hide) sed -i -e 's?%EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE%?$(EXPORT_GLOBAL_SCUDO_ALLOCATION_RING_BUFFER_SIZE)?g' $@

#######################################
# ramdisk_node_list
+55 −1
Original line number Diff line number Diff line
@@ -18,12 +18,66 @@
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <getopt.h>

#include "trusty_gatekeeper.h"
#include "trusty_gatekeeper_ipc.h"

using aidl::android::hardware::gatekeeper::TrustyGateKeeperDevice;

int main() {
static const char* _sopts = "hD:";
static const struct option _lopts[] = {
        {"help", no_argument, 0, 'h'},
        {"dev", required_argument, 0, 'D'},
        {0, 0, 0, 0},
};

static const char* usage =
        "Usage: %s [options]\n"
        "\n"
        "options:\n"
        "  -h, --help            prints this message and exit\n"
        "  -D, --dev name        Trusty device name\n"
        "\n";

static const char* usage_long = "\n";

static void print_usage_and_exit(const char* prog, int code, bool verbose) {
    fprintf(stderr, usage, prog);
    if (verbose) {
        fprintf(stderr, "%s", usage_long);
    }
    exit(code);
}

static void parse_options(int argc, char** argv) {
    int c;
    int oidx = 0;

    while (1) {
        c = getopt_long(argc, argv, _sopts, _lopts, &oidx);
        if (c == -1) {
            break; /* done */
        }

        switch (c) {
            case 'D':
                trusty_gatekeeper_set_dev_name(optarg);
                break;

            case 'h':
                print_usage_and_exit(argv[0], EXIT_SUCCESS, true);
                break;

            default:
                print_usage_and_exit(argv[0], EXIT_FAILURE, false);
        }
    }
}

int main(int argc, char** argv) {
    parse_options(argc, argv);

    ABinderProcess_setThreadPoolMaxThreadCount(0);

    std::shared_ptr<TrustyGateKeeperDevice> gatekeeper =
+6 −3
Original line number Diff line number Diff line
@@ -28,12 +28,15 @@
#include "trusty_gatekeeper_ipc.h"
#include "gatekeeper_ipc.h"

#define TRUSTY_DEVICE_NAME "/dev/trusty-ipc-dev0"

static const char* trusty_device_name = "/dev/trusty-ipc-dev0";
static int handle_ = 0;

void trusty_gatekeeper_set_dev_name(const char* device_name) {
    trusty_device_name = device_name;
}

int trusty_gatekeeper_connect() {
    int rc = tipc_connect(TRUSTY_DEVICE_NAME, GATEKEEPER_PORT);
    int rc = tipc_connect(trusty_device_name, GATEKEEPER_PORT);
    if (rc < 0) {
        return rc;
    }
Loading