Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp696471pxb; Thu, 21 Jan 2021 18:24:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7arUReIQtEXArNcdeoqfG40bXKgAJwttvVfS1LlcEW1aAqL/wn9ww9EaeDqK2xCJxuPcn X-Received: by 2002:a05:6402:254b:: with SMTP id l11mr1531089edb.202.1611282282992; Thu, 21 Jan 2021 18:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611282282; cv=none; d=google.com; s=arc-20160816; b=jMIwplmUQkxdraYhGNvtHgj9VSe+QJsB3w7fYCIird9k0Mf3pIZaY51XvL1on723qP v6P2pOcupooODQuhfzlvNAZWn1B9UAd/KRFxVYjqLT7/JhLjgcpFwxpSRABJ70xbds+L rP9rrtQSRiO354QqvVon3SPmb0P/oPrS+EpG3AKi0DItbXCeE4fx5FZdqNwe9JfTihP2 9xsX3BWLpHKWT+ffi/9YNPA7fgWQy187gsksDPgUQ4lOkvu3loqk9Xr1IKWpCjLIV/dK RmHg54pUXF0Pgsl+ZNDT+U7Q2XDO6VJ1/cdr3oY1Omb1GbGKW1igltKzeu2V2wd8hVJM oxng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=I7e6ioD9V/PeoK7dAUBEPNIOzSTjad9XYFyrEAj7pkQ=; b=xXSQ/vITO6esxCEXMVn4hs/yyS+vcIywfgvMFnphKjruMqr/iDJEWBwJkG4s/UE3J2 6S3h3kq9oTt1Bo3picDFh+5ukRYdI63GuHjwJAVyurJ0TtA2SXLkRhHkU6z6d5Y66O0E RKYDVUEetvJpsb234WWUsmc/Zk5yBdEiFhKVTt9G1PBOHkLkVGAuJZjBeThAPCoF29jy aqMFWMHGt7QDM05Hlz0XIShrhDLXwqdrSz6VAvDWwJXM9aamd2ab92KquDAKmHAWg3Tu 3Fr6rU39/3cFpImnjQcJc/K3rksMCxNrqkWZg8P0i8iLrcyVE2MKkiHPqbjPh0/mROVf D0JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jg36tCaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si2436396ejk.163.2021.01.21.18.24.18; Thu, 21 Jan 2021 18:24:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Jg36tCaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726162AbhAVBHt (ORCPT + 99 others); Thu, 21 Jan 2021 20:07:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:43324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbhAVBHs (ORCPT ); Thu, 21 Jan 2021 20:07:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76FAA20799; Fri, 22 Jan 2021 01:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611277627; bh=l7rkR42OuxejsKhxyiDFxuiuLb9LpmduXzlQoZ3Vc7w=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Jg36tCaakT4Vqhe5/adn3GIemg2utiNRML23pug/q4XDesGpEuCIo7OA8L/ms1o7e OhhXOafBOZ0ErkYLOWQ+zJj40WcIvIy4g2m4lE/l35fAuQQ6x/NeyXdAsiyLzCd6WM lHHSjZjy6sIGY97gkYL5tJZNURVmy7/42baQ4nC2shJSiPY1JQt0QDJ/DU4fw3jiAG 777os1J5oW0HPo7uvtQmnmS9Iq5q3MDV2cxKIu+qHlYr6xSX1xIu7eODKSHvWUywG2 gTuTH53PJ3eqZPg+V8CBeKyKcgxGdNiwbGQu4Fj8VWIun+n/d4MgLMY3HvXxC1ioWQ 0GjAibKH8uM7g== Date: Thu, 21 Jan 2021 17:07:05 -0800 From: Jakub Kicinski To: Ronak Doshi Cc: , Petr Vandrovec , "maintainer:VMWARE VMXNET3 ETHERNET DRIVER" , "David S. Miller" , open list Subject: Re: [PATCH net-next] vmxnet3: Remove buf_info from device accessible structures Message-ID: <20210121170705.08ecb23d@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210120021941.9655-1-doshir@vmware.com> References: <20210120021941.9655-1-doshir@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 19 Jan 2021 18:19:40 -0800 Ronak Doshi wrote: > From: Petr Vandrovec > > vmxnet3: Remove buf_info from device accessible structures Something happened to the posting, looks like the subject is listed twice? > buf_info structures in RX & TX queues are private driver data that > do not need to be visible to the device. Although there is physical > address and length in the queue descriptor that points to these > structures, their layout is not standardized, and device never looks > at them. > > So lets allocate these structures in non-DMA-able memory, and fill > physical address as all-ones and length as zero in the queue > descriptor. > > That should alleviate worries brought by Martin Radev in > https://lists.osuosl.org/pipermail/intel-wired-lan/Week-of-Mon-20210104/022829.html > that malicious vmxnet3 device could subvert SVM/TDX guarantees. > > Signed-off-by: Petr Vandrovec > Signed-off-by: Ronak Doshi > @@ -534,11 +530,13 @@ vmxnet3_tq_create(struct vmxnet3_tx_queue *tq, > goto err; > } > > - sz = tq->tx_ring.size * sizeof(tq->buf_info[0]); > - tq->buf_info = dma_alloc_coherent(&adapter->pdev->dev, sz, > - &tq->buf_info_pa, GFP_KERNEL); > - if (!tq->buf_info) > + tq->buf_info = kmalloc_array_node(tq->tx_ring.size, sizeof(tq->buf_info[0]), > + GFP_KERNEL | __GFP_ZERO, > + dev_to_node(&adapter->pdev->dev)); kcalloc_node() > + if (!tq->buf_info) { > + netdev_err(adapter->netdev, "failed to allocate tx buffer info\n"); Please drop the message, OOM splat will be visible enough. checkpatch usually points this out > goto err; > + } Same comments for vmxnet3_rq_create()