From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.3 (2019-12-06) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FORGED_SPF_HELO,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.3 Received: by atuin.qyliss.net (Postfix, from userid 496) id 975919811; Tue, 16 Jun 2020 00:19:40 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 7D04197F4; Tue, 16 Jun 2020 00:19:35 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 9217D97EF; Tue, 16 Jun 2020 00:19:33 +0000 (UTC) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2091.outbound.protection.outlook.com [40.92.19.91]) by atuin.qyliss.net (Postfix) with ESMTPS id 5291A97ED for ; Tue, 16 Jun 2020 00:19:30 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Taz3RUgj8u29gbErzgVh+MDpRIOUC0+MANfpvFHVizOxbwKugHFD2VrSfXedVi1pd8i1FJNfhpIkzhlPkmaBFJKfMs5a0ly777+VMRvUvXOk1YPGAIS8ukvA7hEucLtF2aXHDXJC1frvnpoID1fIcYuABROREX7Ha0iC29QmPKdExhv/CMQgBTbXz8Lxyw9YBjE76oAcrp6ylyWhqJMW/yI3DmG6lfeJHKVx7+NoZ5gTaqYw4jZua3O1S+uXu5xQaLusQHUZUhyGDjVH0v6XUBmambG50/XJoQMkrNrF5HxtaptrMbQ4eqQj2Bii7+NWLeTCtNm8Ssw0yVejLSCSSw== 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=5o0CykRWR7ow0GOtojQu4Vsr9eW9PQgOsBwCc4l9biI=; b=Ll6mkgvBwssfNJISoR7AnqgV+D8HkFzevQq/W/m9X7y+M3GGoQkXOTzyjVI86wybiwTeCC8hUIbFU/RByD7eV8rUDiMTyTfHILL73c6GT46t27iOk2wNSxz8HuYXKYFUgql+e3X8c08Ty8jE7KhPv8PxVP0zICCcnqfF1AETJbg7uXD0jKFpW9/OnyQOqgWw42aWze8/MygBCp7EWa+uZdXsQRAUN7VqoTEBPe2LbQaB0QcRsSGoppkKCcbaMfowaZO1Y5vislRquBqBX+5WBh0fR8JoVQFrss40UYKgLGy5iGd89Aa4oUjGTJP+7a4pr9k4zxc3n0o0Ux7xbBG1Wg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5o0CykRWR7ow0GOtojQu4Vsr9eW9PQgOsBwCc4l9biI=; b=u1cw0INEmEn3hB+rBWMmbPems7yaMBdWiaiIcKmyVcjVsDawSmtRe5I6P2cmMZtms90cakwrb/jwY9t0/OSzeHoKSCBLpMKyb5BrQ2g/5xO52dFtjfYBGnuBxmYYHFyyvOou1mfzsY8JLhSDPqJ5SuO8qxkkviMpoZzzIxeFadmIBWRKMgIPnNmsIf0Yytg0iHwL7GExSQ1VPOVStvzKd8ZeSDZIOnN9T7OaLnA96cGIWpQQ9iReMsV/oM1xquvl4ypsiT452ZE/vFTnniO2kWH6H8ksKNCUkKoJR85nm9d2+DUVe1eIDAiAXATutEnS4O8OyKajKRdfJx6KPhYl9w== Received: from BN8NAM11FT009.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::45) by BN8NAM11HT226.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Tue, 16 Jun 2020 00:19:28 +0000 Received: from CH2PR14MB3579.namprd14.prod.outlook.com (2a01:111:e400:fc4b::4f) by BN8NAM11FT009.mail.protection.outlook.com (2a01:111:e400:fc4b::65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Tue, 16 Jun 2020 00:19:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:AB7DCD6D8ABB1FF538CF4BB6516FB68717034F6FC2836C5E506A960A903603AE;UpperCasedChecksum:569AB4CC5425BB74BFFE629D3E5BCB4E74DB66C32F833C1342B9A2109FCC233C;SizeAsReceived:8513;Count:45 Received: from CH2PR14MB3579.namprd14.prod.outlook.com ([fe80::2948:142c:3047:102c]) by CH2PR14MB3579.namprd14.prod.outlook.com ([fe80::2948:142c:3047:102c%6]) with mapi id 15.20.3088.028; Tue, 16 Jun 2020 00:19:28 +0000 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 In-Reply-To: <20200614114344.22642-2-hi@alyssa.is> Date: Mon, 15 Jun 2020 17:17:47 -0700 Subject: Re: [PATCH crosvm 1/2] msg_socket: introduce UnixSeqpacketExt From: "Cole Helbling" To: "Alyssa Ross" , Message-ID: X-ClientProxiedBy: BYAPR06CA0023.namprd06.prod.outlook.com (2603:10b6:a03:d4::36) To CH2PR14MB3579.namprd14.prod.outlook.com (2603:10b6:610:62::18) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost (67.187.170.40) by BYAPR06CA0023.namprd06.prod.outlook.com (2603:10b6:a03:d4::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.19 via Frontend Transport; Tue, 16 Jun 2020 00:19:27 +0000 X-Microsoft-Original-Message-ID: X-TMN: [aXjIhIVKfN6ZdEAbC33DPu1hdQdp70+V] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 45 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a1731aa2-70c2-4825-9509-08d8118aee80 X-MS-TrafficTypeDiagnostic: BN8NAM11HT226: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vK4G0k3loMpFdPHtXP9LwO/L683lfEnayYxRt2G6BhMEagsVmzRS1pT6ti+/1W+lOBMH/eruVcSbNcTcqFf15z/g0eHkf/yMEs5SxEaSiDbXgIuCh6AGk1dr4RhDaymhQ9tcsj/rYW/0lZE58h1Ch5sPdghpWf69oPNa4cnkoy0qu/Rq1RVKLSVepR1EgfuxXah1RSiYtGxGW18qfrpaHw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR14MB3579.namprd14.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: IP/3LTLAW3rrIdYUOcfEg2rH7hEGAhf/Cc+QBx+XK1YOTcdn0yGFiF49T38HXehymlNH2QPefEYPeybH9xONrq+be0kcd/FuG7OfovUiG7wVxhMO61KOjS1+1AZYg6Mn94Z6IhZg4497I/bpUaufjA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a1731aa2-70c2-4825-9509-08d8118aee80 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2020 00:19:28.0584 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT226 Message-ID-Hash: IPEPHSYIP6FIYF4A5RECTONU5LEI6Z5A X-Message-ID-Hash: IPEPHSYIP6FIYF4A5RECTONU5LEI6Z5A X-MailFrom: cole.e.helbling@outlook.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.3.1 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: On Sun Jun 14, 2020 at 11:43 AM, Alyssa Ross wrote: > Occasionally, it is useful to be able to use UnixSeqpacket as a type > that can represent any kind of MsgSocket. For example, to keep some > MsgSockets of different types in a Vec. In this case, it may be known > what type of messages should be sent over a socket, even though that > may not be represantable in the type system. > > To accomodate this situation, this patch introduces send_msg_on_socket > and recv_msg_on_socket methods on UnixSeqpacket, that can be used to > send or receive any kind of MsgOnSocket. The caller is obviously > responsible for ensuring that the messages being sent are of the type > expected by the socket. > > This lack of type safety for message types is not ideal, and so > MsgSender and MsgReceiver should still be preferred wherever possible. Is there anyway this can or will be rectified? > --- > msg_socket/src/lib.rs | 52 ++++++++++++++++++++++++++----------------- > 1 file changed, 32 insertions(+), 20 deletions(-) Otherwise, I don't see anything obviously wrong, but I'm also not very familiar with sockets. Reviewed-by: Cole Helbling