Repository navigation
Conversation
A guest recv on a non-blocking socket raised BlockingIOError out of the syscall handler and aborted emulation. Translate that condition to -EAGAIN, as a real kernel does, and add a regression test. Fixes qilingframework#1373
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.
Summary
ql_syscall_recvletBlockingIOErrorescape the syscall handler when a guest calledrecvon a non-blocking socket with no data pending. The guest emulation was then aborted instead of receiving-EAGAIN, which is what a real kernel returns.This PR catches that condition in the syscall wrapper and returns
-EAGAIN, and adds a regression test.Fixes #1373.
Test
Added
tests/test_socket.py::SocketTest::test_recv_on_nonblocking_socket_returns_eagain:ql_syscall_recvwith no data queuedBefore the fix the test fails with the reported
BlockingIOError. After the fix it passes with the return value-EAGAIN.Local run (Windows 11, CPython 3.11.9, Unicorn 2.1.3):
The test module is also imported from
tests/test_posix.py, so it runs as part of the Linux test suite.Not verified
recvis covered here.recvfrom/recvmsgwere not changed.Related: open PR #1676 also touches errno handling in
socket.py. This change is independent, but a trivial import rebase may be needed if #1676 merges first.Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing