Skip to content

Sock ctrl msg#2

Closed
uran0sH wants to merge 7 commits intomainfrom
sock_ctrl_msg
Closed

Sock ctrl msg#2
uran0sH wants to merge 7 commits intomainfrom
sock_ctrl_msg

Conversation

@uran0sH
Copy link
Owner

@uran0sH uran0sH commented Jul 8, 2025

No description provided.

@uran0sH
Copy link
Owner Author

uran0sH commented Jul 8, 2025

Plz review @stefano-garzarella @germag @osteffenrh

Comment on lines 205 to 221
for fd_offset in 0..fds_count {
for fd_offset in 0..fds_to_be_copied_count {
Copy link

Choose a reason for hiding this comment

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

as I mentioned in my email, why this change?

Copy link
Owner Author

Choose a reason for hiding this comment

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

If use fds_count, the test will report an error on macos:

fatal runtime error: IO Safety violation: owned file descriptor already closed, aborting

Since the value of the fds_count is 4 on macos. But on linux, this value is 2. But my solution may be a wrong solution

Copy link

Choose a reason for hiding this comment

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

ok we need to check this

Copy link

Choose a reason for hiding this comment

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

but, this is the type of thing you must tell us (email, chat or in the meeting) instead of just making a change without any comment.

Copy link
Owner Author

@uran0sH uran0sH Jul 9, 2025

Choose a reason for hiding this comment

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

Run send_more_recv_less2 or send_more_recv_less1
On macos, cmsg.cmsg_len is 28 and CMSG_LEN(0) is 12, so the fds_count is 4.
On linux, cmsg.cmsg_len is 24 and CMSG_LEN(0) is 16, the fds_count is 2.
Run send_recv_with_fd or send_recv_only_fd:
On macos, cmsg.cmsg_len is 16 and CMSG_LEN(0) is 12
On linux, cmsg.cmsg_len is 20 and CMSG_LEN(0) is 16

@uran0sH uran0sH force-pushed the sock_ctrl_msg branch 2 times, most recently from 152a5cc to 272a92d Compare July 8, 2025 17:20
Copy link

@germag germag left a comment

Choose a reason for hiding this comment

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

just some small comments

Comment on lines 205 to 221
for fd_offset in 0..fds_count {
for fd_offset in 0..fds_to_be_copied_count {
Copy link

Choose a reason for hiding this comment

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

ok we need to check this

@uran0sH uran0sH force-pushed the sock_ctrl_msg branch 3 times, most recently from 466a3b7 to 1b720ae Compare July 10, 2025 16:52
dependabot bot and others added 7 commits July 11, 2025 13:24
Bumps [rust-vmm-ci](https://github.com/rust-vmm/rust-vmm-ci) from `c3ef897` to `aa2f8a9`.
- [Commits](rust-vmm/rust-vmm-ci@c3ef897...aa2f8a9)

---
updated-dependencies:
- dependency-name: rust-vmm-ci
  dependency-version: aa2f8a90e46533de8a58f19cd0c417de856d4437
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
Eventfd is linux-specific. In order to support macos
and others, we need to replace it with pipefd.

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
libc also provides functions with the same functionality
and supports multiple platforms, so we can replace
CMSG_*! with libc equivalent.

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
Make some modifications to sock_ctl_msg to support Unix systems.
Including adjusting the size of cmsg_len for different platforms.

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
If we use fds_count, the test will report an error on macos:

```
fatal runtime error: IO Safety violation: owned file descriptor already closed, aborting
```

When running send_more_recv_less2 or send_more_recv_less1 on macos,
cmsg.cmsg_len is 28 and CMSG_LEN(0) is 12, which cause fds_count is 4.

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
@uran0sH
Copy link
Owner Author

uran0sH commented Jul 11, 2025

See: rust-vmm#245

@uran0sH uran0sH closed this Jul 11, 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.

4 participants

Comments