@@ -58,6 +58,14 @@ 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+ // TODO: If loongarch support is not fully merged, at some point we will want to remove this.
62+ #ifndef AUDIT_ARCH_LOONGARCH64
63+ #ifndef EM_LOONGARCH
64+ #define EM_LOONGARCH 258
65+ #endif
66+ #define AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
67+ #endif
68+
6169// We use the AUDIT_ARCH_* values because those are the ones used by the kernel
6270// and SCMP_ARCH_* sometimes has fake values (such as SCMP_ARCH_X32). But we
6371// use <seccomp.h> so we get libseccomp's fallback definitions of AUDIT_ARCH_*.
@@ -78,6 +86,7 @@ const uint32_t C_AUDIT_ARCH_PPC64LE = AUDIT_ARCH_PPC64LE;
7886const uint32_t C_AUDIT_ARCH_S390 = AUDIT_ARCH_S390;
7987const uint32_t C_AUDIT_ARCH_S390X = AUDIT_ARCH_S390X;
8088const uint32_t C_AUDIT_ARCH_RISCV64 = AUDIT_ARCH_RISCV64;
89+ const uint32_t C_AUDIT_ARCH_LOONGARCH64 = AUDIT_ARCH_LOONGARCH64; //nolint:godot // C code, not Go comment.
8190*/
8291import "C"
8392
@@ -217,6 +226,8 @@ func scmpArchToAuditArch(arch libseccomp.ScmpArch) (linuxAuditArch, error) {
217226 return linuxAuditArch (C .C_AUDIT_ARCH_S390X ), nil
218227 case libseccomp .ArchRISCV64 :
219228 return linuxAuditArch (C .C_AUDIT_ARCH_RISCV64 ), nil
229+ case libseccomp .ArchLOONGARCH64 :
230+ return linuxAuditArch (C .C_AUDIT_ARCH_LOONGARCH64 ), nil
220231 default :
221232 return invalidArch , fmt .Errorf ("unknown architecture: %v" , arch )
222233 }
0 commit comments