Skip to content

Commit dcd6c79

Browse files
committed
Add audit support for loong64
Signed-off-by: jokemanfire <[email protected]>
1 parent 17c8e80 commit dcd6c79

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libcontainer/seccomp/patchbpf/enosys_linux.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ const uintptr_t C_FILTER_FLAG_NEW_LISTENER = SECCOMP_FILTER_FLAG_NEW_LISTENER;
5858
#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
5959
#endif
6060
61+
#ifndef AUDIT_ARCH_LOONGARCH64
62+
#ifndef EM_LOONGARCH
63+
#define EM_LOONGARCH 258
64+
#endif
65+
#define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
66+
#endif
67+
6168
// We use the AUDIT_ARCH_* values because those are the ones used by the kernel
6269
// and SCMP_ARCH_* sometimes has fake values (such as SCMP_ARCH_X32). But we
6370
// use <seccomp.h> so we get libseccomp's fallback definitions of AUDIT_ARCH_*.
@@ -78,6 +85,7 @@ const uint32_t C_AUDIT_ARCH_PPC64LE = AUDIT_ARCH_PPC64LE;
7885
const uint32_t C_AUDIT_ARCH_S390 = AUDIT_ARCH_S390;
7986
const uint32_t C_AUDIT_ARCH_S390X = AUDIT_ARCH_S390X;
8087
const uint32_t C_AUDIT_ARCH_RISCV64 = AUDIT_ARCH_RISCV64;
88+
const uint32_t C_AUDIT_ARCH_LOONGARCH64 = AUDIT_ARCH_LOONGARCH64;
8189
*/
8290
import "C"
8391

@@ -217,6 +225,8 @@ func scmpArchToAuditArch(arch libseccomp.ScmpArch) (linuxAuditArch, error) {
217225
return linuxAuditArch(C.C_AUDIT_ARCH_S390X), nil
218226
case libseccomp.ArchRISCV64:
219227
return linuxAuditArch(C.C_AUDIT_ARCH_RISCV64), nil
228+
case libseccomp.ArchLOONGARCH64:
229+
return linuxAuditArch(C.C_AUDIT_ARCH_LOONGARCH64), nil
220230
default:
221231
return invalidArch, fmt.Errorf("unknown architecture: %v", arch)
222232
}

0 commit comments

Comments
 (0)