Skip to content

Close most of the Linux gaps go-stdtest finds - #366

Merged
progrium merged 1 commit into
mainfrom
claude/project-thread-8ryngg
Nov 28, 2026
Merged

progrium merged 1 commit into
mainfrom
claude/project-thread-8ryngg

Conversation

@progrium

Copy link
Copy Markdown
Owner

Requested by Jeff · project thread

zig build go-stdtest -Doptimize=ReleaseSafe failed on h9-linux-amd and h9-mac. The cause wasn't KVM or HVF, and it wasn't a regression. go-stdtest runs on hcpu, and the skip list that PR 348 emptied only ever held tests that stop a whole package. Every other failure was counted and left in the output. The failing tests were the same on both hosts and in a Linux container: 9 in syscall, 36 top-level tests in os, and 1 or 2 in runtime. With this PR, 1, 4, and 2 fail, and the 2 in runtime are timing tests that flake under load.

syscall and runtime

  • setrlimit and prlimit64 keep limits per thread group (Group.rlims). A fork inherits them, and execve keeps them. prlimit reaches another process by pid through a new Host.prlimitOf. Before this, setrlimit did nothing, and prlimit on another pid was EPERM.
  • mincore reports mapped pages as resident, with Linux's EINVAL and ENOMEM. It used to be ENOSYS.
  • faccessat2 checks its flags, and access checks its mode.
  • capget answers for root, and capset succeeds. prctl keeps PR_SET_KEEPCAPS per thread, and execve clears it.
  • clone3 with CLONE_NEWTIME is EPERM, like the other namespaces.
  • recvmsg sets MSG_CMSG_CLOEXEC in msg_flags when the caller asks for it.
  • /dev/tty is ENXIO when there's no pty and the console isn't a terminal, so the program sees no controlling terminal. This changes behavior for runs whose console isn't a tty.

os

  • getcwd of a path of 4096 bytes or more is ENAMETOOLONG. It used to cut the path short silently.
  • In the overlay, utimensat sets the access time, and a file in the overlay itself keeps both times' nanoseconds (Node.atimens and mtimens, through a new ovsetattr). A write or truncate still sets whole seconds.
  • fchmodat2 is served. chown, lchown, and fchownat now fail where the walk to the name fails, instead of always succeeding.
  • A path that ends in / or /. follows a link at its end, even for lstat and lchown, and has to name a directory. A link target that ends in / and resolves to a file is ENOTDIR (followlink in chan.zig).
  • A name longer than NAME_MAX is ENAMETOOLONG. rename of . or .. is EBUSY. rmdir of . is EINVAL, rmdir of .. is ENOTEMPTY, and rmdir through a file is ENOTDIR.
  • An O_CREAT open of a dangling link creates the link's target. A directory opened without O_DIRECTORY reads as EISDIR.
  • A link of a symbolic link makes a new link with the same target. The overlay's copy used to take the target's contents instead.
  • epoll_ctl refuses a file or directory in a host tree or an overlay with EPERM, the way Linux refuses a regular file. Go's poller then does blocking I/O on it.

Still failing

  • TestHardLink and TestLongPath: the overlay copies a file on link instead of linking it, by design.
  • TestRootRenameAfterOpen: an *at call names its dirfd by path.
  • TestMkdirStickyUmask: there's no sticky bit.
  • TestSCMCredentials: a zero-length datagram isn't sent.

Threads sharing the working directory, which TestProgWideChdir checks, came in through #363.

There are two new [linux-personality] cases, rlimits and path_edges, and spec/abi-linux.md describes the changes.


Generated by Claude Code

go-stdtest runs Go's time, syscall, os, and runtime tests on hcpu, and
failed 9, 36, and 1 to 2 top-level tests on every host. These were gaps
in the Linux personality, not hypervisor bugs or regressions: the skip
list PR 348 emptied only ever held tests that stop a whole package.
Now 1, 4, and 2 fail (the 2 in runtime are timing tests that flake under
load).

syscall and runtime:
- setrlimit and prlimit64 keep limits per thread group (Group.rlims),
  inherited by fork and kept by execve, and prlimit reaches another
  process by pid (Host.prlimitOf). setrlimit was a no-op and prlimit on
  another pid was EPERM (TestPrlimitFileLimit, TestPrlimitOtherProcess).
