Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp979770pxb; Fri, 15 Apr 2022 17:16:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxylsqXvvqv1eLqaAK1x6PsP8eXznFPztSyGhYGhQJy2yDk11PdI3TtgjwNljwh9FVi2xU X-Received: by 2002:a63:bd49:0:b0:39d:a2d3:94a2 with SMTP id d9-20020a63bd49000000b0039da2d394a2mr1112089pgp.242.1650068168525; Fri, 15 Apr 2022 17:16:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650068168; cv=none; d=google.com; s=arc-20160816; b=kFI9ZXv6C20hh5pICW0zh32Few/GPdGZkKGmI6vKlGE6cdUTWF7qaDqizcE8lSnU1c 0tETcrGIWMkYiEFGri6yOa6CPsjh39VW73FB/0fhA4h6csTZZcST+ee4a2F0hEDgHQjt qrCk+kdIWtJhdCRd6sfp8skPRvlgYFaB6cOIfu3h4oBmcN0Uz8jf9aSD4S+9Oab3EQTs i9XTJLSLRyn+C7KPYucCnhTwaOX4P/p2JVFxoZOXg4BGM4Bx1KYbhj68PPy9obwTD11T Z9sxHUyOwmRrEhIXZrUtibxuxTMJNVIcjOUC+hWoiafX404DYBzd+ygYYS3jRUk39XpD l9NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FuI2l9kDOo4LiYnP+oGo08tHGCFvEiqQxGIgY3zlKIA=; b=ov6VdyBcNA0nWbEV1LC0yGaO+tBTYm7qLOoLogk4d5lDOgaQ1oEpzXJHqjQorbjy5z vr4uEdew4r0ntqSPusnLMLGtX0i5Q/mLh1iHokekA43nG1z1B2S/ThaUdlXtAYfEqGVs 9PGwpvDfZmRhT0ksZnG1dEca7gDAmlq3GcKkRTQdsQ2iSmdc0FOfmPyWQF2iMc0FeEWu p/OXQIPPPVE73cuX+0+Ea3WFL1wbERUWTWJNiuinOM9oKT5/ei7oJyM7lVoRtr49dDEd +UoqXvUG1n7+KQyGnXFf/wdunSx0/04Bf3ltQaipH2sPg1BIiutk+ylQ5ngjzn6TXhG0 N38Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Dz7hxGHD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 18-20020a630e52000000b0039d951b1a5asi2751381pgo.270.2022.04.15.17.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:16:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Dz7hxGHD; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 68941CA6D5; Fri, 15 Apr 2022 17:15:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350656AbiDOGxT (ORCPT + 99 others); Fri, 15 Apr 2022 02:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343864AbiDOGxN (ORCPT ); Fri, 15 Apr 2022 02:53:13 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E6FFB3DC0; Thu, 14 Apr 2022 23:50:46 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id s25so8500403edi.13; Thu, 14 Apr 2022 23:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FuI2l9kDOo4LiYnP+oGo08tHGCFvEiqQxGIgY3zlKIA=; b=Dz7hxGHDeM5WnsAFMqIITeeKULRipD+St4//j1pf82am51Ed9InFiST07WqtKVMdOm uBSITb/oa9bo8SGPYJEJnMK6fkDCaXrvBd933+oAb9Tyb3KearAu9DcInWJznOW442r0 7TZrMqJOexp8wXZLWvdqy4xZSzPfd/24xu/HiCMClXJGA0hbkjP2hoiFNoai4rYkkmP/ MBFXGVFB69N1yno5X6W5VJlt3zZUZ4ucvS4hbMdJ80eXVelJYVhtWnuZGgCAB3yuEaKC U7ONGlWpwMlLAfI8QbVwYBpkMLLEp6PeEwAJxqIXhrDX/KIYCrOVC8sq9xuzqYYJj2Fi rMlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FuI2l9kDOo4LiYnP+oGo08tHGCFvEiqQxGIgY3zlKIA=; b=GlnE7m09xQRa+jvbausuOC2XjqtGSqMAazIylwCtpXT6kDz0TCmj6Wh6MaIJfT4IWR CkVbkgN9iT50+n4W8t75zDl3Emn8E2VnNmQwF3Zg4AYTm9NGX9sJj62SlO2kJjGh3Sg1 2WHaIeccOH9FJRpKA97QuyXJK97w0n8eIriJ+aXj4Jr5cwnzSWoO5N+RVNydKfm771iw 0ZYp+joLRP78L9n0el9wT5x5CSNi7k6BAJs5mV7ju8On1w9O5J5vFVkG0EQo+yo0pG38 bsY8SI+C8aWWM1u6ek3qfjTSdpAgrakFDnnKU4qMkENud9q/1IhJByffYAaAmgPaGTyf 9shA== X-Gm-Message-State: AOAM533PNCskqw0vUAkntTX8jsDaD1xT5ezidm2vxmwtUWZmom+YuixG jC+rQMdUVJeMnREP+2hAerIClz1zQXH3hE9x X-Received: by 2002:a05:6402:1912:b0:41d:975b:9496 with SMTP id e18-20020a056402191200b0041d975b9496mr6930321edz.222.1650005445000; Thu, 14 Apr 2022 23:50:45 -0700 (PDT) Received: from anparri (host-79-52-64-69.retail.telecomitalia.it. [79.52.64.69]) by smtp.gmail.com with ESMTPSA id n13-20020a170906724d00b006cedd6d7e24sm1371176ejk.119.2022.04.14.23.50.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 23:50:44 -0700 (PDT) Date: Fri, 15 Apr 2022 08:50:41 +0200 From: Andrea Parri To: "Michael Kelley (LINUX)" 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() Message-ID: <20220415065041.GC2961@anparri> References: <20220413204742.5539-1-parri.andrea@gmail.com> <20220413204742.5539-5-parri.andrea@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 > > @@ -655,7 +655,7 @@ static ssize_t hvs_stream_enqueue(struct vsock_sock *vsk, > > struct msghdr *msg, > > > > BUILD_BUG_ON(sizeof(*send_buf) != HV_HYP_PAGE_SIZE); > > > > - send_buf = kmalloc(sizeof(*send_buf), GFP_KERNEL); > > + send_buf = kzalloc(sizeof(*send_buf), GFP_KERNEL); > > Is this change really needed? The idea was... > All fields are explicitly initialized, and in the data > array, only the populated bytes are copied to the ring buffer. There should not > be any uninitialized values sent to the host. Zeroing the memory ahead of > time certainly provides an extra protection (particularly against padding bytes, > but there can't be any since the layout of the data is part of the protocol with > Hyper-V). Rather than keeping checking that... > It is expensive protection to zero out 16K+ bytes every time we send > out a small message. Do this. ;-) Will drop the patch. Thanks, Andrea