diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn index 473ef3e0bd3d4e8c8109ee7da5c93e3372efa44f..d88f33a18237aaa66a1cdecb92a63fb294957124 100755 --- a/interfaces/innerkits/BUILD.gn +++ b/interfaces/innerkits/BUILD.gn @@ -192,7 +192,7 @@ if (defined(ohos_lite)) { "_GNU_SOURCE", ] if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "SUPPORT_64BIT" ] } @@ -310,7 +310,7 @@ if (defined(ohos_lite)) { "_GNU_SOURCE", ] if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "SUPPORT_64BIT" ] } diff --git a/services/etc/BUILD.gn b/services/etc/BUILD.gn index 5906d89f85eb02ef436366d76ab9148d01df37c1..421b1e4a1cca2d62549f0f25b55232920f2c0b84 100755 --- a/services/etc/BUILD.gn +++ b/services/etc/BUILD.gn @@ -146,6 +146,9 @@ if (defined(ohos_lite)) { if (target_cpu == "riscv64") { extra_paras += [ "const.product.cpu.abilist=riscv64" ] } + if (target_cpu == "loongarch64") { + extra_paras += [ "const.product.cpu.abilist=loongarch64" ] + } if (build_variant == "user") { extra_paras += [ "const.secure=1", diff --git a/services/init/standard/BUILD.gn b/services/init/standard/BUILD.gn index 920c762c2e6cdaeda676c4d39a9445b2084f3d23..0fe10664c4cbef97bd0d1fcca5634106c53b9e8a 100644 --- a/services/init/standard/BUILD.gn +++ b/services/init/standard/BUILD.gn @@ -206,7 +206,7 @@ ohos_executable("init") { } if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "SUPPORT_64BIT" ] } diff --git a/services/modules/bootchart/BUILD.gn b/services/modules/bootchart/BUILD.gn index ac9570a766547457d0a0eddfc09a2731a612ac99..085479e419a77d49ebe8e0a564ca9f681ca95c1f 100755 --- a/services/modules/bootchart/BUILD.gn +++ b/services/modules/bootchart/BUILD.gn @@ -31,7 +31,7 @@ ohos_shared_library("bootchart") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/modules/crashhandler/crash_handler.c b/services/modules/crashhandler/crash_handler.c index 6d5d0f4a473b04481a026587573d9a10db22a332..16c5049636ce9555707e3e6988b82d9dd5db5914 100644 --- a/services/modules/crashhandler/crash_handler.c +++ b/services/modules/crashhandler/crash_handler.c @@ -83,4 +83,4 @@ void InstallLocalSignalHandler(void) } } sigprocmask(SIG_UNBLOCK, &set, NULL); -} \ No newline at end of file +} diff --git a/services/modules/crashhandler/crash_handler.h b/services/modules/crashhandler/crash_handler.h index 623d6f4441cd559f91075ea496ed508b0011aa79..1ee371455317744a7ba01149d018340094c521e0 100644 --- a/services/modules/crashhandler/crash_handler.h +++ b/services/modules/crashhandler/crash_handler.h @@ -34,4 +34,4 @@ void InstallLocalSignalHandler(void); #ifdef __cplusplus } #endif -#endif \ No newline at end of file +#endif diff --git a/services/modules/init_context/BUILD.gn b/services/modules/init_context/BUILD.gn index 17ad61a8f3a9836641d4489f8b55e87c20bbf0df..75a9c8d0aef2ee669e2e8432dddfd8c88731526b 100644 --- a/services/modules/init_context/BUILD.gn +++ b/services/modules/init_context/BUILD.gn @@ -50,7 +50,7 @@ ohos_shared_library("init_context") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/modules/init_eng/BUILD.gn b/services/modules/init_eng/BUILD.gn index 57be0e6ae384f5d3c8aa1537b76aaed4adc41e75..1a91bb7ca3ed5ae1f784f817147f5370ace39a84 100644 --- a/services/modules/init_eng/BUILD.gn +++ b/services/modules/init_eng/BUILD.gn @@ -35,7 +35,7 @@ ohos_shared_library("init_eng") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/modules/reboot/BUILD.gn b/services/modules/reboot/BUILD.gn index db40e9bc7f7ebb745aa269aeaea9d1ad31808560..9ddea34db8a97978fe78d6dcdd6d9b2433955285 100644 --- a/services/modules/reboot/BUILD.gn +++ b/services/modules/reboot/BUILD.gn @@ -41,7 +41,7 @@ ohos_shared_library("rebootmodule") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init/reboot" } else { module_install_dir = "lib/init/reboot" diff --git a/services/modules/seccomp/scripts/generate_code_from_policy.py b/services/modules/seccomp/scripts/generate_code_from_policy.py index db7a0f00e6e6d221bcab8fc434fa4bc6f975f770..b854b2318569986664ed5f4fb7ce355dadd448cc 100755 --- a/services/modules/seccomp/scripts/generate_code_from_policy.py +++ b/services/modules/seccomp/scripts/generate_code_from_policy.py @@ -27,7 +27,7 @@ supported_parse_item = ['labelName', 'priority', 'allowList', 'blockList', 'prio 'allowListWithArgs', 'headFiles', 'selfDefineSyscall', 'returnValue', \ 'mode', 'privilegedProcessName', 'allowBlockList'] -supported_architecture = ['arm', 'arm64', 'riscv64'] +supported_architecture = ['arm', 'arm64','riscv64', 'loongarch64'] BPF_JGE = 'BPF_JUMP(BPF_JMP|BPF_JGE|BPF_K, {}, {}, {}),' BPF_JGT = 'BPF_JUMP(BPF_JMP|BPF_JGT|BPF_K, {}, {}, {}),' @@ -61,7 +61,8 @@ mode_str = { architecture_to_number = { 'arm': 'AUDIT_ARCH_ARM', 'arm64': 'AUDIT_ARCH_AARCH64', - 'riscv64': 'AUDIT_ARCH_RISCV64' + 'riscv64': 'AUDIT_ARCH_RISCV64', + 'loongarch64': 'AUDIT_ARCH_LOONGARCH64' } @@ -500,7 +501,7 @@ class GenBpfPolicy: def gen_bpf_eq(self, const_str, jt, jf): if self.arch == 'arm': return self.gen_bpf_eq32(const_str, jt, jf) - elif self.arch == 'arm64' or self.arch == 'riscv64': + elif self.arch == 'arm64' or self.arch == 'loongarch64' or self.arch == 'riscv64': return self.gen_bpf_eq64(const_str, jt, jf) return [] @@ -510,7 +511,7 @@ class GenBpfPolicy: def gen_bpf_gt(self, const_str, jt, jf): if self.arch == 'arm': return self.gen_bpf_gt32(const_str, jt, jf) - elif self.arch == 'arm64' or self.arch == 'riscv64': + elif self.arch == 'arm64' or self.arch == 'loongarch64' or self.arch == 'riscv64': return self.gen_bpf_gt64(const_str, jt, jf) return [] @@ -520,7 +521,7 @@ class GenBpfPolicy: def gen_bpf_ge(self, const_str, jt, jf): if self.arch == 'arm': return self.gen_bpf_ge32(const_str, jt, jf) - elif self.arch == 'arm64' or self.arch == 'riscv64': + elif self.arch == 'arm64' or self.arch == 'loongarch64' or self.arch == 'riscv64': return self.gen_bpf_ge64(const_str, jt, jf) return [] @@ -530,7 +531,7 @@ class GenBpfPolicy: def gen_bpf_set(self, const_str, jt, jf): if self.arch == 'arm': return self.gen_bpf_set32(const_str, jt, jf) - elif self.arch == 'arm64' or self.arch == 'riscv64': + elif self.arch == 'arm64' or self.arch == 'loongarch64' or self.arch == 'riscv64': return self.gen_bpf_set64(const_str, jt, jf) return [] @@ -655,7 +656,7 @@ class GenBpfPolicy: bpf_policy = [] if self.arch == 'arm': bpf_policy.append(BPF_LOAD.format(16 + arg_id * 8)) - elif self.arch == 'arm64' or self.arch == 'riscv64': + elif self.arch == 'arm64' or self.arch == 'riscv64' or self.arch == 'loongarch64': #low 4 bytes bpf_policy.append(BPF_LOAD.format(16 + arg_id * 8)) bpf_policy.append(BPF_ST.format(0)) @@ -858,7 +859,7 @@ class SeccompPolicyParser: elif target_cpu == "arm64": self.arches.add("arm") self.arches.add(target_cpu) - elif target_cpu == "riscv64": + elif target_cpu == "riscv64" or target_cpu == "loongarch64": self.arches.add(target_cpu) def update_block_list(self): @@ -1064,7 +1065,7 @@ def main(): help='Name of seccomp bpf array generated by this script') parser.add_argument('--target-cpu', type=str, - help=('please input target cpu arm or arm64\n')) + help=('please input target cpu arm or arm64 or loongarch64\n')) parser.add_argument('--is-debug', type=str, help=('please input is_debug true or false\n')) diff --git a/services/modules/seccomp/scripts/seccomp_policy_fixer.gni b/services/modules/seccomp/scripts/seccomp_policy_fixer.gni index 6825cea066e73695020e3fb8d0589ee7596ec235..6c8c47a1a93ce9c305f27dc80cd4d1c4d1b46068 100755 --- a/services/modules/seccomp/scripts/seccomp_policy_fixer.gni +++ b/services/modules/seccomp/scripts/seccomp_policy_fixer.gni @@ -35,6 +35,7 @@ template("ohos_prebuilt_seccomp") { _syscall_to_nr_arm_name = "${target_name}_syscall_to_nr_arm" _syscall_to_nr_arm64_name = "${target_name}_syscall_to_nr_arm64" _syscall_to_nr_riscv64_name = "${target_name}_syscall_to_nr_riscv64" + _syscall_to_nr_loongarch64_name = "${target_name}_syscall_to_nr_loongarch64" _blocklist_file_name = "//base/startup/init/services/modules/seccomp/seccomp_policy/${invoker.process_type}.blocklist.seccomp.policy" _key_process_file_name = "//base/startup/init/services/modules/seccomp/seccomp_policy/privileged_process.seccomp.policy" @@ -107,6 +108,31 @@ template("ohos_prebuilt_seccomp") { ] outputs = [ output_dir ] } + action(_syscall_to_nr_loongarch64_name) { + script = "${clang_base_path}/bin/clang" + output_dir = target_gen_dir + + "/${_seccomp_filter_target}/libsyscall_to_nr_loongarch64" + args = [ + "-I", + rebase_path( + "//kernel/linux/patches/${linux_kernel_version}/prebuilts/usr/include/asm-loongarch"), + "-I", + rebase_path( + "//kernel/linux/patches/${linux_kernel_version}/prebuilts/usr/include"), + "-dD", + "-D__ARCH_WANT_NEW_STAT", + "-D__ARCH_WANT_SYS_CLONE", + "-D__ARCH_WANT_SYS_CLONE3", + "-E", + "-Wall", + "-nostdinc", + "-o", + rebase_path(output_dir), + rebase_path( + "//base/startup/init/services/modules/seccomp/gen_syscall_name_nrs.c"), + ] + outputs = [ output_dir ] + } action(_seccomp_filter_target) { script = "//base/startup/init/services/modules/seccomp/scripts/generate_code_from_policy.py" @@ -114,6 +140,7 @@ template("ohos_prebuilt_seccomp") { sources += get_target_outputs(":${_syscall_to_nr_arm_name}") sources += get_target_outputs(":${_syscall_to_nr_arm64_name}") sources += get_target_outputs(":${_syscall_to_nr_riscv64_name}") + sources += get_target_outputs(":${_syscall_to_nr_loongarch64_name}") uid_is_root = false if (defined(invoker.uid_is_root)) { uid_is_root = invoker.uid_is_root @@ -129,6 +156,7 @@ template("ohos_prebuilt_seccomp") { deps = [ ":${_syscall_to_nr_arm64_name}", ":${_syscall_to_nr_arm_name}", + ":${_syscall_to_nr_loongarch64_name}", ":${_syscall_to_nr_riscv64_name}", ] diff --git a/services/modules/seccomp/scripts/tools/audit_log_analysis.py b/services/modules/seccomp/scripts/tools/audit_log_analysis.py index e5ab88a7015c5272e2823ebabd27aca6e9be8576..847bf6af997e9abc7c6de5059fce205d931f3511 100644 --- a/services/modules/seccomp/scripts/tools/audit_log_analysis.py +++ b/services/modules/seccomp/scripts/tools/audit_log_analysis.py @@ -27,7 +27,8 @@ def parse_line(fp, arch_nr): arch_id_map = { '40000028': 'arm', 'c00000b7': 'arm64', - 'c00000f3': 'riscv64' + 'c00000f3': 'riscv64', + 'c00000f3': 'loongarch64' } for line in fp: line = line.strip() @@ -45,9 +46,10 @@ def get_item_content(name_nr_table, arch_nr_table): syscall_name_dict = { 'arm': list(), 'arm64': list(), - 'riscv64': list() + 'riscv64': list(), + 'loongarch64': list() } - supported_architecture = ['arm64', 'arm', 'riscv64'] + supported_architecture = ['arm64', 'arm', 'riscv64', 'loongarch64'] for arch in supported_architecture: for nr in sorted(list(arch_nr_table.get(arch))): syscall_name = name_nr_table.get(arch).get(nr) @@ -67,6 +69,9 @@ def get_item_content(name_nr_table, arch_nr_table): if syscall_name_dict.get('riscv64'): content = '{}{};riscv64\n'.format(content, ';riscv64\n'.join( [func_name for func_name in syscall_name_dict.get('riscv64')])) + if syscall_name_dict.get('loongarch64'): + content = '{}{};loongarch64\n'.format(content, ';loongarch64\n'.join( + [func_name for func_name in syscall_name_dict.get('loongarch64')])) return content @@ -100,6 +105,7 @@ def parse_audit_log_to_policy(args): arch_nr = { 'arm': set(), 'arm64': set(), + 'loongarch64': set(), 'riscv64': set() } for file_name in file_list: diff --git a/services/modules/seccomp/scripts/tools/collect_elf_syscall.py b/services/modules/seccomp/scripts/tools/collect_elf_syscall.py index d79f74eafc4079e94cd07e207c320eea18de7cf2..61302098913e3f303ddd46c634bfe214e29c3bdc 100644 --- a/services/modules/seccomp/scripts/tools/collect_elf_syscall.py +++ b/services/modules/seccomp/scripts/tools/collect_elf_syscall.py @@ -58,6 +58,8 @@ def generate_libc_asm(target_cpu, elf_path, locate_path): cmd_obj_dump = 'aarch64-linux-musl-objdump' elif target_cpu == 'riscv64': cmd_obj_dump = 'riscv64-linux-musl-objdump' + elif target_cpu == 'loongarch64': + cmd_obj_dump = 'loongarch64-linux-musl-objdump' else: raise ValueError("target cpu error") @@ -288,6 +290,8 @@ def collect_concrete_syscall(args): arch_str = 'arm-linux' elif args.target_cpu == 'riscv64': arch_str = 'riscv64-linux' + elif args.target_cpu == 'loongarch64': + arch_str = 'loongarch64-linux' libc_path = get_lib_path(args.src_elf_path, 'libc.so', ' | grep ' + arch_str) libc_asm_path = generate_libc_asm(args.target_cpu, libc_path, '.') @@ -336,7 +340,7 @@ def main(): parser.add_argument('--src-syscall-path', type=str, action='append', help=('path to syscall to nr files\n')) parser.add_argument('--target-cpu', type=str, - help='input arm or arm64 or riscv64') + help='input arm or arm64 or riscv64 or loongarch64') parser.add_argument('--filter-name', type=str, help=('consist of output file name\n')) diff --git a/services/modules/seccomp/scripts/tools/libc_static_analysis.py b/services/modules/seccomp/scripts/tools/libc_static_analysis.py index 819dcb5b0da768b7f97fd78fec960d4bfdb05865..142ed5d6cc9d0601fa182d81e4ce6ef8dc178adf 100644 --- a/services/modules/seccomp/scripts/tools/libc_static_analysis.py +++ b/services/modules/seccomp/scripts/tools/libc_static_analysis.py @@ -102,6 +102,9 @@ def get_direct_use_syscall_of_svc(arch, lines, func_list): elif arch == 'riscv64': svc_reg = 'x5,' svc_reg1 = 'x5,' + elif arch == 'loongarch64': + svc_reg = '$a7,' + svc_reg1 = '$a7,' for line in reversed(lines): line = line.strip() if not line: @@ -142,6 +145,9 @@ def get_direct_use_syscall_of_syscall(arch, lines, func_list): elif arch == 'riscv64': syscall_reg = 'x17,' syscall_reg1 = 'x17,' + elif arch == 'loongarch64': + syscall_reg = '$a0,' + syscall_reg1 = '$a0,' for line in reversed(lines): line = line.strip() diff --git a/services/modules/seccomp/scripts/tools/merge_policy.py b/services/modules/seccomp/scripts/tools/merge_policy.py index c5bcddbb95f2f1a78513134825ebe0cb4d1e7fcb..02936cb92f22f2d3ef1e19b1c614e3d6925d064c 100644 --- a/services/modules/seccomp/scripts/tools/merge_policy.py +++ b/services/modules/seccomp/scripts/tools/merge_policy.py @@ -66,6 +66,9 @@ class MergePolicy: if (syscall_name_dict.get('riscv64')): content = '{}{};riscv64\n'.format(content, ';riscv64\n'.join( [func_name for func_name, _ in syscall_name_dict.get('riscv64')])) + if (syscall_name_dict.get('loogarch64')): + content = '{}{};loogarch64\n'.format(content, ';loogarch64\n'.join( + [func_name for func_name, _ in syscall_name_dict.get('loogarch64')])) return content def update_parse_item(self, line): diff --git a/services/modules/seccomp/scripts/tools/strace_log_analysis.py b/services/modules/seccomp/scripts/tools/strace_log_analysis.py index 57df611749ea2c68412746d84c08d01fe8c2ba9e..95d5b9f22cac4018af0c9bd7b1163b8fba833a47 100644 --- a/services/modules/seccomp/scripts/tools/strace_log_analysis.py +++ b/services/modules/seccomp/scripts/tools/strace_log_analysis.py @@ -97,7 +97,7 @@ def main(): parser.add_argument('--src-path', action='append', help='the path of directory which includes strace log and libsyscall_to_nr files') parser.add_argument('--target-cpu', type=str, - help='input arm or arm64 or riscv64') + help='input arm or arm64 or riscv64 or loongarch64') parser.add_argument('--filter-name', type=str, help=('consist of output file name\n')) diff --git a/services/modules/seccomp/seccomp_policy.c b/services/modules/seccomp/seccomp_policy.c index 8db694595790357c18b49ddb4f6b7222c3ddafdc..e57791ae1d63217835b392e78ea95873bd9b2955 100644 --- a/services/modules/seccomp/seccomp_policy.c +++ b/services/modules/seccomp/seccomp_policy.c @@ -38,7 +38,7 @@ #define SECCOMP_SET_MODE_FILTER (1) #endif -#ifdef __aarch64__ +#if defined(__aarch64__) || defined(__loongarch_lp64) #define FILTER_LIB_PATH_FORMAT "lib64/seccomp/lib%s_filter.z.so" #define FILTER_LIB_PATH_PART "lib64/seccomp/lib" #else diff --git a/services/modules/seccomp/seccomp_policy/app.blocklist.seccomp.policy b/services/modules/seccomp/seccomp_policy/app.blocklist.seccomp.policy index f8e6b8a70d7ff125f729927cde0348c6506a1fb0..eea95f3f284620cdfcf13178e39724bfc73139d9 100644 --- a/services/modules/seccomp/seccomp_policy/app.blocklist.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/app.blocklist.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @blockList umount2;all @@ -26,12 +26,16 @@ syslog;all reboot;all setregid;arm64 setregid;riscv64 +setregid;loongarch64 setgid;arm64 setgid;riscv64 +setgid;loongarch64 setreuid;arm64 setreuid;riscv64 +setreuid;loongarch64 setuid;arm64 setuid;riscv64 +setuid;loongarch64 setfsuid;all setfsgid;all sethostname;all @@ -47,7 +51,9 @@ setuid32;arm setgid32;arm setgroups;arm64 setgroups;riscv64 +setgroups;loongarch64 setgroups32;arm setresgid;arm64 setresgid;riscv64 +setresgid;loongarch64 setresgid32;arm diff --git a/services/modules/seccomp/seccomp_policy/app.seccomp.policy b/services/modules/seccomp/seccomp_policy/app.seccomp.policy index 8ac9c348f5a4110774b07bdb80390fa5b0ba0419..01c449c0d78c9c4a5f2c54832a2003cb07a4dc95 100644 --- a/services/modules/seccomp/seccomp_policy/app.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/app.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @returnValue TRAP @@ -56,8 +56,10 @@ inotify_rm_watch;all ioctl;all ioprio_set;arm64 ioprio_set;riscv64 +ioprio_set;loongarch64 ioprio_get;arm64 ioprio_get;riscv64 +ioprio_get;loongarch64 flock;all mknodat;all mkdirat;all @@ -67,13 +69,17 @@ linkat;all renameat;arm renameat;arm64 pivot_root;riscv64 +pivot_root;loongarch64 statfs;arm64 statfs;riscv64 +statfs;loongarch64 fstatfs;arm64 fstatfs;riscv64 +fstatfs;loongarch64 truncate;all ftruncate;arm64 ftruncate;riscv64 +ftruncate;loongarch64 fallocate;all faccessat;all chdir;all @@ -83,6 +89,7 @@ fchmodat;all fchownat;all fchown;arm64 fchown;riscv64 +fchown;loongarch64 openat;all close;all pipe2;all @@ -114,6 +121,7 @@ fsync;all fdatasync;all sync_file_range;arm64 sync_file_range;riscv64 +sync_file_range;loongarch64 timerfd_create;all timerfd_settime;all timerfd_gettime;all @@ -164,10 +172,13 @@ setpriority;all getpriority;all setresuid;arm64 setresuid;riscv64 +setresuid;loongarch64 getresuid;arm64 getresuid;riscv64 +getresuid;loongarch64 getresgid;arm64 getresgid;riscv64 +getresgid;loongarch64 times;all setpgid;all getpgid;all @@ -175,10 +186,12 @@ getsid;all setsid;all getgroups;arm64 getgroups;riscv64 +getgroups;loongarch64 uname;all getrlimit;arm64 getrlimit;riscv64 -setrlimit;all +setrlimit;arm64 +setrlimit;riscv64 getrusage;all umask;all prctl;all @@ -189,10 +202,13 @@ getppid;all getuid;all geteuid;arm64 geteuid;riscv64 +geteuid;loongarch64 getgid;arm64 getgid;riscv64 +getgid;loongarch64 getegid;arm64 getegid;riscv64 +getegid;loongarch64 gettid;all sysinfo;all socket;all @@ -217,8 +233,10 @@ mremap;all execve;all mmap;arm64 mmap;riscv64 +mmap;loongarch64 fadvise64;arm64 fadvise64;riscv64 +fadvise64;loongarch64 mprotect;all msync;all mlock;all @@ -301,6 +319,7 @@ sendfile64;arm epoll_create;arm epoll_wait;arm remap_file_pages;arm +remap_file_pages;loongarch64 statfs64;arm fstatfs64;arm fadvise64_64;arm @@ -327,6 +346,51 @@ futex_time64;arm sched_rr_get_interval_time64;arm cacheflush;arm set_tls;arm +lookup_dcookie;loongarch64 +nfsservctl;loongarch64 +vhangup;loongarch64 +kexec_load;loongarch64 +mq_open;loongarch64 +mq_unlink;loongarch64 +mq_timedsend;loongarch64 +mq_timedreceive;loongarch64 +mq_notify;loongarch64 +mq_getsetattr;loongarch64 +msgget;loongarch64 +msgctl;loongarch64 +msgrcv;loongarch64 +msgsnd;loongarch64 +semctl;loongarch64 +request_key;loongarch64 +semtimedop;loongarch64 +semop;loongarch64 +get_mempolicy;loongarch64 +set_mempolicy;loongarch64 +migrate_pages;loongarch64 +move_pages;loongarch64 +fanotify_init;loongarch64 +fanotify_mark;loongarch64 +name_to_handle_at;loongarch64 +open_by_handle_at;loongarch64 +kcmp;loongarch64 +pkey_mprotect;loongarch64 +pkey_alloc;loongarch64 +pkey_free;loongarch64 +io_pgetevents;loongarch64 +rseq;loongarch64 +kexec_file_load;loongarch64 +io_uring_setup;loongarch64 +clone3;loongarch64 +io_uring_enter;loongarch64 +io_uring_register;loongarch64 +open_tree;loongarch64 +move_mount;loongarch64 +fsopen;loongarch64 +fsconfig;loongarch64 +fsmount;loongarch64 +fspick;loongarch64 +openat2;loongarch64 @allowListWithArgs clone: if (arg0 & (CLONE_NEWNS | CLONE_NEWPID | CLONE_NEWNET | CLONE_NEWCGROUP | CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER)) == 0 ; return ALLOW; else return TRAP;all +clone3: if (arg0 & (CLONE_NEWNS | CLONE_NEWPID | CLONE_NEWNET | CLONE_NEWCGROUP | CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER)) == 0 ; return ALLOW; else return TRAP;all diff --git a/services/modules/seccomp/seccomp_policy/app_atomic.seccomp.policy b/services/modules/seccomp/seccomp_policy/app_atomic.seccomp.policy index ec81c9a77d1f4df523a5849355c45e285b887949..c3c8b2bd10d6403d6538c8c6d0ce87a4b204344b 100644 --- a/services/modules/seccomp/seccomp_policy/app_atomic.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/app_atomic.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'loongarch64', 'riscv64']. @returnValue TRAP @@ -72,6 +72,7 @@ fstatfs;riscv64 truncate;all ftruncate;arm64 ftruncate;riscv64 +ftruncate;loongarch64 fallocate;all faccessat;all chdir;all @@ -176,7 +177,8 @@ getgroups;riscv64 uname;all getrlimit;arm64 getrlimit;riscv64 -setrlimit;all +setrlimit;arm64 +setrlimit;riscv64 getrusage;all umask;all prctl;all diff --git a/services/modules/seccomp/seccomp_policy/app_privilege.seccomp.policy b/services/modules/seccomp/seccomp_policy/app_privilege.seccomp.policy index 84e433348fac6802c76ff494d9c18e7ec721bdb6..ca8f69adee332c9f08139756d596edebfc95a466 100644 --- a/services/modules/seccomp/seccomp_policy/app_privilege.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/app_privilege.seccomp.policy @@ -186,7 +186,8 @@ setgroups;riscv64 uname;all getrlimit;arm64 getrlimit;riscv64 -setrlimit;all +setrlimit;arm64 +setrlimit;riscv64 getrusage;all umask;all prctl;all diff --git a/services/modules/seccomp/seccomp_policy/nwebspawn.seccomp.policy b/services/modules/seccomp/seccomp_policy/nwebspawn.seccomp.policy index 853b6b95ac8fa910ea5f3e52ef9aaef0353cb23a..01ec9069fb5a15e07e92b5c3c96d418b6ac383e6 100644 --- a/services/modules/seccomp/seccomp_policy/nwebspawn.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/nwebspawn.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @returnValue TRAP diff --git a/services/modules/seccomp/seccomp_policy/privileged_process.seccomp.policy b/services/modules/seccomp/seccomp_policy/privileged_process.seccomp.policy index 76093ee2093f4532d438ed80192b529b46e34805..28294208a3009e97d02582c69667169814f6a6f4 100644 --- a/services/modules/seccomp/seccomp_policy/privileged_process.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/privileged_process.seccomp.policy @@ -11,4 +11,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. diff --git a/services/modules/seccomp/seccomp_policy/spawn.seccomp.policy b/services/modules/seccomp/seccomp_policy/spawn.seccomp.policy index 881a953127644d69e43b52ff45dda0513387eeb9..6ae9c7a0a6a58844bc447e51dae7035773371994 100644 --- a/services/modules/seccomp/seccomp_policy/spawn.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/spawn.seccomp.policy @@ -25,6 +25,8 @@ setresuid: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_ setresgid: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;arm64 setresuid: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;riscv64 setresgid: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;riscv64 +setresuid: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;loongarch64 +setresgid: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;loongarch64 setresuid32: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;arm setresgid32: if arg0 >= APP_UID_START && arg1 >= APP_UID_START && arg2 >= APP_UID_START; return ALLOW; else return TRAP;arm setuid: if arg0 >= APP_UID_START; return ALLOW; else return TRAP;all diff --git a/services/modules/seccomp/seccomp_policy/system.blocklist.seccomp.policy b/services/modules/seccomp/seccomp_policy/system.blocklist.seccomp.policy index 21057777c895d830bcf37a3085359789570eab1f..da6fff664c8fc633303c43c117dba62125840c9d 100644 --- a/services/modules/seccomp/seccomp_policy/system.blocklist.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/system.blocklist.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @blockList swapon;all diff --git a/services/modules/seccomp/seccomp_policy/system.seccomp.policy b/services/modules/seccomp/seccomp_policy/system.seccomp.policy index 0a78136ee8084e462ac9284b46eaef11a5a9ff46..36aac793bd0609010e52a5da6c89b3cc6381ee91 100644 --- a/services/modules/seccomp/seccomp_policy/system.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/system.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @returnValue TRAP @@ -43,14 +43,17 @@ dup;all dup3;all fcntl;arm64 fcntl;riscv64 +fcntl;loongarch64 inotify_init1;all inotify_add_watch;all inotify_rm_watch;all ioctl;all ioprio_set;arm64 ioprio_set;riscv64 +ioprio_set;loongarch64 ioprio_get;arm64 ioprio_get;riscv64 +ioprio_get;loongarch64 flock;all mknodat;all mkdirat;all @@ -64,11 +67,14 @@ mount;all pivot_root;all statfs;arm64 statfs;riscv64 +statfs;loongarch64 fstatfs;arm64 fstatfs;riscv64 +fstatfs;loongarch64 truncate;all ftruncate;arm64 ftruncate;riscv64 +ftruncate;loongarch64 fallocate;all faccessat;all faccessat2;all @@ -80,6 +86,7 @@ fchmodat;all fchownat;all fchown;arm64 fchown;riscv64 +fchown;loongarch64 openat;all close;all pipe2;all @@ -111,6 +118,7 @@ fsync;all fdatasync;all sync_file_range;arm64 sync_file_range;riscv64 +sync_file_range;loongarch64 timerfd_create;all timerfd_settime;all timerfd_gettime;all @@ -170,20 +178,28 @@ getpriority;all reboot;all setregid;arm64 setregid;riscv64 +setregid;loongarch64 setgid;arm64 setgid;riscv64 +setgid;loongarch64 setreuid;arm64 setreuid;riscv64 +setreuid;loongarch64 setuid;arm64 setuid;riscv64 +setuid;loongarch64 setresuid;arm64 setresuid;riscv64 +setresuid;loongarch64 getresuid;arm64 getresuid;riscv64 +getresuid;loongarch64 setresgid;arm64 setresgid;riscv64 +setresgid;loongarch64 getresgid;arm64 getresgid;riscv64 +getresgid;loongarch64 setfsuid;all setfsgid;all times;all @@ -193,14 +209,17 @@ getsid;all setsid;all getgroups;arm64 getgroups;riscv64 +getgroups;loongarch64 setgroups;arm64 setgroups;riscv64 +setgroups;loongarch64 uname;all sethostname;all setdomainname;all getrlimit;arm64 getrlimit;riscv64 -setrlimit;all +setrlimit;arm64 +setrlimit;riscv64 getrusage;all umask;all prctl;all @@ -212,12 +231,16 @@ getpid;all getppid;all getuid;arm64 getuid;riscv64 +getuid;loongarch64 geteuid;arm64 geteuid;riscv64 +geteuid;loongarch64 getgid;arm64 getgid;riscv64 +getgid;loongarch64 getegid;arm64 getegid;riscv64 +getegid;loongarch64 gettid;all sysinfo;all semget;all @@ -250,8 +273,10 @@ clone;all execve;all mmap;arm64 mmap;riscv64 +mmap;loongarch64 fadvise64;arm64 fadvise64;riscv64 +fadvise64;loongarch64 mprotect;all msync;all mlock;all @@ -363,3 +388,47 @@ sched_rr_get_interval_time64;arm cacheflush;arm set_tls;arm mbind;all +lookup_dcookie;loongarch64 +nfsservctl;loongarch64 +vhangup;loongarch64 +kexec_load;loongarch64 +mq_open;loongarch64 +mq_unlink;loongarch64 +mq_timedsend;loongarch64 +mq_timedreceive;loongarch64 +mq_notify;loongarch64 +mq_getsetattr;loongarch64 +msgget;loongarch64 +msgctl;loongarch64 +msgrcv;loongarch64 +msgsnd;loongarch64 +semctl;loongarch64 +request_key;loongarch64 +semtimedop;loongarch64 +semop;loongarch64 +get_mempolicy;loongarch64 +set_mempolicy;loongarch64 +migrate_pages;loongarch64 +move_pages;loongarch64 +fanotify_init;loongarch64 +fanotify_mark;loongarch64 +name_to_handle_at;loongarch64 +open_by_handle_at;loongarch64 +kcmp;loongarch64 +pkey_mprotect;loongarch64 +pkey_alloc;loongarch64 +pkey_free;loongarch64 +io_pgetevents;loongarch64 +rseq;loongarch64 +kexec_file_load;loongarch64 +io_uring_setup;loongarch64 +clone3;loongarch64 +io_uring_enter;loongarch64 +io_uring_register;loongarch64 +open_tree;loongarch64 +move_mount;loongarch64 +fsopen;loongarch64 +fsconfig;loongarch64 +fsmount;loongarch64 +fspick;loongarch64 +openat2;loongarch64 diff --git a/services/modules/seccomp/seccomp_policy/system_uid_filter.seccomp.policy b/services/modules/seccomp/seccomp_policy/system_uid_filter.seccomp.policy index 423f20c83b39854edcaad4b3c76042194e95aef2..f67f495b78a17c570ae321a09f3a9cd4c8d1ef4a 100644 --- a/services/modules/seccomp/seccomp_policy/system_uid_filter.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/system_uid_filter.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @returnValue TRAP diff --git a/services/modules/seccomp/seccomp_policy/updater.seccomp.policy b/services/modules/seccomp/seccomp_policy/updater.seccomp.policy index 32aa92aa015b461098707bc196ba10f3a9a7173e..79ef1c83a50d9fe59df2d99805d198fd6015e50e 100644 --- a/services/modules/seccomp/seccomp_policy/updater.seccomp.policy +++ b/services/modules/seccomp/seccomp_policy/updater.seccomp.policy @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# For now, it supports architechture of ['arm', 'arm64', 'riscv64']. +# For now, it supports architechture of ['arm', 'arm64', 'riscv64', 'loongarch64']. @returnValue TRAP @@ -32,14 +32,17 @@ dup;all dup3;all fcntl;arm64 fcntl;riscv64 +fcntl;loongarch64 inotify_init1;all inotify_add_watch;all inotify_rm_watch;all ioctl;all ioprio_set;arm64 ioprio_set;riscv64 +ioprio_set;loongarch64 ioprio_get;arm64 ioprio_get;riscv64 +ioprio_get;loongarch64 flock;all mknodat;all mkdirat;all @@ -52,11 +55,14 @@ umount2;all mount;all statfs;arm64 statfs;riscv64 +statfs;loongarch64 fstatfs;arm64 fstatfs;riscv64 +fstatfs;loongarch64 truncate;all ftruncate;arm64 ftruncate;riscv64 +ftruncate;loongarch64 fallocate;all faccessat;all chdir;all @@ -67,6 +73,7 @@ fchmodat;all fchownat;all fchown;arm64 fchown;riscv64 +fchown;loongarch64 openat;all close;all pipe2;all @@ -98,6 +105,7 @@ fsync;all fdatasync;all sync_file_range;arm64 sync_file_range;riscv64 +sync_file_range;loongarch64 utimensat;all acct;all capget;all @@ -149,20 +157,28 @@ getpriority;all reboot;all setregid;arm64 setregid;riscv64 +setregid;loongarch64 setgid;arm64 setgid;riscv64 +setgid;loongarch64 setreuid;arm64 setreuid;riscv64 +setreuid;loongarch64 setuid;arm64 setuid;riscv64 +setuid;loongarch64 setresuid;arm64 setresuid;riscv64 +setresuid;loongarch64 getresuid;arm64 getresuid;riscv64 +getresuid;loongarch64 setresgid;arm64 setresgid;riscv64 +setresgid;loongarch64 getresgid;arm64 getresgid;riscv64 +getresgid;loongarch64 setfsuid;all setfsgid;all times;all @@ -172,14 +188,17 @@ getsid;all setsid;all getgroups;arm64 getgroups;riscv64 +getgroups;loongarch64 setgroups;arm64 setgroups;riscv64 +setgroups;loongarch64 uname;all sethostname;all setdomainname;all getrlimit;arm64 getrlimit;riscv64 -setrlimit;all +setrlimit;arm64 +setrlimit;riscv64 getrusage;all umask;all prctl;all @@ -191,12 +210,16 @@ getpid;all getppid;all getuid;arm64 getuid;riscv64 +getuid;loongarch64 geteuid;arm64 geteuid;riscv64 +geteuid;loongarch64 getgid;arm64 getgid;riscv64 +getgid;loongarch64 getegid;arm64 getegid;riscv64 +getegid;loongarch64 gettid;all sysinfo;all semget;all @@ -229,8 +252,10 @@ clone;all execve;all mmap;arm64 mmap;riscv64 +mmap;loongarch64 fadvise64;arm64 fadvise64;riscv64 +fadvise64;loongarch64 mprotect;all msync;all mlock;all @@ -329,3 +354,47 @@ setitimer;all timerfd_create;all timerfd_gettime;all timerfd_settime;all +lookup_dcookie;loongarch64 +nfsservctl;loongarch64 +vhangup;loongarch64 +kexec_load;loongarch64 +mq_open;loongarch64 +mq_unlink;loongarch64 +mq_timedsend;loongarch64 +mq_timedreceive;loongarch64 +mq_notify;loongarch64 +mq_getsetattr;loongarch64 +msgget;loongarch64 +msgctl;loongarch64 +msgrcv;loongarch64 +msgsnd;loongarch64 +semctl;loongarch64 +request_key;loongarch64 +semtimedop;loongarch64 +semop;loongarch64 +get_mempolicy;loongarch64 +set_mempolicy;loongarch64 +migrate_pages;loongarch64 +move_pages;loongarch64 +fanotify_init;loongarch64 +fanotify_mark;loongarch64 +name_to_handle_at;loongarch64 +open_by_handle_at;loongarch64 +kcmp;loongarch64 +pkey_mprotect;loongarch64 +pkey_alloc;loongarch64 +pkey_free;loongarch64 +io_pgetevents;loongarch64 +rseq;loongarch64 +kexec_file_load;loongarch64 +io_uring_setup;loongarch64 +clone3;loongarch64 +io_uring_enter;loongarch64 +io_uring_register;loongarch64 +open_tree;loongarch64 +move_mount;loongarch64 +fsopen;loongarch64 +fsconfig;loongarch64 +fsmount;loongarch64 +fspick;loongarch64 +openat2;loongarch64 diff --git a/services/modules/selinux/BUILD.gn b/services/modules/selinux/BUILD.gn index 235ce5bc85ecc3e4eb36b30144f2488de65e42f5..225d3019f38687e33cad930b7951a342a27c031d 100755 --- a/services/modules/selinux/BUILD.gn +++ b/services/modules/selinux/BUILD.gn @@ -36,7 +36,7 @@ ohos_shared_library("selinuxadp") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/modules/sysevent/BUILD.gn b/services/modules/sysevent/BUILD.gn index 3b1a1af884d24268199f41a170b8f3e5514348c2..671fe0a2e104f01d49b9e37bb2f88dbfd78cccb8 100644 --- a/services/modules/sysevent/BUILD.gn +++ b/services/modules/sysevent/BUILD.gn @@ -37,7 +37,7 @@ ohos_shared_library("eventmodule") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/modules/trace/BUILD.gn b/services/modules/trace/BUILD.gn index 9e9e9cbf58942d6b9e89ac3989f9ee535d6d3fce..650d79e02f519d7d3a6de453faecb639d3c15fd2 100644 --- a/services/modules/trace/BUILD.gn +++ b/services/modules/trace/BUILD.gn @@ -34,7 +34,7 @@ ohos_shared_library("inittrace") { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/modules/udid/BUILD.gn b/services/modules/udid/BUILD.gn index 6c7dbfb7829e8a46a61c8e0abdd2195d79cceb71..14e195ef70f5fa1f262d4e3f4e5044b134c00810 100644 --- a/services/modules/udid/BUILD.gn +++ b/services/modules/udid/BUILD.gn @@ -90,7 +90,7 @@ if (defined(ohos_lite)) { part_name = "init" subsystem_name = "startup" if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { module_install_dir = "lib64/init" } else { module_install_dir = "lib/init" diff --git a/services/param/adapter/param_selinux.c b/services/param/adapter/param_selinux.c index fdab03645e622d4f56bf4ef43bf38af8dbea8fb0..03f08afe649160a6bd0243b5f7fce8d660771ad8 100644 --- a/services/param/adapter/param_selinux.c +++ b/services/param/adapter/param_selinux.c @@ -25,7 +25,7 @@ #include "selinux_parameter.h" #endif -#if defined (__aarch64__) || defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64) +#if defined (__aarch64__) || defined(__x86_64__) || (defined(__riscv) && __riscv_xlen == 64) || defined(__loongarch_lp64) #define CHECKER_LIB_NAME "/system/lib64/libparaperm_checker.z.so" #define CHECKER_UPDATER_LIB "/lib64/libparaperm_checker.z.so" #else diff --git a/services/sandbox/BUILD.gn b/services/sandbox/BUILD.gn index 4d1aba7a22cc4a00c3fa2cde9e130308c149e1f7..4fee32e134a1b7d84ff63c2bfdbc9be19e7c093f 100755 --- a/services/sandbox/BUILD.gn +++ b/services/sandbox/BUILD.gn @@ -30,7 +30,7 @@ ohos_static_library("sandbox") { "//base/startup/init/interfaces/innerkits/include", ] if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines = [ "SUPPORT_64BIT" ] } deps = [ @@ -49,7 +49,7 @@ ohos_static_library("sandbox") { ohos_prebuilt_etc("system-sandbox.json") { if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { source = "system-sandbox64.json" } else { source = "system-sandbox.json" @@ -67,7 +67,7 @@ ohos_prebuilt_etc("system-sandbox.json") { ohos_prebuilt_etc("chipset-sandbox.json") { if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { source = "chipset-sandbox64.json" } else { source = "chipset-sandbox.json" diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index e0938c12b6eff242014faeafb70cca71afbbf76e..36b227dc38d08962abed892fd70004f7ba8015af 100755 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -328,7 +328,7 @@ ohos_unittest("init_unittest") { defines += [ "_GNU_SOURCE" ] if (target_cpu == "arm64" || target_cpu == "x86_64" || - target_cpu == "riscv64") { + target_cpu == "riscv64" || target_cpu == "loongarch64") { defines += [ "SUPPORT_64BIT" ] }