Skip to content

Implement PROC_THREAD_ATTRIBUTE_LIST for handle inheritance#852

Open
tgauth wants to merge 5 commits into
PowerShell:latestw_allfrom
tgauth:restrict-spawn-handle-inheritance
Open

Implement PROC_THREAD_ATTRIBUTE_LIST for handle inheritance#852
tgauth wants to merge 5 commits into
PowerShell:latestw_allfrom
tgauth:restrict-spawn-handle-inheritance

Conversation

@tgauth
Copy link
Copy Markdown
Collaborator

@tgauth tgauth commented May 19, 2026

PR Summary

  • utilize PROC_THREAD_ATTRIBUTE_LIST to make inherited handles explicit (STDIO + auxiliary handles)

PR Context

  • prevent any future changes from implicitly adding inherited handles

Copilot AI review requested due to automatic review settings May 19, 2026 19:01
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Replaces the implicit inherit-all-handles behavior of CreateProcess/CreateProcessAsUser calls in posix_spawn_internal with an explicit allow-list using PROC_THREAD_ATTRIBUTE_HANDLE_LIST, so only the intended stdio and auxiliary handles are inherited by spawned children.

Changes:

  • Added build_inherit_handle_attr_list() helper that constructs and initializes a PROC_THREAD_ATTRIBUTE_LIST for a given handle set.
  • Refactored spawn_child_internal() to accept a caller-owned STARTUPINFOEXW* instead of individual stdio handles + internal STARTUPINFOW.
  • Updated posix_spawn_internal() to build the inherit list (stdio + aux fds), set EXTENDED_STARTUPINFO_PRESENT, and clean up the attribute list, with a fall-back to default inheritance if attribute-list setup fails.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread contrib/win32/win32compat/w32fd.c
Comment thread contrib/win32/win32compat/w32fd.c Outdated
Comment thread contrib/win32/win32compat/w32fd.c Outdated
tgauth and others added 2 commits May 19, 2026 16:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tgauth tgauth requested a review from Copilot May 19, 2026 20:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.

Comment thread contrib/win32/win32compat/w32fd.c Outdated
Comment thread contrib/win32/win32compat/w32fd.c
Comment thread contrib/win32/win32compat/w32fd.c
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@tgauth
Copy link
Copy Markdown
Collaborator Author

tgauth commented May 19, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@tgauth tgauth requested review from TravisEz13 and vthiebaut10 May 19, 2026 20:54
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.

2 participants