1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
Description: Add loongarch64 support.
Author: Dandan Zhang <zhangdandan@loongson.cn>
Bug-Debian: https://bugs.debian.org/1095322
---
Applied-Upstream: main, https://github.com/seccomp/libseccomp-golang
Last-Update: 2025-02-07
--- golang-github-seccomp-libseccomp-golang-0.10.0.orig/seccomp.go
+++ golang-github-seccomp-libseccomp-golang-0.10.0/seccomp.go
@@ -175,6 +175,8 @@ const (
ArchPARISC64
// ArchRISCV64 represents RISCV64
ArchRISCV64
+ // ArchLOONGARCH64 represents 64-bit LoongArch
+ ArchLOONGARCH64
)
const (
@@ -306,6 +308,8 @@ func GetArchFromString(arch string) (Scm
return ArchPARISC64, nil
case "riscv64":
return ArchRISCV64, nil
+ case "loongarch64", "loong64":
+ return ArchLOONGARCH64, nil
default:
return ArchInvalid, fmt.Errorf("cannot convert unrecognized string %q", arch)
}
@@ -352,6 +356,8 @@ func (a ScmpArch) String() string {
return "parisc64"
case ArchRISCV64:
return "riscv64"
+ case ArchLOONGARCH64:
+ return "loong64"
case ArchNative:
return "native"
case ArchInvalid:
--- golang-github-seccomp-libseccomp-golang-0.10.0.orig/seccomp_internal.go
+++ golang-github-seccomp-libseccomp-golang-0.10.0/seccomp_internal.go
@@ -68,6 +68,10 @@ const uint32_t C_ARCH_BAD = ARCH_BAD;
#define SCMP_ARCH_RISCV64 ARCH_BAD
#endif
+#ifndef SCMP_ARCH_LOONGARCH64
+#define SCMP_ARCH_LOONGARCH64 ARCH_BAD
+#endif
+
const uint32_t C_ARCH_NATIVE = SCMP_ARCH_NATIVE;
const uint32_t C_ARCH_X86 = SCMP_ARCH_X86;
const uint32_t C_ARCH_X86_64 = SCMP_ARCH_X86_64;
@@ -88,6 +92,7 @@ const uint32_t C_ARCH_S390X = SCM
const uint32_t C_ARCH_PARISC = SCMP_ARCH_PARISC;
const uint32_t C_ARCH_PARISC64 = SCMP_ARCH_PARISC64;
const uint32_t C_ARCH_RISCV64 = SCMP_ARCH_RISCV64;
+const uint32_t C_ARCH_LOONGARCH64 = SCMP_ARCH_LOONGARCH64;
#ifndef SCMP_ACT_LOG
#define SCMP_ACT_LOG 0x7ffc0000U
@@ -291,7 +296,7 @@ const (
scmpError C.int = -1
// Comparison boundaries to check for architecture validity
archStart ScmpArch = ArchNative
- archEnd ScmpArch = ArchRISCV64
+ archEnd ScmpArch = ArchLOONGARCH64
// Comparison boundaries to check for action validity
actionStart ScmpAction = ActKillThread
actionEnd ScmpAction = ActKillProcess
@@ -552,6 +557,8 @@ func archFromNative(a C.uint32_t) (ScmpA
return ArchPARISC64, nil
case C.C_ARCH_RISCV64:
return ArchRISCV64, nil
+ case C.C_ARCH_LOONGARCH64:
+ return ArchLOONGARCH64, nil
default:
return 0x0, fmt.Errorf("unrecognized architecture %#x", uint32(a))
}
@@ -598,6 +605,8 @@ func (a ScmpArch) toNative() C.uint32_t
return C.C_ARCH_PARISC64
case ArchRISCV64:
return C.C_ARCH_RISCV64
+ case ArchLOONGARCH64:
+ return C.C_ARCH_LOONGARCH64
case ArchNative:
return C.C_ARCH_NATIVE
default:
|