Repository navigation
[EventPipe] Fix reverse connection socket leaking to child processes. - #65365
Conversation
|
@hoyosjs, current approach is that callers of eventpipe's cmake script (in coreclr and mono) provide the introspection-driven definitions. Should |
I am somewhat torn. |
|
I would actually prefer having this local configure.cmake like @hoyosjs has done here and stop including the global configured header. It seems better to keep the detection close to the component that uses it. Unless I'm missing something, there is only |
|
@janvorli I saw that too, but I couldn't find anything that checks and sets |
|
Ah, right, it is not checked for anywhere by cmake :-) It seems it is something that was inherited from autoconf. |
|
OK. One check requiring two new files, so I thought it can be pulled up in the existing config files.
I was actually looking at FEATURE_ flags used extensively in eventpipe, which we define in coreclr and mono configs. Secondly, eventpipe is not self-dependent component at all, changing the order of headers (what is included before the ep_ header on consumer side) can break the compilation. |
905d04e to
67bd13f
Compare
lateralusX
left a comment
There was a problem hiding this comment.
I think the HAVE_INTTYPES_H can probably be removed, at least on the Mono side since we already include inttypes.h without guard in glib.h that will be included on all platforms, but that change could be done in a separate PR in main after this has merged.
Mono already include most of similar HAVE_XXX checks in https://github.com/dotnet/runtime/blob/main/src/mono/cmake/config.h.in and https://github.com/dotnet/runtime/blob/main/src/mono/cmake/configure.cmake, but if we want to add a new shared EventPipe config header instead of putting this into the same place as we currently have all other platform checks, I'm fine with that too.
|
/backport to release/6.0 |
|
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1886146242 |
|
@hoyosjs backporting to release/6.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: [EventPipe] Fix reverse connection socket leaking to child processes.
.git/rebase-apply/patch:104: space before tab in indent.
client_socket = accept4 (s, address, address_len, SOCK_CLOEXEC);
.git/rebase-apply/patch:106: space before tab in indent.
client_socket = accept (s, address, address_len);
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
M src/coreclr/CMakeLists.txt
M src/coreclr/debug/debug-pal/CMakeLists.txt
M src/coreclr/vm/eventing/eventpipe/CMakeLists.txt
M src/mono/mono/eventpipe/CMakeLists.txt
M src/native/eventpipe/ds-ipc-pal-socket.c
Falling back to patching base and 3-way merge...
Auto-merging src/native/eventpipe/ds-ipc-pal-socket.c
Auto-merging src/mono/mono/eventpipe/CMakeLists.txt
CONFLICT (content): Merge conflict in src/mono/mono/eventpipe/CMakeLists.txt
Auto-merging src/coreclr/vm/eventing/eventpipe/CMakeLists.txt
Auto-merging src/coreclr/debug/debug-pal/CMakeLists.txt
Auto-merging src/coreclr/CMakeLists.txt
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 [EventPipe] Fix reverse connection socket leaking to child processes.
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
…ld processes. Sockets were getting leaked upon accepting connections. This meant that child processes could cause fully terminated tracing sessions and other IPC connections alive, causing clients to wait for input indefinitely. This sets the CLOEXEC bits on the socket atomically upon accepting if the OS provides the capability, falling back to a best effort fcntl on systems like macOS and x866 Android emulators. Port of dotnet#65365 to release/6.0.
…ld processes. (#65768) * [release/6.0][EventPipe] Fix reverse connection socket leaking to child processes. Sockets were getting leaked upon accepting connections. This meant that child processes could cause fully terminated tracing sessions and other IPC connections alive, causing clients to wait for input indefinitely. This sets the CLOEXEC bits on the socket atomically upon accepting if the OS provides the capability, falling back to a best effort fcntl on systems like macOS and x866 Android emulators. Port of #65365 to release/6.0. * Include well know cmake paths
Sockets were getting leaked upon accepting connections. This meant that child processes could cause fully terminated tracing sessions and other IPC connections alive, causing clients to wait for input indefinitely. This sets the CLOEXEC bits on the socket atomically upon accepting if the OS provides the capability, falling back to a best effort
fcntlon systems like macOS and x866 Android emulators.