Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp344995rdb; Thu, 8 Feb 2024 07:35:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IERH1YnuWAktsdP3crsDioL0iunGuJ/W6KcAKQNNiM4n3spzuxO8iDbIMOqA8QB2sGn9CS3 X-Received: by 2002:a0c:e487:0:b0:68c:8667:f77f with SMTP id n7-20020a0ce487000000b0068c8667f77fmr7621527qvl.18.1707406512960; Thu, 08 Feb 2024 07:35:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707406512; cv=pass; d=google.com; s=arc-20160816; b=P+7YmVqSa0umKRI3L4y+19h1eN0y8EJI9fJY11/r6j4xRXkzfq2SurCeDGlQkv+yJG MCms8rvxAuFy6xdZv2rKwRlTbpV3DDe1q4clXypeSNsCjZ6/ms2OzWgC7b0KdNzZew+p mL4gp6lBoihhLIgXSZsInOfd/ykG6HIUltBU8cKaxhimnR34faip/o0uc6xGZ9/L8E6S kaeHWOtL50jB6YrzBM8BVA67hLHsOy3Vi9zZ25dWDuwlGBYfQnywQtS7YceGFOmzw5wI sBqM/ypv5kaiOnqmDwU5Ii/QUi4SS/Rg4PJ40QPgtJQgYm0E8jcZJUVq4+1l4GMyY6rH NULA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8o7bUDuGuu2YaKsxQ+9DhHSbmvO5ysjRunyhwVyAC5o=; fh=flYpIcFuzm46V2K1GcjjvUqnxN8dlYT0CZWXmAavmWc=; b=WzNqLgneeq7E9zonH0xy3B3FMoOzbooFfGTP01qr/Yd7mxBTfspHaajLIKBNxhLJv4 97nO3y9WI+b5uz+pX1UmcIUfnfXh4y4xGbkNOwmEmFAjtovo1dCA1Wd1a4YjQJrVXyMt 6tG9pUbZKIjNzGRQdDZfG8pdo0MSLaPcjP/CO4KZFSPcrjAcdH+u1eK/GjS4o86zJKvQ bjN1HW5fwCGmPCX/OK9khUUZqbenfcnk2hUTImg107dA+lCPOiZxzQxCuLjA8JQt+k8W MSOLi/JNXttA2txJAccZkkUIp3EZd5jz7E+YA6LuCkZGINGKgSj6iEmP+mNIqEJeFmUk xCow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=25vftL2u; arc=pass (i=1 dkim=pass dkdomain=daynix-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-57756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57756-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCULcA13m2Z1C1xwWcKICLB9feE4sM0vI39AifHzyf+DbWYtDrieTRC/sPPliqxtw99ASbYPi5TsBFm7XZhzjt9J3BGQMR50kFt+IgJPsg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fo5-20020ad45f05000000b0068caf3955a8si220224qvb.441.2024.02.08.07.35.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 07:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20230601.gappssmtp.com header.s=20230601 header.b=25vftL2u; arc=pass (i=1 dkim=pass dkdomain=daynix-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-57756-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57756-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 211D81C2675E for ; Thu, 8 Feb 2024 09:35:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DCFC6D1AC; Thu, 8 Feb 2024 09:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b="25vftL2u" Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 049A66BB4F for ; Thu, 8 Feb 2024 09:35:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707384909; cv=none; b=fZsiEInKVgsFy8xZJD6wbrthrtNcMYy/zEPsGpcSBYqPwy44g61bReMi623RwKEJbzRQExYEl//i+C/k804mPU0DxU9uZFjj2MWixHB2kxiwkVRKldPphfSSfBhplM89KhTh8E3CPwG9RgR0iUNrxdwvzk4UiRsdQ8P8ZGj2b7Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707384909; c=relaxed/simple; bh=PL4bURsXss2T7/h04cdjZreNU22ZlKTVyPSJ+8zE40c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=EBNIx8zVp+HwTL24HR1ZYyyJc7z+Hk5baaLkENy80/EwiIyrZjuBTilU7h9fIoqAKxlpHxu8k9KC1acGbx5UhAoj9I7bZZC3bCINJLPO+4HlIeNpleK+oAKtyggnv8lbQhlIZUEDmiegq9I1J42N1PB0y5XBubRtRx1X7FXKQfU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com; spf=none smtp.mailfrom=daynix.com; dkim=pass (2048-bit key) header.d=daynix-com.20230601.gappssmtp.com header.i=@daynix-com.20230601.gappssmtp.com header.b=25vftL2u; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=daynix.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=daynix.com Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5114c05806eso2386595e87.1 for ; Thu, 08 Feb 2024 01:35:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1707384906; x=1707989706; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8o7bUDuGuu2YaKsxQ+9DhHSbmvO5ysjRunyhwVyAC5o=; b=25vftL2u489vuD0qEkL8zYrgDNocyALeu8iRRrS+EBV5H/Wa76XA2SWCZywpvkFrss 21dGwNjDQAH/O+mhYIyHadweU7te0FolLEhuJuOnDAg8rws4eJGGgelDxHWsnh0qEo8y mU8iyuL8Q0R5EBEDPte5a9eO0QBUt8jM0zQLh0hSKecymXyofWTAouvOJmlxz8uGwhb1 Z6yo3Z+H6aIAX6RQzSEbXfhlQ7CXtgZLTeWTBs99K7smDKBk0l0/4g6NlFmt3RCp2u94 yYGAWzILL8qRa4OcIxCBIMiDdchAX58Hm/NVU/wPAL2hNjYjznL8UNYsyBP8m7uY/D9t Vcdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707384906; x=1707989706; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8o7bUDuGuu2YaKsxQ+9DhHSbmvO5ysjRunyhwVyAC5o=; b=scaGxLAGXGYGhCrOytjNdbOFbiLaLvEGThBnmASIp68Suo6yj7IrR9BbnkVQq995UA v7P/9UcMTnV4HgppCHPJ5vQayauppavEvJ3tCHsB7E1jXPyWGjGAnQ9G8SfImdVCf1MK +hL9QtmOnZKHGG3J5yShJ7oUeI10f0g/NEYtNovtau71jAWxdsDKTY43najTbd33+m2h 0gTGkMGsUBchHvC6fPS0do5DUiwBhgeG6FNysHWWo9nNL6qTBhnER0SefarliRkJN1E2 W+IilYvm81ZFf4kRtNZiB50hc3v9rZ0OWotVaueQluagUlHkWDdRpwW36R6+c45S6Duh 81tA== X-Gm-Message-State: AOJu0Yy6T48IdiAhOd66mqnztehhWqtjUw96gGhjOSaOUEvAzLwHMDW3 hdJUDHmVjbcopBh5cb+IgcItGK0DoaOI4PuRduEKn3vnAQiwPW3+kD1lR/og+whmDiGsMki12lW 30czqxh/kDo0H1of3oSJWwtjb36lC20tWt6wA4g== X-Received: by 2002:a05:6512:3c88:b0:50d:f81e:6872 with SMTP id h8-20020a0565123c8800b0050df81e6872mr8479864lfv.10.1707384905935; Thu, 08 Feb 2024 01:35:05 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240115194840.1183077-1-andrew@daynix.com> <20240115172837-mutt-send-email-mst@kernel.org> In-Reply-To: <20240115172837-mutt-send-email-mst@kernel.org> From: Yuri Benditovich Date: Thu, 8 Feb 2024 11:34:53 +0200 Message-ID: Subject: Re: [PATCH 1/1] vhost: Added pad cleanup if vnet_hdr is not present. To: "Michael S. Tsirkin" Cc: Andrew Melnychenko , jasowang@redhat.com, kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yan@daynix.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Just polite ping On Tue, Jan 16, 2024 at 12:32=E2=80=AFAM Michael S. Tsirkin wrote: > > On Mon, Jan 15, 2024 at 09:48:40PM +0200, Andrew Melnychenko wrote: > > When the Qemu launched with vhost but without tap vnet_hdr, > > vhost tries to copy vnet_hdr from socket iter with size 0 > > to the page that may contain some trash. > > That trash can be interpreted as unpredictable values for > > vnet_hdr. > > That leads to dropping some packets and in some cases to > > stalling vhost routine when the vhost_net tries to process > > packets and fails in a loop. > > > > Qemu options: > > -netdev tap,vhost=3Don,vnet_hdr=3Doff,... > > > > Signed-off-by: Andrew Melnychenko > > --- > > drivers/vhost/net.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > > index f2ed7167c848..57411ac2d08b 100644 > > --- a/drivers/vhost/net.c > > +++ b/drivers/vhost/net.c > > @@ -735,6 +735,9 @@ static int vhost_net_build_xdp(struct vhost_net_vir= tqueue *nvq, > > hdr =3D buf; > > gso =3D &hdr->gso; > > > > + if (!sock_hlen) > > + memset(buf, 0, pad); > > + > > if ((gso->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && > > vhost16_to_cpu(vq, gso->csum_start) + > > vhost16_to_cpu(vq, gso->csum_offset) + 2 > > > > Hmm need to analyse it to make sure there are no cases where we leak > some data to guest here in case where sock_hlen is set ... > > -- > > 2.43.0 >