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=iZUx1r4n; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id C00595A0269 for ; Wed, 14 Aug 2024 13:04:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723633443; 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=F87NoxVEG01WwjDFWQxf/ka1+e++XWuTM1sjP/lLONE=; b=iZUx1r4nHkX+4i+5pWD7i8qJBUbB68j6cMucYwqr0Bt1eDzWGtGTdKJhqIRofXhSRi5+28 MpEq3JrwLrcYGsxmOT+LyKlFcx80qz5epBLaglXESV/MAxbL2oYmEQ0NWpvY7VtWQ5JF8q r6+LLu9eDCA1ZaRxN5nvNFudIiMqow4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-KRKt0ehBPDSUVPnHyYHdHw-1; Wed, 14 Aug 2024 07:04:01 -0400 X-MC-Unique: KRKt0ehBPDSUVPnHyYHdHw-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3717cc80ce1so113948f8f.0 for ; Wed, 14 Aug 2024 04:04:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723633441; x=1724238241; 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=F87NoxVEG01WwjDFWQxf/ka1+e++XWuTM1sjP/lLONE=; b=to5SN/B7QIEUN/n+nxU0Nid3Xqf0xbimgxeuEb01Ai/ERc2uXJcPvXQVo97mFPzmn9 zAR04EO8iEapNCCve6qsyJiVmmXBA3sOfnySw/6gs6G1kYBCbK0mO7kjDAwtN57Uvs0m khySLtOhbVqudrcKo6needAVk17cHItGpRRZEgnmm9Zd5xkruvFfbs2oA+mMZrn5+lvo kFCa3Ii9qMhj7cK0LaIYJIcM/yLX3cIXZKnKRAMaqspn0aT1R2EFxiQ95BYSlEVeqJ6D NMUCRYw8nUspN3FoZJZofkPZAbM/RigdrlHyELrNQgy+mPmkpzWtx/i1adsm89L8T33V seXw== X-Gm-Message-State: AOJu0Yw1Axz1lo+CRQkirlbChJwsnO/nIdglfeayJB/VVck8CyLN0KZO QiYcY013ZJtHsX91YyB22GAEMHr/SCGYkWlxd1n7PftiszMqkBHpX7N4mQgtIVwond62+mDroIH zTPVlxBOblaHcnPyDV/CFdsnayIx3GZABIlgzJC9j281X4GIsWw== X-Received: by 2002:adf:ee49:0:b0:367:9088:fecc with SMTP id ffacd0b85a97d-37177756c10mr1983319f8f.7.1723633440693; Wed, 14 Aug 2024 04:04:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1Y/Go8OvfSq2K6TODSztpOLNErCVsgqL97f45ZaitSvr0zreKv8dos7Me4f6O1HVOR+bDnA== X-Received: by 2002:adf:ee49:0:b0:367:9088:fecc with SMTP id ffacd0b85a97d-37177756c10mr1983297f8f.7.1723633440123; Wed, 14 Aug 2024 04:04:00 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4c936f5fsm12582075f8f.28.2024.08.14.04.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 04:03:59 -0700 (PDT) Date: Wed, 14 Aug 2024 13:03:57 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] flow: Don't crash if guest attempts to connect to port 0 Message-ID: <20240814130357.47da30ce@elisabeth> In-Reply-To: <20240814100333.706977-1-david@gibson.dropbear.id.au> References: <20240814100333.706977-1-david@gibson.dropbear.id.au> 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-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: SDTOODNLS6DF2PUQH36WW2C2LDPM55LX X-Message-ID-Hash: SDTOODNLS6DF2PUQH36WW2C2LDPM55LX 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, Matt Hamilton 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 Wed, 14 Aug 2024 20:03:33 +1000 David Gibson wrote: > Using a zero port on TCP or UDP is dubious, and we can't really deal with > forwarding such a flow within the constraints of the socket API. Hence > we ASSERT()ed that we had non-zero ports in flow_hash(). > > The intention was to make sure that the protocol code sanitizes such ports > before completing a flow entry. Unfortunately, flow_hash() is also called > on new packets to see if they have an existing flow, so the unsanitized > guest packet can crash passt with the assert. > > Correct this by moving the assert from flow_hash() to flow_sidx_hash() > which is only used on entries already in the table, not on unsanitized > data. > > Signed-off-by: David Gibson Applied, with: Reported-by: Matt Hamilton -- Stefano