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 E16458D8D; Sat, 23 May 2026 02:13:33 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id C4AA28D80; Sat, 23 May 2026 02:13:30 +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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) by atuin.qyliss.net (Postfix) with ESMTPS id B16028CFF for ; Sat, 23 May 2026 02:13:29 +0000 (UTC) Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-7c0dea734b8so76506647b3.3 for ; Fri, 22 May 2026 19:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779502408; x=1780107208; darn=spectrum-os.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=EVAy2N7dENytRYyjuuIQzoC2VcTAeFY/cEVS/jn2bhI=; b=GJTO1kv1LGXrL2oqyDLWiqn5aeAtn4avN3FBJyJYgk47dYoQIjyGtndLg0EsBAp9Gj VBNKRymDh8YYkSxDGBt7X5PJpTSiJMwetiaFfdtreZA/FtwkvGmBw2enSvFkNIMuJtVX C4HC3nEkazzg/gsCMRVpcXO2/IIn99pU7OsTEGDBPJ+ZEw6HpkFI2fm4m6tOPRGOBKn8 bP5HA1y6ZVxRMOOYTQ/HVjIB8Xm75Er4AHsAEJGIc4XINKMyQ4w5EC3xLYcaweZw+K1m X5PXbRSaJgCvsqkkr3qD/gBzWb8H20xQUVplcqArw7a542mkLac2wX1Yp4Zf3jNdsbZ0 Mr4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779502408; x=1780107208; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EVAy2N7dENytRYyjuuIQzoC2VcTAeFY/cEVS/jn2bhI=; b=M6uJBuemmjmzJWVggkIlEIQuzHewB/hzzCzYFrnd/8vvjeuwEN78/B67w6ulBsv7N4 l0iYqApgmkz1/lDDj43nAVOTmF0CzQkL2X6Lm+/T7kMsrE4Mrysgld38Gxh60SpFCzeD UhsFHJlmw8/gcuFIgk1OxP+4l6nEG9ZuYltNOrO2rD8cWWg4kkMobzSLXVhufhfw6Pft qcqfkPlcHYbAbXrE7ytbwPKlEkdhjlT9pa9mjMRf00Amlc8lfaDSOpZh4Syk0LDsH/0q 289aoc0gusbmdClkMK6nBA5lUAMvRxe5fJ+0aNGiKlA41SJPgZWjjTV0+zPoe9UHhSGm N9Lw== X-Gm-Message-State: AOJu0YzIRzAKdMoKP3kzpkP5D30e1PhXDu2tSn3/tC2pi9jGcD1xy88Z a9kkiaTqYBK0jyBS3DnzbCwwd5Tmus3WyNE4U1P4q0yipBIA1QdkOwla X-Gm-Gg: Acq92OGt1RAzCGghClAsJjfagrblXWZmFgIfYvvMEYu7/9/0txFMV0YOcZcOrTODBNE p/LfnQQxbM0Sn0dHnQINGw/IbVJyypRYXlx0CKV/cLZ3DQOUkN8pGlWxPdfTwYzjLe7xIxpisnb Lt1XNaSRUXTgljWNJU3x78H8WUpTUHDbtkgIZ/IBOD2heHGpAulki3KjC89+t1UQxxuYtRcOsHc zJJd/VkGOk5RRcmA6SvKuR6qP+xExkfy3Z55B5i/R0IVi39fOzoyRKYSPMP91t3oUn7gc8LtDl8 37COPpB/yfCX3QZ8jSzxD06ieQvDyrIb8CfGeTHtNrvmAI+7QRcnlusnVavHejLEjsVVTk52TIt S61Bty/y7+RCPEZkWufW+2ye/PryGpnlchlsXGXU20Mc8pIqwXv8nX/p0OYBdi78nXfeZUxA4Aj xW1KQBwikybXpJr2FcUfY410Urh9R5pwvzUpGivdMwFMZ2NrXsG+yVDpWjpoDb6D8W0RfsAM7qN L7yZepirAMoTOPimuP88KmobZQad7xklqYAUuiap2cUniA= X-Received: by 2002:a05:690c:7402:b0:7bd:4792:671e with SMTP id 00721157ae682-7d3368b514emr72489927b3.44.1779502407651; Fri, 22 May 2026 19:13:27 -0700 (PDT) Received: from localhost.localdomain (h69-131-147-66.cncrtn.broadband.dynamic.tds.net. [69.131.147.66]) by smtp.gmail.com with UTF8SMTPSA id 00721157ae682-7d389813ea8sm16006237b3.4.2026.05.22.19.13.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 19:13:26 -0700 (PDT) From: Demi Marie Obenour Date: Fri, 22 May 2026 22:11:09 -0400 Subject: [PATCH] vhost-user: Guarantee that memory regions do not overlap MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260522-vhost-user-dev-v1-1-b31646cf19b8@gmail.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/x2MQQ5AQAwAvyI9a0JlCV8Rh40tekG2bCTi78rc5 jBzg3IUVuiyGyInUdlWkzLPYFz8OjNKMAcqqC4cEaZl0wNPyzBwQu+bmqvWfYBFe+RJrn/YD8/ zAsb2tURgAAAA X-Change-ID: 20260522-vhost-user-dev-aa76e3955555 To: qemu-devel@nongnu.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779502268; l=2474; i=demiobenour@gmail.com; s=20260522; h=from:subject:message-id; bh=DcOvHMZTfNqa4d8WJ/QyRMi1J6muszY9M8HHPZXQ7vY=; b=P6MyBWf+HUUR0O47l18m77HSa2SgibTdPuXKo7oP12nCRmEfopNUBi+7BGQt75PI5TAXiyFa2 ovTIezBvYx/C36hk1CmMBa5oM/mVM535NBAcmjwASkZXIyonWU+7P8o X-Developer-Key: i=demiobenour@gmail.com; a=ed25519; pk=nGU95VwdzJC/7FntDm86n3631qniCqHTUlkeI9mftck= Message-ID-Hash: X3ACPOTCYOXC6ZBOKI6CKNSFSUSSSIZX X-Message-ID-Hash: X3ACPOTCYOXC6ZBOKI6CKNSFSUSSSIZX X-MailFrom: demiobenour@gmail.com 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: Spectrum Development , "Michael S. Tsirkin" , Stefano Garzarella , Pierrick Bouvier , Alyssa Ross , Demi Marie Obenour 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: Otherwise there would be an ambiguity problem. Suppose that: 1. There is a region from [0x40000, 0x50000) with mmap offset 0x500000. 2. There is a region from [0x48000, 0x58000) with mmap offset 0xA00000. A request has address 0x44000. Which mmap offset should be used? This problem appears with both guest and user addresses. Signed-off-by: Demi Marie Obenour --- docs/interop/vhost-user.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 137c9f3669..8c122c9d21 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -204,6 +204,18 @@ fields at the end. :domid: a 32-bit Xen hypervisor specific domain id. +For all memory regions active at a given time: + +- ``[guest address, guest address + size)`` of one memory region never overlaps + the ``[guest address, guest address + size)`` of another memory region. + +- ``[user address, user address + size)`` of one memory region never overlaps + the ``[user address, user address + size)`` of another memory region. + +Violating any of these is a bug in the front-end. This ensures that a guest +address or user address always refers to at most one location in memory. +The front-end must remove a region before it can add an overlapping one. + Single memory region description ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -672,6 +684,15 @@ The front-end sends a list of vhost memory regions to the back-end using the ``VHOST_USER_SET_MEM_TABLE`` message. Each region has two base addresses: a guest address and a user address. +Memory regions can be added via the ``VHOST_USER_ADD_MEM_REG`` message. They +can be removed via the ``VHOST_USER_REM_MEM_REG`` message. These messages can +only be used if the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol +feature has been successfully negotiated. + +Guest addresses are physical addresses in the guest. User addresses are +arbitrary opaque values, though they typically refer to userspace addresses in +the client process. + Messages contain guest addresses and/or user addresses to reference locations within the shared memory. The mapping of these addresses works as follows. --- base-commit: f5a2438405d4ae8b62de7c9b39fac0b2155ee544 change-id: 20260522-vhost-user-dev-aa76e3955555 Best regards, -- Demi Marie Obenour