From 7a2f90ea8a4eadad39e7cd860576801dbb3ff7de Mon Sep 17 00:00:00 2001 From: Ulises Mendez Martinez Date: Wed, 14 May 2025 15:32:47 +0000 Subject: [PATCH] ANDROID: Create list of protected module names * This is the input for the new mechanims for runtime symbol protection, modpost now expects a list of module names (without the .ko extension) Bug: 393366754 Change-Id: I9d83fad6cad55d56290c122bdc2f3c03ccd42a65 Signed-off-by: Ulises Mendez Martinez --- BUILD.bazel | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/BUILD.bazel b/BUILD.bazel index 89bcc1fb1491..ad30127d2d4f 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -108,6 +108,17 @@ write_file( ], ) +write_file( + name = "gki_aarch64_protected_module_names", + out = "gki/aarch64/protected_module_names", + content = [ + module.removesuffix(".ko") + for module in get_gki_protected_modules_list("arm64") + ] + [ + "", # Ensure new line at the end. + ], +) + write_file( name = "gki_system_dlkm_modules_x86_64", out = "gki/x86_64/system_dlkm_modules", @@ -126,6 +137,17 @@ write_file( ], ) +write_file( + name = "gki_x86_64_protected_module_names", + out = "gki/x86_64/protected_module_names", + content = [ + module.removesuffix(".ko") + for module in get_gki_protected_modules_list("x86_64") + ] + [ + "", # Ensure new line at the end. + ], +) + _SET_KERNEL_DIR_CMD = "KERNEL_DIR=\"{kernel_dir}\"".format( kernel_dir = paths.join( package_relative_label(":x").workspace_root, @@ -249,6 +271,7 @@ common_kernel( makefile = ":Makefile", module_implicit_outs = get_gki_modules_list("arm64") + get_kunit_modules_list("arm64"), protected_exports_list = "gki/aarch64/protected_exports", + protected_module_names_list = ":gki_aarch64_protected_module_names", protected_modules_list = ":gki_aarch64_protected_modules", system_dlkm_extra_archive_files = [":generate_gki_module_info_arm64"], trim_nonlisted_kmi = True, @@ -280,6 +303,7 @@ common_kernel( module_implicit_outs = get_gki_modules_list("arm64") + get_kunit_modules_list("arm64"), page_size = "16k", protected_exports_list = "gki/aarch64/protected_exports", + protected_module_names_list = ":gki_aarch64_protected_module_names", protected_modules_list = ":gki_aarch64_protected_modules", system_dlkm_extra_archive_files = [":generate_gki_module_info_arm64"], trim_nonlisted_kmi = True, @@ -309,6 +333,7 @@ common_kernel( module_implicit_outs = get_gki_modules_list("arm64") + get_kunit_modules_list("arm64"), pre_defconfig_fragments = ["arch/arm64/configs/tv_gki.fragment"], protected_exports_list = "gki/aarch64/protected_exports", + protected_module_names_list = ":gki_aarch64_protected_module_names", protected_modules_list = ":gki_aarch64_protected_modules", system_dlkm_extra_archive_files = [":generate_gki_module_info_arm64"], trim_nonlisted_kmi = True, @@ -349,6 +374,7 @@ common_kernel( makefile = ":Makefile", module_implicit_outs = get_gki_modules_list("arm64") + get_kunit_modules_list("arm64"), protected_exports_list = "gki/aarch64/protected_exports", + protected_module_names_list = ":gki_aarch64_protected_module_names", protected_modules_list = ":gki_aarch64_protected_modules", system_dlkm_extra_archive_files = [":generate_gki_module_info_arm64"], trim_nonlisted_kmi = True,