public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: pty: Do not set internal handles in HPCON inheritable.
Date: Mon, 18 Apr 2022 12:03:32 +0000 (GMT)	[thread overview]
Message-ID: <20220418120332.DAE05385800E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b58b5a96601f9e7424e4cb21aa0b9b2915daa49c

commit b58b5a96601f9e7424e4cb21aa0b9b2915daa49c
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date:   Mon Apr 11 10:44:41 2022 +0900

    Cygwin: pty: Do not set internal handles in HPCON inheritable.
    
    - 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.
    
    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 c02dfb8ed..484bf55dc 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -2056,7 +2056,7 @@ fhandler_pty_common::resize_pseudo_console (struct winsize *ws)
     OpenProcess (PROCESS_DUP_HANDLE, FALSE, get_ttyp ()->nat_pipe_owner_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 ();
@@ -3551,15 +3551,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);


                 reply	other threads:[~2022-04-18 12:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220418120332.DAE05385800E@sourceware.org \
    --to=tyan0@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).