From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 36878A0C4A; Tue, 13 Jul 2021 11:34:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBF1F411F9; Tue, 13 Jul 2021 11:34:29 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 83733411BD for ; Tue, 13 Jul 2021 11:34:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626168867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fM3HDWrR5HJ6qCrTtnpjoKlTlRx0k1lIt2B9LxST2bM=; b=AIgS+xEFO9u9eO8gBvV4ZZKwnVN2eRl9dp313YQ2g2KqAgWGS85ifgk+rzHQ0K57C9v/Iq JB68olwnv76p/7mxdMpw+Mwn1cYntuHqV9DELAfxjHiK0PIOJE+ajCnUdprsdKeQCy/erK MN2+Kd/eZ7J2OdvgaIdmZJLsvwH1A7U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-575-bYcDHb3yNIapZx-jvF2DDg-1; Tue, 13 Jul 2021 05:34:26 -0400 X-MC-Unique: bYcDHb3yNIapZx-jvF2DDg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 48F43100C611; Tue, 13 Jul 2021 09:34:25 +0000 (UTC) Received: from [10.36.110.39] (unknown [10.36.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 60A3C5C1D1; Tue, 13 Jul 2021 09:34:20 +0000 (UTC) To: Xiao Wang , chenbo.xia@intel.com, david.marchand@redhat.com Cc: cheng1.jiang@intel.com, dev@dpdk.org, stable@dpdk.org References: <20210317063109.135662-1-xiao.w.wang@intel.com> <20210621082104.76733-1-xiao.w.wang@intel.com> From: Maxime Coquelin Message-ID: Date: Tue, 13 Jul 2021 11:34:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210621082104.76733-1-xiao.w.wang@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v5] vhost: check header for legacy dequeue offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Xiao, On 6/21/21 10:21 AM, Xiao Wang wrote: > When parsing the virtio net header and packet header for dequeue offload, > we need to perform sanity check on the packet header to ensure: > - No out-of-boundary memory access. > - The packet header and virtio_net header are valid and aligned. > > Fixes: d0cf91303d73 ("vhost: add Tx offload capabilities") > Cc: stable@dpdk.org > > Signed-off-by: Xiao Wang > --- > v5: > - Redefine the function parse_ethernet() to parse_headers(). (David) > - Use mbuf helpers e.g. rte_pktmbuf_data_len() and rte_pktmbuf_mtod_offset(). (David) > - Reset mbuf l2_len, l3_len and ol_flags when detecting anything invalid. (David) > - Improve some check conditions. (David) > - Move the data_len check for L4 header into parse_headers(), in order to avoid > duplicated checks in CSUM and GSO. > - Use uint8_t instead of uint16_t for l4_proto variable. > - Detect more invalid corner cases. > > v4: > - Rebase on head of main branch. > - Allow empty L4 payload in GSO. > > v3: > - Check data_len before calling rte_pktmbuf_mtod. (David) > > v2: > - Allow empty L4 payload for cksum offload. (Konstantin) > --- > lib/vhost/virtio_net.c | 117 +++++++++++++++++++++++++++++++++++++------------ > 1 file changed, 89 insertions(+), 28 deletions(-) > Thanks for the fix, it looks good to me: Reviewed-by: Maxime Coquelin Thanks, Maxime