Repository navigation
Conversation
10 tasks done
This was referenced Oct 13, 2026
Gashrod1
force-pushed
the
fix/libkernel-write-oversized-einval
branch
from
October 13, 2026 08:40
fbbab5e to
9bab0e0
Compare
CnRJay
reviewed
Oct 14, 2026
CnRJay
left a comment
Contributor
There was a problem hiding this comment.
The change matches FreeBSD's sys_write. Note that #4929 makes the same size < 0 → EINVAL change in write_nid_postfix (as part of a three-call fix in Stdio.cpp), so the two will conflict on that line. Agreeing with its author which one carries it, and listing it under Depends on, would save a rebase. Your test of SSIZE_MAX + 1 on descriptor -1 (EINVAL before EBADF) is a case #4929 doesn't cover, so it's worth keeping either way.
Collaborator
|
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line. |
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.
What
write_nid_postfixthrewstd::invalid_argumentwhen the byte count did not fit inssize_t, which ends the process. FreeBSD'ssys_writereturns EINVAL for it before looking up the descriptor (sys/kern/sys_generic.c:if (uap->nbyte > IOSIZE_MAX) return (EINVAL);, whereIOSIZE_MAXisSSIZE_MAXwith the defaultdebug.iosize_max_clamp=0).writenow returns -1 with errno 22 for such a count, for any descriptor.guest_filesystemcheckswritewithSIZE_MAXon a pipe and withSSIZE_MAX + 1on descriptor -1 (EINVAL, not EBADF). It fails onmainand passes with the change.Tested
Linux (Arch, GCC), Release,
BUILD_TESTING=ON, based onmainee4962190:guest_filesystemaborts onmainand passes with the change (3 runs); full build and fullctestpass. Windows (WinLibs MinGW-w64 GCC 15.2.0 r7, NVIDIA RTX 5060), Release,BUILD_TESTING=ON: full build and fullctestpass (1018 tests, the same 7 skipped as onmain). No title or homebrew run.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)