From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2127.outbound.protection.outlook.com [40.107.94.127]) by sourceware.org (Postfix) with ESMTPS id 1040B3893660 for ; Thu, 17 Dec 2020 15:54:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1040B3893660 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N1/zwgRb/bI+gjWhiSSs9AZ5Hjoc65GYdtU9ue3XBnDIiYNa63RU2JH5u5wh2I0kVKsSBja8F1/4Aka9lnQTabVPOJ+pk5CzoUKgJaJx2Ytg/FIUBpLAS8XoX9gd2k+wrKJus8bojZQpIbXl53lomCqhVyWHXhUce7MGFUlGhs1DPe1B4oq0lI/9lK5NRTkUtOmWHYgPzb3cBis7TAYxYChL9FbKdewCSAUoODu+uH71bo07otwl6uwtMGvG2m0mcA1waj4G9yWwpFFhfvR/cmhmM6OEReV3Qa6WqukrTsxWByDbeXunOzzVSCSWJYRwk2PVelHZ2ZszT0ShSXqJkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PEuKtdwUS8CAYCsgzsWfp2UQkQNCNzu+B6mEqrD+orY=; b=aMeg2Ona5AA0u0yrBopvNr/mOm6rW4JkdO2LQ3olLERjEXIILLj/z8KzZrZcBR3SAczfjXYapXsukV0Lr7VAOH/OwUsPpkCFBj50SZoi9QsmssKYetn6c0OD4igeiOtx2d3+BKsmwVBgHrHdF31Tsh632lo+dg7vUtLYbPI9nBkD4xWS+y7cRgdjIHGY1FXyLrMwnv62nZPDaC+7ZvKeghXdtdofuFrf6GlOk5HhlXtwzjJBI+v0l2u+l5e6W0XubWNkh46TlYiPFYOCBhnnVBRGYVjRu6x+jYExUoZ3OJSjDkQOrogGfGdcLzXkfvIY1J+pyQHcyd1DJc4gunOutQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none Received: from MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) by MN2PR04MB5872.namprd04.prod.outlook.com (2603:10b6:208:a0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.20; Thu, 17 Dec 2020 15:54:29 +0000 Received: from MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8]) by MN2PR04MB6176.namprd04.prod.outlook.com ([fe80::113e:c874:1207:eca8%6]) with mapi id 15.20.3654.025; Thu, 17 Dec 2020 15:54:29 +0000 Subject: Re: AF_UNIX status report To: cygwin-developers@cygwin.com References: <20201106091240.GT33165@calimero.vinschen.de> <99e02f87-1c58-ce6f-58e0-0deb26c4c899@cornell.edu> <20201109090812.GV33165@calimero.vinschen.de> <6c3e9c53-8575-de80-be2d-49af2b87eaa5@cornell.edu> <20201118083447.GL41926@calimero.vinschen.de> <20201123084313.GK303847@calimero.vinschen.de> <84f2fc71-a1bb-0496-93dc-ef21c46fd432@cornell.edu> <20201216092927.GE4560@calimero.vinschen.de> <0e35d233-1c9b-93f6-aff7-8df204c5cbfb@cornell.edu> From: Ken Brown Message-ID: <04d7d1ab-23eb-cdf0-b5e0-d5fcb863f5c6@cornell.edu> Date: Thu, 17 Dec 2020 10:54:28 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 In-Reply-To: <0e35d233-1c9b-93f6-aff7-8df204c5cbfb@cornell.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [65.112.130.200] X-ClientProxiedBy: BN6PR20CA0059.namprd20.prod.outlook.com (2603:10b6:404:151::21) To MN2PR04MB6176.namprd04.prod.outlook.com (2603:10b6:208:e3::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.13.22.3] (65.112.130.200) by BN6PR20CA0059.namprd20.prod.outlook.com (2603:10b6:404:151::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Thu, 17 Dec 2020 15:54:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b635e013-5568-482e-3b3b-08d8a2a409e6 X-MS-TrafficTypeDiagnostic: MN2PR04MB5872: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rCi1rPZpPEGh4AoNTFWhD/V8qyCmGuN1loYoPboRg+ihwtRxI6hjnGpq0IkBbxWeLhgZYEEt9r1NF8yywray0qBLAimZ8KoUei3sOGppmUN5zETX/jYFYhXWczZqSqYDb7KAfxPVPLsyDU5aWSG98UMu5i81I5IXWNNGWXkrA4H04HzFkzpBPdWWJ7aKWFWgvaS1u4tcKxbrkP6XLMSu86A/y9YaPo5bCw38pKjQpx3X+h4rchmup+aMZWGFTQv4/Ushz36PMG+NeA9WH13mjkxuR67gKZVlzD6lfMnIsfQLdmvVAap7IYGaZLLT7bOF1J8Eb+AhAhbdo93vHgQPAzOBorii8fP9eOgbSkxxFT/vdWHmQOeaBScySEzNHRU4u+1FGnHDm9t+WKO7CQujZGSEzc6TN3Czo5RFE4I64yU= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR04MB6176.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(136003)(366004)(396003)(376002)(5660300002)(86362001)(53546011)(956004)(66946007)(6486002)(7116003)(186003)(31686004)(16526019)(31696002)(8936002)(52116002)(66556008)(83380400001)(8676002)(2616005)(316002)(786003)(75432002)(36756003)(2906002)(16576012)(26005)(6916009)(66476007)(478600001)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?Windows-1252?Q?90+rxubrWrUN6ev+PuLXPnahtv0DUD1FZTxnVA7e3L2elfw2/cOvWU/w?= =?Windows-1252?Q?t/k2smAEayz1AUYcou/LyxH6CHLAc01cSDyLpZ/E/Y4Bty3386xn0SFh?= =?Windows-1252?Q?KTwpGLCi0MZq5VlXYhA5iWnESepqvGFkAw1GEs/QcVjPTUmo3DAdZUOn?= =?Windows-1252?Q?RR1yb2N6jnqTpWbaDyQjqXrJXM2J8WEDJ3v8pJQLIrNSSemHrU0EjgZJ?= =?Windows-1252?Q?GGbyrxIaAXA8ToKT8iUQUeSAD+Pe3CscYDcObg8WDwYzA4ZNr13fNSOe?= =?Windows-1252?Q?z3r9wx3J4Up+koc+YAOmsW27IYrf5hrtusggPh1H1rf7EpPHxnJfFvHK?= =?Windows-1252?Q?aKljNvRxA2N0/V/ZmQwioyEC7i7PoeLOA17eAj4vu+WbtLPLa1E1C8vp?= =?Windows-1252?Q?3+QhWVwXxgiefS2rETxmI2aMWqdEy8OL4CoBuTnIKYsmMRJeLCQ00//m?= =?Windows-1252?Q?oPGrYBCLjX0l99cvnnsRtl8LxWO5OTiC1586kL1U3VL77Th4cU1rmSP4?= =?Windows-1252?Q?dqSUCeQIEnbHZsUWh01z2SOFuNi4KzeojwTXg914jvqFvbnSX6UbzbDG?= =?Windows-1252?Q?jVfXVORpQR6nDkZ6gnjWIGbKakLexyYEhX+ZdLQE6OUIT5ZuNIApEqa5?= =?Windows-1252?Q?V2ziyxUPfhY1TJmoPsTLWneFshtatEIvZ3A+5cMwOHNkPpg/oPgVN6JK?= =?Windows-1252?Q?XGq9U/Jpi/Zo6L9WSQaaO77vp48C83o1C72MGVGryyZR9p4EIQjyAlnE?= =?Windows-1252?Q?RGSIkgfLjdNCbDZuJDbzRQJf9o+UivDvF+zR+0f3sa2CmszvMg1LiiN0?= =?Windows-1252?Q?4NoI3NFSe+schC5zw58ojR2fRnAXx77ShYIH+WWNKOZ4D4HUdBmU4w9a?= =?Windows-1252?Q?HSiwANpPRRvLp9ylCbCyoXY6g3sNLiulOeIvEFtzpdWfs45Oo3tfWU5U?= =?Windows-1252?Q?5P9MpZgXgD+iHTZkVk9i15AQCgMvrR76Ee6VDbJk3jeKkyMrZjPnDUfC?= =?Windows-1252?Q?8D2V00qLf1ZwnSE60e9FGNN41RqLvyV+WfpUOfkkoVmVIu73OcBBae2L?= =?Windows-1252?Q?g4U2Z922bVMLefHG?= X-OriginatorOrg: cornell.edu X-MS-Exchange-CrossTenant-AuthSource: MN2PR04MB6176.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2020 15:54:29.7094 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-Network-Message-Id: b635e013-5568-482e-3b3b-08d8a2a409e6 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KMVWc4s1FhyS5hNroAeVrPqFgt7eu65wYoCO7VFD48YVML3bzHdfA33si7t20MAk/qom3QOba3o3B/FVZ8+06g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5872 X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Dec 2020 15:54:33 -0000 On 12/16/2020 4:09 PM, Ken Brown via Cygwin-developers wrote: > On 12/16/2020 4:29 AM, Corinna Vinschen via Cygwin-developers wrote: >> On Dec 15 12:33, Ken Brown via Cygwin-developers wrote: >>> On 11/26/2020 12:06 PM, Ken Brown via Cygwin-developers wrote: >>>> I took a quick glance at the openssh code, and I think I see places >>>> where pty/tty descriptors are sent.  For example, I see calls like >>>> mm_send_fd(sock, s->ttyfd).  So maybe I need to try to add support for >>>> that next.  This could take some time since I'm not familiar with the >>>> code for fhandler_termios or any of its derived classes, nor do I have >>>> any idea how to test sending that kind of fd. >>> >>> I've now written and tested code for sending pty slave descriptors.  This is >>> the first case I've dealt with in which the fhandler uses an archetype, and >>> I'm not completely sure that my approach is right (though I can't think of >>> an alternative). >>> >>> Suppose a process wants to send a pty slave descriptor for /dev/ptyN.  The >>> receiving process checks whether it already has an archetype for that >>> device. If so, it uses it.  If not, it creates a new one by duplicating >>> handles from the sending process. >>> >>> The first case (in which the receiving process already has an archetype) >>> bothers me, because it means that deserialization uses no information about >>> the fhandler it receives other than the device number.  That seems wrong, >>> somehow, though I can't really say why. >>> >>> If you want to see exactly what I've done, it's in commit c605ea0d on the >>> topic/af_unix branch. >> >> I think it should be ok to use the archetype if it's available.  The >> important tty data is shared.  The handles and stuff in the fhandler is >> mostly connecting handles.  Permissions are not exactly taken into >> account anyway. >> >> The connection to the pseudo console could be a problem, but reusing >> the existing archetype may workaround that.  Otherwise the process >> would be connected to two pseudo consoles, and I'm not sure that's ok. >> I hope so, but... > > I completely overlooked the pseudo console.  So I guess the > serialization/deserialization has to deal with get_ttyp()->h_pseudo_console > somehow.  My guess (based on only a very brief look at the pseudo console code) > is that this should be non-NULL only for the process that called > CreatePseudoConsole.  Does that sound right?  If so, then there shouldn't be > much to do.  I'll keep poking around, but please let me know if you see > something that I'm missing something. > > (Takashi, if you happen to see this, please do the same.) Answering my own question, yes, I was missing something. I wasn't taking into account the fact that tty data is shared. You said it, but it hadn't sunk in. I need to rethink this. Ken