diff --git a/0013-fix-run-container-failed-on-riscv.patch b/0013-fix-run-container-failed-on-riscv.patch new file mode 100644 index 0000000000000000000000000000000000000000..140c7fe8b17bf9724baae266ff560bd4512e3e0b --- /dev/null +++ b/0013-fix-run-container-failed-on-riscv.patch @@ -0,0 +1,118 @@ +From 6d251f8f85f70e150a9258cb741d37df9fb8c14f Mon Sep 17 00:00:00 2001 +From: muyu517 <12936961+muyu517@user.noreply.gitee.com> +Date: Wed, 31 Jan 2024 11:35:13 +0800 +Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9src/lxc/seccomp.c?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/lxc/seccomp.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 64 insertions(+) + +diff --git a/src/lxc/seccomp.c b/src/lxc/seccomp.c +index d952beb..f409f2f 100644 +--- a/src/lxc/seccomp.c ++++ b/src/lxc/seccomp.c +@@ -315,6 +315,8 @@ enum lxc_hostarch_t { + lxc_seccomp_arch_mipsel64n32, + lxc_seccomp_arch_s390x, + lxc_seccomp_arch_s390, ++ lxc_seccomp_arch_riscv64, ++ lxc_seccomp_arch_riscv, + lxc_seccomp_arch_unknown = 999, + }; + +@@ -349,6 +351,10 @@ static int get_hostarch(void) + return lxc_seccomp_arch_s390x; + else if (strnequal(uts.machine, "s390", 4)) + return lxc_seccomp_arch_s390; ++ else if (strnequal(uts.machine, "riscv64", 7)) ++ return lxc_seccomp_arch_riscv64; ++ else if (strnequal(uts.machine, "riscv", 5)) ++ return lxc_seccomp_arch_riscv; + return lxc_seccomp_arch_unknown; + } + +@@ -426,6 +432,16 @@ static scmp_filter_ctx get_new_ctx(enum lxc_hostarch_t n_arch, uint32_t default_ + case lxc_seccomp_arch_s390: + arch = SCMP_ARCH_S390; + break; ++#endif ++#ifdef SCMP_ARCH_RISCV64 ++ case lxc_seccomp_arch_riscv64: ++ arch = SCMP_ARCH_RISCV64; ++ break; ++#endif ++#ifdef SCMP_ARCH_RISCV ++ case lxc_seccomp_arch_riscv; ++ arch = SCMP_ARCH_RISCV; ++ break; + #endif + default: + return NULL; +@@ -728,6 +744,32 @@ static int parse_config_v2(FILE *f, char *line, size_t *line_bufsz, struct lxc_c + #endif + if (!ctx.contexts[2]) + goto bad; ++#ifdef SCMP_ARCH_RISCV ++ } else if (native_arch == lxc_seccomp_arch_riscv64) { ++ cur_rule_arch = lxc_seccomp_arch_all; ++ ++ ctx.architectures[0] = SCMP_ARCH_RISCV; ++ ctx.contexts[0] = get_new_ctx(lxc_seccomp_arch_riscv, ++ default_policy_action, ++#ifdef HAVE_ISULAD ++ &ctx.architectures[0]); ++#else ++ &ctx.needs_merge[0]); ++#endif ++ if (!ctx.contexts[0]) ++ goto bad; ++ ++ ctx.architectures[2] = SCMP_ARCH_RISCV64; ++ ctx.contexts[2] = get_new_ctx(lxc_seccomp_arch_riscv64, ++ default_policy_action, ++#ifdef HAVE_ISULAD ++ &ctx.architectures[2]); ++#else ++ &ctx.needs_merge[2]); ++#endif ++ if (!ctx.contexts[2]) ++ goto bad; ++#endif + #ifdef SCMP_ARCH_PPC + } else if (native_arch == lxc_seccomp_arch_ppc64) { + cur_rule_arch = lxc_seccomp_arch_all; +@@ -1051,6 +1093,28 @@ static int parse_config_v2(FILE *f, char *line, size_t *line_bufsz, struct lxc_c + + cur_rule_arch = lxc_seccomp_arch_s390; + } ++#endif ++#ifdef SCMP_ARCH_RISCV64 ++ else if (strequal(line, "[riscv64]") || ++ strequal(line, "[RISCV64]") ) { ++ if (native_arch != lxc_seccomp_arch_riscv64) { ++ cur_rule_arch = lxc_seccomp_arch_unknown; ++ continue; ++ } ++ ++ cur_rule_arch = lxc_seccomp_arch_riscv64; ++ } ++#endif ++#ifdef SCMP_ARCH_RISCV ++ else if (strequal(line, "[riscv]") || ++ strequal(line, "[RISCV]") ) { ++ if (native_arch != lxc_seccomp_arch_riscv) { ++ cur_rule_arch = lxc_seccomp_arch_unknown; ++ continue; ++ } ++ ++ cur_rule_arch = lxc_seccomp_arch_riscv; ++ } + #endif + else { + goto bad_arch; +-- +2.41.0.windows.1 + diff --git a/lxc-5.0.2 b/lxc-5.0.2 new file mode 160000 index 0000000000000000000000000000000000000000..6d251f8f85f70e150a9258cb741d37df9fb8c14f --- /dev/null +++ b/lxc-5.0.2 @@ -0,0 +1 @@ +Subproject commit 6d251f8f85f70e150a9258cb741d37df9fb8c14f