Skip to content

Conversation

zhaixiaojuan
Copy link
Contributor

When running the runc test, an error message is reported: "enosys_linux_test.go:179: unknown libseccomp architecture "loong64": could convert unrecognized string "loong64"". After checking, it was found that the error was caused by the missing "loong64" in the seccomp.go file.

@LocutusOfBorg
Copy link

this is already merged in main

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH the official Go name is loong64. Hmm.

@kolyshkin
Copy link
Contributor

OTOH the official Go name is loong64. Hmm.

It doesn't matter, really. Say GOARCH is amd64 while seccomp's name is x86_64.

@kolyshkin kolyshkin closed this Feb 10, 2025
@kolyshkin
Copy link
Contributor

IOW, this library should support the same names as libseccomp.

@zhaixiaojuan
Copy link
Contributor Author

OTOH the official Go name is loong64. Hmm.

It doesn't matter, really. Say GOARCH is amd64 while seccomp's name is x86_64.

As you said, GOARCH is amd64, and the name of seccomp is x86_64, so in libseccomp-golang/seccomp.go(https://github.com/seccomp/libseccomp-golang/blob/main/seccomp.go), the case branch adds x86_64 and amd64 to solve the name inconsistency problem:

`
switch strings.ToLower(arch) {
case "x86":
return ArchX86, nil
case "amd64", "x86-64", "x86_64", "x64":
return ArchAMD64, nil

`

For LoongArch, GOARCH is loong64 and seccomp is loongarch64. Similarly, we should include loong64 and loongarch64 in the case branch to solve the name inconsistency problem, runc is a good example, and this problem has blocked the runc test build upstream of debian.

@zhaixiaojuan
Copy link
Contributor Author

this is already merged in main

Currently only loongarch64 is included, loong64 is missing:
case "loongarch64": return ArchLOONGARCH64, nil

For this problem, the relevant patch has been merged into Debian in advance(https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095452).

@zhaixiaojuan
Copy link
Contributor Author

@kolyshkin
Hi, is there any latest progress on this issue?

@zhaixiaojuan
Copy link
Contributor Author

@kolyshkin
Hi, I still hope that this problem can be fixed here, not just in the Debian upstream community.
The code for fixing it in Debian upstream is as follows:

 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)
 	}

Detailed patch link address:
https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1095322;filename=golang-github-seccomp-libseccomp-golang-add-loongarch64-support.patch;msg=5

@kolyshkin
Copy link
Contributor

@zhaixiaojuan please sign your commit.

Yes, I think GetArchFromString can and should recognize GOARCH values.

@kolyshkin kolyshkin added this to the v0.11.1 milestone May 15, 2025
@kolyshkin
Copy link
Contributor

We'll release v0.11.1 once this is merged.

Signed-off-by: zhaixiaojuan <zhaixiaojuan@loongson.cn>
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@kolyshkin kolyshkin merged commit f14c30b into seccomp:main May 19, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants