From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 596551779B; Mon, 01 Sep 2025 14:00:18 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 46CC217781; Mon, 01 Sep 2025 14:00:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fhigh-a1-smtp.messagingengine.com (fhigh-a1-smtp.messagingengine.com [103.168.172.152]) by atuin.qyliss.net (Postfix) with ESMTPS id 055C6176FA for ; Mon, 01 Sep 2025 14:00:12 +0000 (UTC) Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 3ACA61400212; Mon, 1 Sep 2025 10:00:10 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Mon, 01 Sep 2025 10:00:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1756735210; x=1756821610; bh=r9CDN6Wl2j pDPQrwFPYH0d14Lmgmyiw9Qu807ZemFeQ=; b=piVdJdeqMw8PLxrdXcq2KooF7Y VkyzNHFEYo9MVgsWkBYsqKW4ISO824341HYb2olKNU12O2nOTxZOvmK+7ku0ggxk +yuBwIcVDRl3li3Hr2WBC1sGOzhjwLEQT4s+M+mB5Ea1MyGSHhknS0Wp/PQPpJBr W9CpJ0yA5pIYJ5PGWHLKkumXuI3ZIAjfiX7l53O1H/u82N1RQhtIJ3J3T/I5eitQ EeKuueP1MM3BO8kUuimOkOumOj7MItz1TrEfIjmHWCwx/d3bXp0nNdkZSdjAyg2a jCUVkm3KnkDi1py74zdKgPm4AMKndta3eUs8i+kfj+a8VY3ngMmXJqgPhhwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1756735210; x=1756821610; bh=r9CDN6Wl2jpDPQrwFPYH0d14Lmgmyiw9Qu8 07ZemFeQ=; b=Q5l6JrYvQQqiXLM132jeYze6oNj6vjanrOZpw/lgSSZgLJw5Y5+ GFSPdDcYxN3talYt7L2c8jeOd6eWZVIsXQZjDwl5E5/6cVD94hJaJvVgxVTvxFXg FV09NdLYy2G/7vC+Lvm7LKjzpAl6ikGA0A3HnDVc0CsgB+ERGp98r10IbHp79Ek7 /TlPxtuPcsMK/P6tg1bPhyvEHB9rSjzsahncYGP71ZmWoHs03hU61YC+wEoxRpsi 6hLTqH5IKqjlNMb2txcqg0ZtXrwJxzCO4YY6B92tDGqIBaJeW/edHsX3qcxRWehC w6EzJw1eg+ikM8XevI74KjXlh8liM9C5Fog== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgdduledvfeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufgjfhffkfggtgesghdtreertd dttdenucfhrhhomheptehlhihsshgrucftohhsshcuoehhihesrghlhihsshgrrdhisheq necuggftrfgrthhtvghrnhepieduffeuieelgfetgfdttddtkeekheekgfehkedufeevte egfeeiffetvdetueevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghi lhhfrhhomhephhhisegrlhihshhsrgdrihhspdhnsggprhgtphhtthhopedvpdhmohguvg epshhmthhpohhuthdprhgtphhtthhopeguvghvvghlsehsphgvtghtrhhumhdqohhsrdho rhhgpdhrtghpthhtohephihukhgrseihuhhkrgdruggvvh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 1 Sep 2025 10:00:09 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 815B615EF42C; Mon, 01 Sep 2025 15:59:58 +0200 (CEST) From: Alyssa Ross To: Yureka Subject: Re: [DO_NOT_APPLY 1/2] integrate xdp-forwarder into net-vm In-Reply-To: References: <20250823222134.1772413-1-yureka@cyberchaos.dev> <20250823222134.1772413-2-yureka@cyberchaos.dev> <87bjnxt6qn.fsf@alyssa.is> Date: Mon, 01 Sep 2025 15:59:57 +0200 Message-ID: <87ms7ep92a.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: SQRQPIJTPLMURXFCIR73632WCIPY5Z24 X-Message-ID-Hash: SQRQPIJTPLMURXFCIR73632WCIPY5Z24 X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: devel@spectrum-os.org X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Yureka writes: >>> + >>> + /* Byte-count bounds check; check if current pointer + size of header >>> + * is after data_end. >>> + */ >>> + if ((void *) (eth + 1) > data_end) >>> + return -1; >> This is checking that there's more data after the header, right? Is >> that something it's important for us to check? > > The intent is to check that the entire eth hdr, which we casted a=20 > pointer to, is within the data (length) of the packet before we=20 > de-reference the pointer. So essentially, skipping packets which do not=20 > have a full ethernet header, instead of reading from addresses which we=20 > are not supposed to read from. > > When loading the XDP program, it is tested against an empty or very=20 > small packet, and if it tries to access memory outside of the packet=20 > bounds, it will refuse to load. So the BPF/XDP system ensures that these= =20 > kinds of packets are handled properly. Doesn't using > instead of >=3D check that the entire eth hdr **plus one byte** is within the packet, though? i.e. wouldn't this check fail if the data consisted entirely of an ethernet header? Is that the right thing to do? (Sorry if my maths is just wrong.) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaLWm3QAKCRBbRZGEIw/w ovsIAQDG75W3NAl2RrvUUer5ZJTesvAGK8i+uMTvVmxn2PniogD/d6p2XTnyD+dZ XKX8nJi+6m/YjHYgGjIpWNlVH9D7hwE= =YBLL -----END PGP SIGNATURE----- --=-=-=--