From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7868) id 81D393858405; Mon, 18 Apr 2022 12:02:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81D393858405 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Takashi Yano To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/cygwin-3_3-branch] Cygwin: pty: Do not set internal handles in HPCON inheritable. X-Act-Checkin: newlib-cygwin X-Git-Author: Takashi Yano X-Git-Refname: refs/heads/cygwin-3_3-branch X-Git-Oldrev: 7ed6d0249f1f06bb42b13587598fbbb30cf81a82 X-Git-Newrev: 8b9e3ac4080bf34f7b0a6122741ff2f8db810522 Message-Id: <20220418120246.81D393858405@sourceware.org> Date: Mon, 18 Apr 2022 12:02:46 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2022 12:02:46 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D8b9e3ac4080= bf34f7b0a6122741ff2f8db810522 commit 8b9e3ac4080bf34f7b0a6122741ff2f8db810522 Author: Takashi Yano Date: Mon Apr 11 10:54:44 2022 +0900 Cygwin: pty: Do not set internal handles in HPCON inheritable. =20 - The internal handles in HPCON should not be inheritable, however, the current code duplicates them as inheritable when handing over ownership of the pseudo console. This patch fixes the issue. =20 Addresses: https://cygwin.com/pipermail/cygwin/2022-April/251222.html Diff: --- winsup/cygwin/fhandler_tty.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 36992324d..c91f40044 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -2122,7 +2122,7 @@ fhandler_pty_common::resize_pseudo_console (struct wi= nsize *ws) OpenProcess (PROCESS_DUP_HANDLE, FALSE, get_ttyp ()->pcon_pid); DuplicateHandle (pcon_owner, get_ttyp ()->h_pcon_write_pipe, GetCurrentProcess (), &hpcon_local.hWritePipe, - 0, TRUE, DUPLICATE_SAME_ACCESS); + 0, FALSE, DUPLICATE_SAME_ACCESS); acquire_attach_mutex (mutex_timeout); ResizePseudoConsole ((HPCON) &hpcon_local, size); release_attach_mutex (); @@ -3600,15 +3600,15 @@ fhandler_pty_slave::close_pseudoconsole (tty *ttyp,= DWORD force_switch_to) DuplicateHandle (GetCurrentProcess (), ttyp->h_pcon_write_pipe, new_owner, &new_write_pipe, - 0, TRUE, DUPLICATE_SAME_ACCESS); + 0, FALSE, DUPLICATE_SAME_ACCESS); DuplicateHandle (GetCurrentProcess (), ttyp->h_pcon_condrv_reference, new_owner, &new_condrv_reference, - 0, TRUE, DUPLICATE_SAME_ACCESS); + 0, FALSE, DUPLICATE_SAME_ACCESS); DuplicateHandle (GetCurrentProcess (), ttyp->h_pcon_conhost_process, new_owner, &new_conhost_process, - 0, TRUE, DUPLICATE_SAME_ACCESS); + 0, FALSE, DUPLICATE_SAME_ACCESS); DuplicateHandle (GetCurrentProcess (), ttyp->h_pcon_in, new_owner, &new_pcon_in, 0, TRUE, DUPLICATE_SAME_ACCESS);