Skip to content

Commit c3863dd

Browse files
committed
seccomp: support 32-bit arm on arm64, and 32-bit ppc on ppc64
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
1 parent 1143879 commit c3863dd

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/lxc/seccomp.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,20 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
300300
default_policy_action);
301301
if (!compat_ctx)
302302
goto bad;
303+
} else if (native_arch == lxc_seccomp_arch_ppc64) {
304+
cur_rule_arch = lxc_seccomp_arch_all;
305+
compat_arch = SCMP_ARCH_PPC;
306+
compat_ctx = get_new_ctx(lxc_seccomp_arch_ppc,
307+
default_policy_action);
308+
if (!compat_ctx)
309+
goto bad;
310+
} else if (native_arch == lxc_seccomp_arch_arm64) {
311+
cur_rule_arch = lxc_seccomp_arch_all;
312+
compat_arch = SCMP_ARCH_ARM;
313+
compat_ctx = get_new_ctx(lxc_seccomp_arch_arm,
314+
default_policy_action);
315+
if (!compat_ctx)
316+
goto bad;
303317
}
304318

305319
if (default_policy_action != SCMP_ACT_KILL) {
@@ -327,7 +341,7 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
327341
if (strcmp(line, "[x86]") == 0 ||
328342
strcmp(line, "[X86]") == 0) {
329343
if (native_arch != lxc_seccomp_arch_i386 &&
330-
native_arch != lxc_seccomp_arch_amd64) {
344+
native_arch != lxc_seccomp_arch_amd64) {
331345
cur_rule_arch = lxc_seccomp_arch_unknown;
332346
continue;
333347
}
@@ -346,7 +360,8 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
346360
#ifdef SCMP_ARCH_ARM
347361
else if (strcmp(line, "[arm]") == 0 ||
348362
strcmp(line, "[ARM]") == 0) {
349-
if (native_arch != lxc_seccomp_arch_arm) {
363+
if (native_arch != lxc_seccomp_arch_arm &&
364+
native_arch != lxc_seccomp_arch_arm64) {
350365
cur_rule_arch = lxc_seccomp_arch_unknown;
351366
continue;
352367
}
@@ -386,7 +401,8 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
386401
#ifdef SCMP_ARCH_PPC
387402
else if (strcmp(line, "[ppc]") == 0 ||
388403
strcmp(line, "[PPC]") == 0) {
389-
if (native_arch != lxc_seccomp_arch_ppc) {
404+
if (native_arch != lxc_seccomp_arch_ppc &&
405+
native_arch != lxc_seccomp_arch_ppc64) {
390406
cur_rule_arch = lxc_seccomp_arch_unknown;
391407
continue;
392408
}
@@ -435,7 +451,7 @@ static int parse_config_v2(FILE *f, char *line, struct lxc_conf *conf)
435451
if (compat_ctx) {
436452
INFO("Merging in the compat seccomp ctx into the main one");
437453
if (seccomp_merge(conf->seccomp_ctx, compat_ctx) != 0) {
438-
ERROR("Error merging i386 seccomp contexts");
454+
ERROR("Error merging compat seccomp contexts");
439455
goto bad;
440456
}
441457
}

0 commit comments

Comments
 (0)