From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LL1+b92v; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id F342A5A0623 for ; Thu, 14 Nov 2024 15:23:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731594206; 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=R+YCJ62DTb+Ksnq4pQD+b2Y0rtgdRKHVSWoLMKYwdlA=; b=LL1+b92v3Tetuj1wKGWSRkRvtOtFCv5vxSDqYelA+z8kV9+iQO8oZ+rABzybzI3ljEQCy5 Zw7ZL83xUOazwrQn/cnhhctanFq36jvpgGrjT+z/mXxuev5UUcqpp3mAps6XqUnatz0CUz MCle5qisVxV9Ho7rL9me2knI7My14gs= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-rFKQRiWpPxm78RHsROYzmg-1; Thu, 14 Nov 2024 09:23:25 -0500 X-MC-Unique: rFKQRiWpPxm78RHsROYzmg-1 X-Mimecast-MFC-AGG-ID: rFKQRiWpPxm78RHsROYzmg Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4316655b2f1so5256845e9.0 for ; Thu, 14 Nov 2024 06:23:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731594203; x=1732199003; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=R+YCJ62DTb+Ksnq4pQD+b2Y0rtgdRKHVSWoLMKYwdlA=; b=d56WQTojQBOSlmEOA/yeYdqg2TEwFZIo9/gFdIGCCR1vILaGq+lOy+AFIay2hGuOmH 7XYlbU3nJUCr8/hisy1MZuCR+qsdXjcO0h2d81/REuxtXRjJufdWoGoXpqdsoGSOtdwZ RFICResBe2Iz6jrJU2g9isJ1Cdqk/CN56/rV4hYWmjHMNOumdNdLasNiyYsV9U1NjU/P xfK2YvTRCeZxOm/G21trT+OwUudOSAnUugB18vcu8VJPi3YxTMb5Fow47YordqDwHmaI BKm/nuZEtz+ny0EtPxE5RybJ3QmS6Y3wtxomO3YmUldbIPGRZq3zkt541yo4Od4QjoVd TdIQ== X-Gm-Message-State: AOJu0YwbV3Zljm97bMxg2Qbhcipa8ajkGCQCInc3q4Is9dpmZBghXH89 bzzsGVynbBPEKH4C6mtoDNlY+0SHIPEbuVftWHUVLPPJo0zDwgohxsSrzpNnbgWdxOXF8REw3sn MSfGUthW01+eCHJeFPqRWbFTO/Q974aOBamv53r3txpQa9ga7jWOpTj5mltYqBCmYJysWGyYBuX QygMZYAP3nio/JAdIA4Wkd0V20TUZ1cnvK X-Received: by 2002:a05:600c:1d88:b0:431:5a27:839c with SMTP id 5b1f17b1804b1-432d4a98364mr66077225e9.5.1731594202911; Thu, 14 Nov 2024 06:23:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IEvP4A561uGXHa9dASEfaPx4/BghjGVRsFsYhdXZlT6/422CxfLG0YBVy8rOzGEPFVE/KupTw== X-Received: by 2002:a05:600c:1d88:b0:431:5a27:839c with SMTP id 5b1f17b1804b1-432d4a98364mr66077005e9.5.1731594202525; Thu, 14 Nov 2024 06:23:22 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-432da2658a8sm26269295e9.9.2024.11.14.06.23.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Nov 2024 06:23:20 -0800 (PST) Date: Thu, 14 Nov 2024 15:23:19 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v8 7/8] vhost-user: add vhost-user Message-ID: <20241114152319.722bff4e@elisabeth> In-Reply-To: References: <20241010122903.1188992-1-lvivier@redhat.com> <20241010122903.1188992-8-lvivier@redhat.com> <20241017021034.437f3757@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: O90Ec5AZPhDzu1j7JWu2UqOuGc0ZbYd3tXnVZ29NJEs_1731594204 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 7MKSU5IFRDSSBVVPHWKOLZUYZSQOVM25 X-Message-ID-Hash: 7MKSU5IFRDSSBVVPHWKOLZUYZSQOVM25 X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, 14 Nov 2024 11:29:36 +0100 Laurent Vivier wrote: > On 17/10/2024 02:10, Stefano Brivio wrote: > >> +/** > >> + * tcp_vu_prepare() - Prepare the packet header > >> + * @c: Execution context > >> + * @conn: Connection pointer > >> + * @first: Pointer to the array of IO vectors > >> + * @dlen: Packet data length > >> + * @check: Checksum, if already known > >> + */ > >> +static void tcp_vu_prepare(const struct ctx *c, > >> + struct tcp_tap_conn *conn, struct iovec *first, > >> + size_t dlen, const uint16_t **check) > >> +{ > >> + const struct flowside *toside = TAPFLOW(conn); > >> + char *base = first->iov_base; > >> + struct ethhdr *eh; > >> + > >> + /* we guess the first iovec provided by the guest can embed > >> + * all the headers needed by L2 frame > >> + */ > > What happens if it doesn't (buggy guest)? Do we have a way to make sure > > it's the case? I guess it's more straightforward to do this in > > tcp_vu_data_from_sock() where we check and set iov_len (even though the > > implication of VIRTIO_NET_F_MRG_RXBUF isn't totally clear to me). > > According to spec, minimum size of a buffer is 1526 bytes > (https://docs.oasis-open.org/virtio/virtio/v1.2/csd01/virtio-v1.2-csd01.html#x1-2340003) > > So if the guest is buggy, we will write in the guest memory out of the (buggy) provided > buffer, and we can crash the guest. But it's what happens to a buggy guest. > > We can't fix the guest, IMO passt should crash in this case (add an ASSERT()?). I think we should rather call tap_sock_reset() (see tap_passt_input()) so that the guest has a chance to reconnect (you implemented this in QEMU...). -- Stefano