Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SYS_sendmmsg in wrap_scope_syscall - 1586 #1589

Merged
merged 5 commits into from
Jul 18, 2023

Conversation

michalbiesek
Copy link
Contributor

Ref #1586

@michalbiesek michalbiesek linked an issue Jul 14, 2023 that may be closed by this pull request
@michalbiesek michalbiesek force-pushed the fix-1586-syscall-sendmmsg-support branch from 9f83735 to 05f5cee Compare July 14, 2023 20:35
- In the case of the `host` application [1], the `host` app uses
 `libuv` to perform the DNS lookup.

- `uv__udp_sendmsg` uses the `syscall` to perform the sending message operation.
  The decision of whether to use `syscall` or `sendmsg` is based on checking the value of the
  `uv__sendmmsg_avail` variable in `uv__udp_sendmsg` [2].

- `uv__udp_recvmsg` uses `recvmsg` to perform the receiving message operation.
  The decision of whether to use `syscall` or `recvmsg` is based on checking the result
  of `uv_udp_using_recvmmsg` [3].

- The above explains why `libuv` uses `syscall` for sending messages and `recvmsg` for receiving messages.

- Additionally `libuv` check support for `recvmmsg()` and `sendmmsg()` using
  `uv__udp_mmsg_init` with calling `uv__sendmmsg(s, NULL, 0, 0)` [4]

The stack traces for the and `uv__udp_sendmsg` and `uv__udp_recvmsg`:

```
[#0] syscall()
[#1] uv__sendmmsg(...)
[#2] uv__udp_sendmmsg(..)
[#3] uv__udp_sendmsg(...)
[#4] uv__udp_send(...)
[#5] uv_udp_send(...)
```

```
[#0] recvmsg
[#1] uv__udp_recvmsg
```

Ref:
[1] https://github.com/isc-projects/bind9
[2] libuv/libuv@3d71366
[3] libuv/libuv@6b5aa66
[4] libuv/libuv@3d71366

Closes: #1586
@michalbiesek michalbiesek force-pushed the fix-1586-syscall-sendmmsg-support branch from 05f5cee to eeb8ff4 Compare July 15, 2023 16:23
The application can use empty values to check if
the `sendmmsg` or `recvmmsg` are supported

Ref: libuv/libuv@3d71366
- ensure that we will not process `msg` as NULL
@michalbiesek michalbiesek force-pushed the fix-1586-syscall-sendmmsg-support branch from eeb8ff4 to d1f7f5c Compare July 15, 2023 22:22
msg_modify->msg_iovlen &= 0xFFFFFFFF;
msg_controllen_orig = msg->msg_controllen;
msg_modify->msg_controllen &= 0xFFFFFFFF;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these tabs and not spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are spaces. The GitHub diff view is indicating that indentation was changed.

@michalbiesek michalbiesek merged commit 53a346a into master Jul 18, 2023
110 checks passed
@michalbiesek michalbiesek deleted the fix-1586-syscall-sendmmsg-support branch July 18, 2023 15:34
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.

[Bug]: Missing payload (request) using host app
2 participants