Page MenuHome GnuPG

libassuan: Don't inherit handles for Windows
Open, WishlistPublic

Description

Currently, __assuan_spawn in libassuan/src/system-w32.c, handles are inherited to child process.

With newer version of Windows (> Windows XP), CreateProcessW can use EXTENDED_STARTUPINFO_PRESENT flag to specify explicit handle-list of PROC_THREAD_ATTRIBUTE_HANDLE_LIST in lpAttributeList member of STARTUPINFOEXA structure. With EXTENDED_STARTUPINFO_PRESENT flag, handles inherited can be exactly controlled.

Besides, when we can assume newer versions of Windows (>= Windows 7 SP1, Windows Server 2008 R2 SP1), we can use WSA_FLAG_NO_HANDLE_INHERIT flag when we allocate socket by WSASocketW.

This will be good for GnuPG, because scdaemon and pinentry no longer have handles of gpg-agent sockets, etc.

Event Timeline

gniibe triaged this task as Wishlist priority.Apr 7 2022, 3:57 AM
gniibe created this task.
gniibe updated the task description. (Show Details)

We once figured that we should use this for gpgme, where we use a helper to close handles. We have not yet found the time to do this and frankly "never change a running system" ;-) We also still support Windows XP SP3 with GnuPG for users with air-gaped machines. Not sure whether this is still justified, though.