- mincore reports mapped pages resident, with EINVAL and ENOMEM as
  Linux's (TestMincoreErrorSign); it was ENOSYS.
- faccessat2 checks its flags, and access its mode (TestFaccessat).
- capget answers for root, capset succeeds, and prctl keeps
  PR_SET_KEEPCAPS per thread (TestAllThreadsSyscall*).
- clone3 with CLONE_NEWTIME is EPERM, as the other namespaces are
  (TestCloneTimeNamespace now skips).
- recvmsg sets MSG_CMSG_CLOEXEC in msg_flags when asked, as Linux does.
- /dev/tty is ENXIO with no pty and a console that isn't a terminal,
  so programs see no controlling terminal (TestForeground skips).

os:
- getcwd of a path of 4096 bytes or more is ENAMETOOLONG; it was cut
  short, and Go's Getwd trusted it (TestGetwdDeep*).
- overlay: utimensat sets the access time, and an overlay's own file
  keeps both times' nanoseconds (Node.atimens, mtimens, ovsetattr), as
  the union's member does (TestChtimes*, TestRootChtimes).
- fchmodat2 is served (TestRootChmod); chown, lchown, and fchownat fail
  where the walk does instead of always succeeding.
- A path ending in / or /. follows a link at its end even for lstat and
  lchown and has to be a directory, and a link target ending in / is
  ENOTDIR on a file (followlink), as on Linux
  (TestSymlinkWithTrailingSlash, TestRootConsistency*).
- A name over NAME_MAX is ENAMETOOLONG; rename of . or .. is EBUSY;
  rmdir of . is EINVAL and of .. ENOTEMPTY; rmdir through a file is
  ENOTDIR; an O_CREAT open of a dangling link creates its target; a
  directory opened without O_DIRECTORY reads as EISDIR; and a link of
  a symbolic link is a new link with its target, where the overlay's
  copy took the target's contents (TestRoot*).
- epoll_ctl refuses a file or directory in a host tree or an overlay
  with EPERM, as Linux does a regular file, so Go's poller does
  blocking I/O and SetDeadline is ErrNoDeadline (TestNonpollableDeadline).

Still failing: TestHardLink and TestLongPath (the overlay copies on
link, by design), TestRootRenameAfterOpen (an *at call names its dirfd
by path), TestMkdirStickyUmask (no sticky bit), and TestSCMCredentials
(a zero-length datagram isn't sent).

Two [linux-personality] cases, rlimits and path_edges, cover these,
and spec/abi-linux.md says what changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LLcnT2gLNBWB16tLexq4N6
@progrium progrium self-assigned this Nov 28, 2026

Copy link
Copy Markdown
Owner Author

Test results, from a Linux amd64 container on hcpu with a ReleaseSafe build. The container has no KVM.

  • go-stdtest (zig build go-stdtest -Doptimize=ReleaseSafe): time passes. syscall has 1 failure (TestSCMCredentials). os has 4 (TestHardLink, TestLongPath, TestRootRenameAfterOpen, and TestMkdirStickyUmask). runtime has 2 (TestDebugLogInterleaving and TestRuntimeLockMetricsAndProfile), both timing tests. Before this PR, the same build failed 9, 36, and 1 to 2 top-level tests, the same counts the AWS hosts showed.
  • Unit tests (zig build test): pass.
  • Integration, run on hcpu with the amd64 ISO root and filtered to cases matching linux, file-interface, mounts, overlay, and go: 266 passed, 17 skipped, and 2 failed.
    • The [linux-net] epoll_rearm case failed once and passed on its rerun.
    • The [websocket-9p] HTTP_PROXY case fails here and on rerun. That's most likely this container's own proxy environment, since the change doesn't touch the host's websocket client. A host run should confirm it.
    • The two new cases, rlimits and path_edges, pass.

Still to check: go-stdtest and the KVM, HVF, WHP, and sud integration on the AWS hosts, and the arm64 and 386 roots. The /dev/tty change gives ENXIO when there's no pty and the console isn't a terminal. Programs that write prompts to /dev/tty in a run without a terminal will now see that error, as they would on Linux.


Generated by Claude Code

@progrium
progrium merged commit a32cb24 into main Nov 28, 2026
13 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.

2 participants