Closed
Conversation
The uname(3) syscall is utilized by zlib-ng on RISC-V to decide whether the kernel handles VILL bit of V extension properly (by checking the kernel version against 6.5). Allow it in the seccomp sandbox. Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
ziyao233
added a commit
to ziyao233/zlib-ng
that referenced
this pull request
Nov 8, 2025
Previously, RVV/Zbc is used when - Linux kernel version (detected by uname(2)) is greater or equal to 6.5, and HWCAP claims support for such extension, or - Linux kernel version is less than 6.5, but compiler claims support for the extension and for RVV, we additionally check whether it's (the earlier, draft) v0.7.1 release or the (the later, ratified) v1.0 release. Zlib-ng only supports v1.0. This strategy is problematic in several aspects, - Fallback to compile-time constants with Linux kernel earlier than 6.5 makes it hard for distributions to ship the same binary for different machines with different kernel versions. - Detecting Linux kernel version through uname(2) could violate sandbox enforcement[1]. And since RVV introduces special vector registers, RVV usage in userspace relies on the kernel to implement proper context switching, which is only present since Linux kernel 6.5, which is also the version when COMPAT_HWCAP_ISA_V was introduced. This makes it reasonable to only do HWCAP-based extension detection for RVV. The additional check for RVV version is also unnecessary since in mainline Linux kernel, COMPAT_HWCAP_ISA_V is only set when a ratified v1.0 implementation of RVV is present. A downstream kernel claiming COMPAT_HWCAP_ISA_V with a v0.7.1 RVV implementation breaks the kABI, and userspace shouldn't pay for the mistake. This patch removes extra detection logic, now RVV is and only is used when the kernel claims COMPAT_HWCAP_ISA_V. The detection logic of Zbc checks an undefined HWCAP bit, thus doesn't detect Zbc correctly with any current Linux kernel, which should be fixed with another patch. Fixes: 6ff8b52 ("Support RVV hwcap detect at runtime") Link: openssh/openssh-portable#605 # [1] Closes: zlib-ng#1705 Closes: zlib-ng#1769 Signed-off-by: Yao Zi <ziyao@disroot.org>
Contributor
|
Merged as ec41739 - thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The uname(3) syscall is utilized by zlib-ng on RISC-V to decide whether the kernel handles VILL bit of V extension properly (by checking the kernel version against 6.5).
Allow it in the seccomp sandbox.