Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp980106pxb; Fri, 15 Apr 2022 17:16:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyAniQvhFVQccJaBnISkqIl4dLSWHHAdXuTXVYoLZP95jXXnqLbxZyDR++kV0egajHqKKF X-Received: by 2002:a17:902:b213:b0:158:d44d:cad4 with SMTP id t19-20020a170902b21300b00158d44dcad4mr1431641plr.45.1650068209242; Fri, 15 Apr 2022 17:16:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1650068209; cv=pass; d=google.com; s=arc-20160816; b=k75DTODWnJ2Ot4TJMuI9tQa19WlBWlz5okhxpOS4nMI0pAAWGsS0mJkWqD8TUDkjJB KZfgR3AFgFOVxgVI5kRsvRlMD3o6fdg86JuYEScmHY3LW3RbeytMuHzazpxdao/WKnrL mnZxFa6Cs5FNHvlLEAPEyTdQvzQvwELzij7g/51y6Iej0dONd3Bx937fjPNB3kvEmRkf 9LP2tNL0e2EHSXHfOsUeEVVkVgO5GXWnW8uxldNtUNj7qizuTSt3LeRFbJFLXmMNodYA R28nnWWL7OAtQScghUXyalUL3BMTkFHarYgXdabsZJFvFRX1bEskM53RuiMPMEjG476h JYpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=SiDbvgatAz2cfOoblgI2QtLx38L2MWj2IPTtANzelH0=; b=IHT3wN5KgrIZYYvJhYG4E+KO6Md5gnmtvQOpT4LG8bH/8J5d8fkXCcrJ+MbFJpPeei Ns1a2bNe6rkMZ33xlDjJSTvqvPRV0rfSpBFk6W4IA/QnS9kPX6dsuTvNe1M+RtdZ9oSN F2xvbrephMNzwZWegYVWivmLPJaVEix9CpYVH3oYobpy3GK/IngA45qELWvwOjQCNELX N1gKcBCGOpQ93/92muc14aq1qkbTrivtF/jCmX9l7cEkBp9+PmeXYL5q1x778dPEi5qY HU1m/RaCTSZPevjWGtgKyeteGR2eeVgmGvXKzZ612cXkUDauVJAfN8tyCsrVSxzhAi/v O+PQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=e1L0LYMd; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b10-20020a170903228a00b00158c5243458si2832472plh.90.2022.04.15.17.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:16:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=e1L0LYMd; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5410CFB85; Fri, 15 Apr 2022 17:16:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354634AbiDOOdj (ORCPT + 99 others); Fri, 15 Apr 2022 10:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354624AbiDOOdB (ORCPT ); Fri, 15 Apr 2022 10:33:01 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2129.outbound.protection.outlook.com [40.107.237.129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77D9BA76C7; Fri, 15 Apr 2022 07:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fKjZt6nlkUf36cfxgg7S0wHLfycm4sbBzUhyz0yEQT+b6ysAr0BCoqswNddVFxZ5peBV6lS2Gj+UhptA/V+Uk3tuKZyW0EQjFJuvfOi3ggNgW2J+Tc5bukz6QzCLVF1qIQKgge1QUIvsmNQxe1T4Q3/VPFaLcesPnTzqV1lERDTz6+kYqzOvQOYuiGKGbZeO/ZaCcDQJgMDA74hLs9r1El+vMYqM5o2vkOIdPaOx3X/yY81QkQBA6Aw9sFm3aA0kDkC2wAk4utdteY/2/J+StJWQh8MTWOSD08tNpSkupKne6mM2zF0DntbLG4j/7lDesJs7camXDNTVXfvG7t5jtg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SiDbvgatAz2cfOoblgI2QtLx38L2MWj2IPTtANzelH0=; b=B9nK9y9vGQ0QuNd9UlLMKq+XHjnlx0x+Z63FxtXNuykFzpoyebNThxDO5LIUNFx0i8YBzKyMIswvipBFTr/YThpEBicLhISI51RsGEddI7ySdDmhAPlNL2G0d3/3XoliysfiX/BM7hWt726VntFdIhuDrMsH5W4eg9kK7NAk9vOGlOSSVOJnWBH0QZYeHINYoV5i5k/Z8lUKQ0u2WLyjwFrjEVR1L55M/0emxpf9fHaUu82LszsqrozXIvxxWs9c21ebUCTGFq9FGltqUxAm8M98/x0G7tVSH7YowzlVZwRcXyz4fyZx3meMHaLFE40XqdQ6mhNVEE7vDvWFCaGU9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SiDbvgatAz2cfOoblgI2QtLx38L2MWj2IPTtANzelH0=; b=e1L0LYMd3kUE9kDrs3cHLQfmQS6eAzTKXbfQ5Zvqw+8CKuJ0iBcoxfeE/lozoy7sLgtIEhk4P9TJMmeycJZZncWz3x7jrKB1h3EyhEH0/NdGKGO/oIznOMEKboDtOl4Qnt/Nn5sOYhczJcpmtwMn21Ied7wKdWgDFlEArPZ0IVc= Received: from PH0PR21MB3025.namprd21.prod.outlook.com (2603:10b6:510:d2::21) by LV2PR21MB3350.namprd21.prod.outlook.com (2603:10b6:408:14e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5186.6; Fri, 15 Apr 2022 14:30:30 +0000 Received: from PH0PR21MB3025.namprd21.prod.outlook.com ([fe80::ac09:6e1b:de72:2b2f]) by PH0PR21MB3025.namprd21.prod.outlook.com ([fe80::ac09:6e1b:de72:2b2f%9]) with mapi id 15.20.5186.010; Fri, 15 Apr 2022 14:30:30 +0000 From: "Michael Kelley (LINUX)" To: Andrea Parri CC: KY Srinivasan , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Stefano Garzarella , David Miller , Jakub Kicinski , Paolo Abeni , "linux-hyperv@vger.kernel.org" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [RFC PATCH 4/6] hv_sock: Initialize send_buf in hvs_stream_enqueue() Thread-Topic: [RFC PATCH 4/6] hv_sock: Initialize send_buf in hvs_stream_enqueue() Thread-Index: AQHYT3fj0GpxS7gRakKuoVXd9R6gy6zvoDCwgADrHoCAAH/W8A== Date: Fri, 15 Apr 2022 14:30:29 +0000 Message-ID: References: <20220413204742.5539-1-parri.andrea@gmail.com> <20220413204742.5539-5-parri.andrea@gmail.com> <20220415065041.GC2961@anparri> In-Reply-To: <20220415065041.GC2961@anparri> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=e784f1d2-f130-4552-8e55-cd1be966c940;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2022-04-15T14:28:13Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f43d2a40-2df9-42b3-b08a-08da1eec7de7 x-ms-traffictypediagnostic: LV2PR21MB3350:EE_ x-ms-exchange-atpmessageproperties: SA|SL x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: t9wcN4xIA8ubv2RSMHV2AXaMbv84CSIJkw7kftZ5RKwsR/RJ6g3+QumOeO1JPEP1paOPLfm4AkbPxUieXd2c6F/0DYae2W2zzGsh1CPA5rRePm6GrgVCPpHIGe4ShZFA9Z9xBZXMbwCcTH9mXA5HFiIODpxfbZY7lwdBjsvqijFo2CYQxUv23y2fZKKvsRildLubOFlFsDCtpfB02RTBNEbqKzsXV/fMaNRFHHuolxCwQWzAkeTdcPcEdqPvW2hpHddlKgEEnYxJC2uA8PMWV2+2xwNjoCl5w6VA2ISdiho1z6YFBM0zA3wS6hq2kHCVHVvbYn8frlmJT9JgXhL4rfLfK37/MRBmcoBbPcpUi4N/k7xGftsKKDW/ieAGroxfPi8oZWgsiHLREpBjRoFWUAJV0aUmX5fMbVu3pYb1bKVpfcGTSvwh5sjFCvFVsqb6tO+O0I9/1EtohUbhLqACOvjnapTus4TYvQih8wy6vIoPmWzKWg8ZENSiRExsb/sFFJk1EO6cKW4jfk3NM6qPtOzpQNmoV/PKE8BOl3MyoK2r58xNLkn4fLwVJT+6SAtlxFdndjje3B6xDjxfsVNQiKX+CR23X8cQHhp6HUOsmR6/DOlUnvbHTUtBuG4GT4CldPPFjzFZeGykRAt81I7EZYejuYegNnwMQjemGeUyHozCa1oS6uII+vm4qN5XkzBe+oM+7Uym8UdFbAlQFjHCKOVaLUDlCAA9oRAJc58YpceUozZ8m4rvte81VSUg+as7 x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR21MB3025.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(451199009)(10290500003)(86362001)(122000001)(71200400001)(6916009)(54906003)(52536014)(508600001)(316002)(8676002)(66556008)(64756008)(5660300002)(76116006)(66476007)(66446008)(66946007)(55016003)(7416002)(82960400001)(82950400001)(8936002)(4326008)(33656002)(38100700002)(186003)(9686003)(8990500004)(26005)(7696005)(6506007)(38070700005)(2906002)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?aCJE1A80fiOYq0Z8a/SObAqA45T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content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR21MB3025.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f43d2a40-2df9-42b3-b08a-08da1eec7de7 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2022 14:30:29.9586 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jeVC42MOshZRUM0vrlN9lKyPpxHVMbdnL7rginbxfkFrUjfcmoQV2Hr/dZiTUbrtz61yMSV6+NDg/PlHDohJQvnMMGXk62z/rKHn2LJ42SU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR21MB3350 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrea Parri Sent: Thursday, April 14, 2022 = 11:51 PM >=20 > > > @@ -655,7 +655,7 @@ static ssize_t hvs_stream_enqueue(struct vsock_so= ck *vsk, > > > struct msghdr *msg, > > > > > > BUILD_BUG_ON(sizeof(*send_buf) !=3D HV_HYP_PAGE_SIZE); > > > > > > - send_buf =3D kmalloc(sizeof(*send_buf), GFP_KERNEL); > > > + send_buf =3D kzalloc(sizeof(*send_buf), GFP_KERNEL); > > > > Is this change really needed? >=20 > The idea was... >=20 >=20 > > All fields are explicitly initialized, and in the data > > array, only the populated bytes are copied to the ring buffer. There s= hould not > > be any uninitialized values sent to the host. Zeroing the memory ahea= d of > > time certainly provides an extra protection (particularly against paddi= ng bytes, > > but there can't be any since the layout of the data is part of the prot= ocol with > > Hyper-V). >=20 > Rather than keeping checking that... The extra protection might be obtained by just zero'ing the header (i.e., t= he bytes up to the 16 Kbyte data array). I don't have a strong preference ei= ther way, so up to you. Michael >=20 >=20 > > It is expensive protection to zero out 16K+ bytes every time we send > > out a small message. >=20 > Do this. ;-) >=20 > Will drop the patch. >=20 > Thanks, > Andrea