From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-eopbgr760099.outbound.protection.outlook.com [40.107.76.99]) by sourceware.org (Postfix) with ESMTPS id 1AC6A385703A for ; Wed, 16 Dec 2020 21:09:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1AC6A385703A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aC4cepGlUW3yxD4+zLvM4CGgG4NFtUEZxC0vrcPv45jdnlFaZN4I6BiB14hL6k2hzzpWg22kHXBCAzeNeZ+dyde6jkzUVy/JTEFwCFr3BOHarqNXIPDnJcULvGO66lAFr7MCPQG/yMeIReHrKAiHKQyVPrYNCzHR8mUbvpDu5U8tcgqQqEx1VRauiGQNSIEQEriw+ozruyD7KXaiZlxh7NYLQiSIu5pojM2/kGzzyZllO5nJV+QTBB47FgeTzAc0D5/nlIAuIkh6Uhvu2lsQNQfnv61PtEJ1ghB60xzGtE+6y49H8mzZowSbkNoOQrQOfK00rXIPDvwRlHdSMGe5SQ== 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=Zc343e669lwbIjx34RtrBOSKzd0hH6hPm41X0N9D53w=; b=nAm4YnGd3GVWE1VZQaLxqvfs7Rqr9KQVLLnyBqVzSYrFdPYuXuSLiSgic2jgkTD6frV4Ud4mU8C9suOdhF5Zt/2vTIIdqW1ASrjC4hgWYK6N/dyd46veOjnIRXnkAkorEC7m44qaXSRpwxavuhuST6fPHPY/pTWelhovHgZEKq7j3rFw8JWFg4tgtcqs5IxZQpJ77ehoO9LwAX9kmoVQM7U4xWMN78oAO2ZRre9mp12VdSrmw3Lh4J7VTfufTa99GBaLwSyifWJV/3llEjnL9q3lWaDwaLtJNgSCzt+uU+LPf7+AuIEh+fYu8qsZpFJgE+RP4DnAUz4KH09v8q0C1w== 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 MN2PR04MB5664.namprd04.prod.outlook.com (2603:10b6:208:a6::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.17; Wed, 16 Dec 2020 21:09:44 +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; Wed, 16 Dec 2020 21:09:44 +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> From: Ken Brown Message-ID: <0e35d233-1c9b-93f6-aff7-8df204c5cbfb@cornell.edu> Date: Wed, 16 Dec 2020 16:09:43 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 In-Reply-To: <20201216092927.GE4560@calimero.vinschen.de> 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: BN8PR07CA0009.namprd07.prod.outlook.com (2603:10b6:408:ac::22) 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 BN8PR07CA0009.namprd07.prod.outlook.com (2603:10b6:408:ac::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 16 Dec 2020 21:09:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: db1a5fd4-91b4-40cd-b9b9-08d8a206e99a X-MS-TrafficTypeDiagnostic: MN2PR04MB5664: 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: am3bt6VTnmJ1Z4Aq8EB0M0rAllt+NapOmdyN2mWfjPbJ/HyqqjRD5ZYiNfJBnjxTKfwFlNixVjTrnLab3LN+P8xyv8KwZOHf7hud3rNbZ5HFA3/wcucGtK67EmPSEzxyI/+QX/y+k+UjoVfwC+t4wjgcqSwY641saPFr+uo98FmFNiYNWcex/OwBAwGdLbQn/EgoK+F1vo5eRgo6DttL/kiFohHmI8r7Y7krLn9+PNeBhAIlNwZWr30v6iLgCIqREy9guJRlKxqLZNitlPdu5PIz44IS/qdTsSQAbM8y+H3fKAhV0Uq+cFQXM/7vpk2A8pSC2CLH7QLCabDabkjEwoqTkQH5ZqjZkWsWJ2OXgyKdG91EaqcS1Bp+bH+o72DTHfqlgR8dk/69HH2nMx4gMrylnu5k29ZxKik9YYYUmhQ= 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)(396003)(366004)(376002)(136003)(53546011)(5660300002)(2906002)(6916009)(75432002)(6486002)(31686004)(31696002)(66556008)(478600001)(8676002)(2616005)(66476007)(66946007)(956004)(316002)(186003)(7116003)(8936002)(4326008)(36756003)(86362001)(16576012)(83380400001)(52116002)(26005)(16526019)(786003)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: =?Windows-1252?Q?n+hjPcf6MYnrxvSabN5eae6/3kAYie7HT6AbxWDFWrmvoop27LF6064m?= =?Windows-1252?Q?dJBtgGwzbBu6uRbSWcaZAIYGDQBEOOIFVlPX3SW6D5DA8J4aV5NdXs6o?= =?Windows-1252?Q?/IwCbog4GwQdIOacRC2q8x8tja5EcuUxLCmSBroY3DYDQHdaDr1TzTJg?= =?Windows-1252?Q?DYjd5YLgB6pnkViHy4DBqZ+YlzLxeJdx1R+Iq99kf+KZ6XJFcbWVO7mX?= =?Windows-1252?Q?MzHGBvj2l8q2I1+ThaUmVhtR6/udsjER5zSnoGlmVU9BZDfqKFA28FXh?= =?Windows-1252?Q?8Ptp7DDVo04g1fzCHgC22ZSdD+75tsWbnkco9k/MGLa09o6n8sgDpQd1?= =?Windows-1252?Q?e+5Zo4PfefWUAw9uxWFvxBYzznsHULFxa1b6g78xWKdyWaZ/H5Ro6SNG?= =?Windows-1252?Q?AwiMT0s+RzoCGOw1LeNStaHkKU2oJlOoe+NjsJB3E99bo390ZovDuRC8?= =?Windows-1252?Q?C4treKOJKvZj6imD6kXB4RgfIon2t4GgF1c1u8LX3yZDnIRGo+2ZwPKE?= =?Windows-1252?Q?lwDrK3g+RMdXjVakhiTQMbv4IK6nNXJCHrB05XHWQEbGwteelWtTqyw8?= =?Windows-1252?Q?ag3/xzJ/+cJ2EUMl9PC0Zzx9GIWRLSan3y2eiuYBtG453P/oT33J/Y9C?= =?Windows-1252?Q?Wlgz5AtIZy/LAL/NPr+NEfXofjO/E3yL2lxIBHH3mirOBGI48cMPZsA5?= =?Windows-1252?Q?qyMtWWTmt270nWuTuXbibHyAG+kLup8Yh8DeD5RuaMNgb3qUX3rOLwOW?= =?Windows-1252?Q?51r7Eigd8J1N7owR7FM0oonHce3HR7JBqWpcCxkg5qOAL7MR3nNsMhwP?= =?Windows-1252?Q?90ilPq81KNpGLS7JFAcwIp984S68c5TFh3ufBr7tHVTDxmIfJJxW6gLc?= =?Windows-1252?Q?Afi9HMVcRvL5yqoauq7P22hG9B2YWVVzI7hSlUi5R4czn7JUe6JHqyEL?= =?Windows-1252?Q?TYvqquOS7aYRdcF5yc8n9l0k2XPWoTxnJOWzk0kpleej2VlqEZMzZ6hI?= =?Windows-1252?Q?kpY0TdfBFZXsBV073NHLRyV2faakjw42uy21VGO0Tti8o+mFfWKlvHOz?= =?Windows-1252?Q?wbognWih2dkbZ79x?= 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: 16 Dec 2020 21:09:44.4570 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-Network-Message-Id: db1a5fd4-91b4-40cd-b9b9-08d8a206e99a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: k+e3HHWcKJM4WUpu5h0d1mppCPxbYcNMLsHZLC/Pb0dOMYd2ypqAe9WsWLdjCDWsB/kaY+1P5NbsA060iS2jJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR04MB5664 X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, 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: Wed, 16 Dec 2020 21:09:49 -0000 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.) Ken