]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
seccomp: support s390 seccomp 3233/head
authordongxinhua <dongxinhua@huawei.com>
Tue, 17 Dec 2019 01:10:04 +0000 (09:10 +0800)
committerdongxinhua <dongxinhua@huawei.com>
Tue, 17 Dec 2019 01:11:24 +0000 (09:11 +0800)
Signed-off-by: dongxinhua <dongxinhua@huawei.com>
src/lxc/seccomp.c

index 00d533e0f9cfa14a06ecf3502e39bed007c58eff..89244700591ac3f7c7226ea1c7f8aaf29fc7eb27 100644 (file)
@@ -339,6 +339,7 @@ enum lxc_hostarch_t {
        lxc_seccomp_arch_mipsel64,
        lxc_seccomp_arch_mipsel64n32,
        lxc_seccomp_arch_s390x,
+       lxc_seccomp_arch_s390,
        lxc_seccomp_arch_unknown = 999,
 };
 
@@ -371,7 +372,8 @@ int get_hostarch(void)
                return MIPS_ARCH_O32;
        else if (strncmp(uts.machine, "s390x", 5) == 0)
                return lxc_seccomp_arch_s390x;
-
+       else if (strncmp(uts.machine, "s390", 4) == 0)
+               return lxc_seccomp_arch_s390;
        return lxc_seccomp_arch_unknown;
 }
 
@@ -439,6 +441,11 @@ scmp_filter_ctx get_new_ctx(enum lxc_hostarch_t n_arch,
        case lxc_seccomp_arch_s390x:
                arch = SCMP_ARCH_S390X;
                break;
+#endif
+#ifdef SCMP_ARCH_S390
+       case lxc_seccomp_arch_s390:
+               arch = SCMP_ARCH_S390;
+               break;
 #endif
        default:
                return NULL;
@@ -938,6 +945,17 @@ static int parse_config_v2(FILE *f, char *line, size_t *line_bufsz, struct lxc_c
 
                                cur_rule_arch = lxc_seccomp_arch_s390x;
                        }
+#endif
+#ifdef SCMP_ARCH_S390
+                       else if (strcmp(line, "[s390]") == 0 ||
+                               strcmp(line, "[S390]") == 0) {
+                               if (native_arch != lxc_seccomp_arch_s390) {
+                                       cur_rule_arch = lxc_seccomp_arch_unknown;
+                                       continue;
+                               }
+
+                               cur_rule_arch = lxc_seccomp_arch_s390;
+                       }
 #endif
                        else {
                                goto bad_arch;