Skip to content

Update syscall to start loong64 support#3765

Closed
zhaixiaojuan wants to merge 4 commits intoopencontainers:mainfrom
zhaixiaojuan:main
Closed

Update syscall to start loong64 support#3765
zhaixiaojuan wants to merge 4 commits intoopencontainers:mainfrom
zhaixiaojuan:main

Conversation

@zhaixiaojuan
Copy link
Copy Markdown
Contributor

The LoongArch architecture (LoongArch) is an Instruction Set Architecture (ISA) that has a RISC style.
Documentations:
ISA:
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
ABI:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
More docs can be found at:
https://loongson.github.io/LoongArch-Documentation/README-EN.html

// +build linux
// +build arm64 amd64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x
// +build arm64 amd64 loong64 mips mipsle mips64 mips64le ppc ppc64 ppc64le riscv64 s390x

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seccomp needs to be updated too

"SCMP_ARCH_RISCV64": "riscv64",

const uint32_t C_AUDIT_ARCH_RISCV64 = AUDIT_ARCH_RISCV64;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

...and libseccomp-golang needs to be updated as well (see seccomp/libseccomp-golang#106)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

...and libseccomp-golang needs to be updated as well (see seccomp/libseccomp-golang#106)

Sorry, I didn't know that you had submitted a PR before submitting the PR (seccomp/libseccomp-golang#107), but there are some differences in the submitted code, please review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

seccomp needs to be updated too

"SCMP_ARCH_RISCV64": "riscv64",

const uint32_t C_AUDIT_ARCH_RISCV64 = AUDIT_ARCH_RISCV64;

I have updated it, please check

@kolyshkin kolyshkin marked this pull request as draft March 10, 2023 22:12
@kolyshkin
Copy link
Copy Markdown
Contributor

Let's wait until runc dependencies have loong64 supported. That includes:

  • golang (I think it is supported already)
  • x/sys/unix
  • libseccomp (not in a released version)
  • libseccomp-golang
  • what else?

Once all that is ready and released, we can add the support. Doing it earlier doesn't make much practical sense.

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

@kolyshkin
Hi kolyshkin, Could you consider merging this PR(seccomp/libseccomp-golang#106) ?

algitbot pushed a commit to alpinelinux/aports that referenced this pull request May 8, 2024
@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

Let's wait until runc dependencies have loong64 supported. That includes:

  • golang (I think it is supported already)
  • x/sys/unix
  • libseccomp (not in a released version)
  • libseccomp-golang
  • what else?

Once all that is ready and released, we can add the support. Doing it earlier doesn't make much practical sense.
@kolyshkin
Currently, all these dependencies have been met. I have reorganized the patch according to the latest code. Could you merge this PR?

@kolyshkin
Copy link
Copy Markdown
Contributor

Let's wait until runc dependencies have loong64 supported. That includes:

  • golang (I think it is supported already)
  • x/sys/unix
  • libseccomp (not in a released version)
  • libseccomp-golang
  • what else?

Once all that is ready and released, we can add the support. Doing it earlier doesn't make much practical sense.

@kolyshkin
Currently, all these dependencies have been met. I have reorganized the patch according to the latest code. Could you merge this PR?

From the list above, libseccomp was just released last month, and I'm working on libseccomp-golang right now (see seccomp/libseccomp-golang#117). Once libseccomp-golang is released, we can get this out of draft. For now, you can help reviewing commits in there.

@kolyshkin
Copy link
Copy Markdown
Contributor

libseccomp-golang v0.11.0 is out! @zhaixiaojuan PTAL

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

@AkihiroSuda @kolyshkin 
Hi, Currently, all the dependencies are met. Can this PR be reopened and considered for merging?

@AkihiroSuda
Copy link
Copy Markdown
Member

Needs rebase, LGTM after that

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

@kolyshkin @AkihiroSuda
Hi, I checked the errors in running tests in current ci:

=== RUN   TestEnosysStub_MultiArch
    enosys_linux_test.go:171: unknown libseccomp architecture "loong64": cannot convert unrecognized string "loong64"
--- FAIL: TestEnosysStub_MultiArch (0.00s)

This error is the same as seccomp/libseccomp-golang#112 need to add loong64 in the case statement of the libseccomp-golang/seccomp.go file:

func GetArchFromString(arch string) (ScmpArch, error) {
	if err := ensureSupportedVersion(); err != nil {
		return ArchInvalid, err
	}

	switch strings.ToLower(arch) {
	case "x86":
		return ArchX86, nil
	case "amd64", "x86-64", "x86_64", "x64":
		return ArchAMD64, nil
        ......
    -   case “loongarch64”:
    +   case "loong64", "loongarch64":

In addition, the relevant patches for this problem have been merged into the Debian community in advance.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

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

@kolyshkin
Hi, Is there any progress on this issue? Can this patch(seccomp/libseccomp-golang#112) be considered for merging?

=== RUN   TestEnosysStub_MultiArch
    enosys_linux_test.go:171: unknown libseccomp architecture "loong64": cannot convert unrecognized string "loong64"
--- FAIL: TestEnosysStub_MultiArch (0.00s)

@kolyshkin
Copy link
Copy Markdown
Contributor

@zhaixiaojuan I've released https://github.com/seccomp/libseccomp-golang/releases/tag/v0.11.1 so this can be updated now.

@kolyshkin
Copy link
Copy Markdown
Contributor

@zhaixiaojuan I've released https://github.com/seccomp/libseccomp-golang/releases/tag/v0.11.1 so this can be updated now.

And the bump PR (#4839) is now merged

Signed-off-by: zhaixiaojuan <67671683+zhaixiaojuan@users.noreply.github.com>
@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

@zhaixiaojuan I've released https://github.com/seccomp/libseccomp-golang/releases/tag/v0.11.1 so this can be updated now.

And the bump PR (#4839) is now merged

@kolyshkin Thank you very much, I will rebase this PR

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

@AkihiroSuda
Hi, I checked the latest error message:

=== RUN TestEnosysStub_SingleArch/arch=x86/action=log [2040](https://github.com/opencontainers/runc/pull/3765#step:15:2041) enosys_linux_test.go:190: unknown syscall "setns" on arch "loong64": architecture loong64 is not supported on this version of the library [2041](https://github.com/opencontainers/runc/pull/3765#step:15:2042)

=== RUN TestEnosysStub_SingleArch/arch=x86/action=errno [2042](https://github.com/opencontainers/runc/pull/3765#step:15:2043) enosys_linux_test.go:190: unknown syscall "setns" on arch "loong64": architecture loong64 is not supported on this version of the library

I've confirmed that this error is caused by the libseccomp used in the test environment not supporting the loongarch64 architecture. Currently, support for loongarch64 is available at http://ftp.ports.debian.org/debian-ports/pool-loong64/main/libs/libseccomp/ .

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

=== RUN TestEnosysStub_SingleArch/arch=x86/action=log [2040](https://github.com/opencontainers/runc/pull/3765#step:15:2041) enosys_linux_test.go:190: unknown syscall "setns" on arch "loong64": architecture loong64 is not supported on this version of the library [2041](https://github.com/opencontainers/runc/pull/3765#step:15:2042)

=== RUN TestEnosysStub_SingleArch/arch=x86/action=errno [2042](https://github.com/opencontainers/runc/pull/3765#step:15:2043) enosys_linux_test.go:190: unknown syscall "setns" on arch "loong64": architecture loong64 is not supported on this version of the library

I've confirmed that this error is caused by the libseccomp used in the test environment not supporting the loongarch64 architecture. Currently, support for loongarch64 is available at http://ftp.ports.debian.org/debian-ports/pool-loong64/main/libs/libseccomp/ .

@AkihiroSuda
Hi, could we provide a loongarch64 environment to resolve the above issues?
I'm also very eager to hear your other suggestions. We'll fully support and meet your needs, whether in software or hardware.

@zhaixiaojuan
Copy link
Copy Markdown
Contributor Author

Hi, is there any latest progress on this PR?

@AkihiroSuda
Copy link
Copy Markdown
Member

The CI failure has to be resolved.
The relevant test has to be skipped when the arch is not supported by the library.

@AkihiroSuda
Copy link
Copy Markdown
Member

Also please squash the commits

@zhaixiaojuan zhaixiaojuan closed this by deleting the head repository Oct 15, 2025
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