From nobody Sun May 24 19:33:39 2026 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 C01C9367B66 for ; Fri, 22 May 2026 17:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470517; cv=none; b=A8gNAnGXPM4nGnJIXn4LBEgdArdh+ou2J8Pw6O/3kfIY1juhpc/r5NH8QobdP6oo8wxH3CsRVMoySt67TTI2korzL+ViKf6z3IwRhsMDfnQqFMMCbNLRrTBpP1Gzyjx22JOeK+FbdLQUGOUk3o1pmYY5yQUVq23fzraOkuTh7FI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470517; c=relaxed/simple; bh=ayQtNuu0KAGI/GVpUUq/PzEm+KPC5bq0/iohzWO2RXQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=jY7u2jm7jGfJQ6kczfOIpeAUtO7EH0Vs80M3tL2nlgenrsITnHMU/1p9v9B2zePkmX3BrLq7rNtUvHBx7pmuxOW9VLghLfCg3CbZFDS4EcOIpyMyv0WRKPViO2dmsqHoPMTvhXN8YxPIe2g4ieNlZRihTurzkttQqBldE1YQlYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UVSufxdN; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UVSufxdN" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-83f24cd00f8so4065567b3a.0 for ; Fri, 22 May 2026 10:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779470515; x=1780075315; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=yzw6ZBZmJ6GLsKKeZffOS4D7Mu6oc4MX0x50fzU1G54=; b=UVSufxdN6A8mHOcpDPxbQOi3K0fT1Q/SQu8erU7w8b0rZIWbx6tjGMPE53cpDXvjOw ovznUYEx/iXb6N4n5heqnJ2Xa4Y1fnVFA1t4kxY9kK6mDDNUxxWYpWZtczEnbusjKlNF r88FY8evtBzCOBt1vHA1MFXVL381kSVlq7NPqS3RQUldRTq+NftWaZIfJrOuBDwAQWfN fiWWiIQOvvAEoRHuHVnB+kqTHEUJ7Zu7EGPR+G/LdEQh9zadQjfMsBf7HAOtfHA5O0vG yhIHh2/e5VgDzL/tEu1XLB+GEmVutFA+Nn1iQfBTJYEkNyDqOzr2+N592qp+e+qd7f4V oBhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779470515; x=1780075315; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yzw6ZBZmJ6GLsKKeZffOS4D7Mu6oc4MX0x50fzU1G54=; b=aa3xzIYgw0NYT29MfpMTbazaF6QfmpJzBKyPaZxAAfe5aA/pUMxf7AKceL0dA/OAmx INsJXfRdxyrWUSv2Y/XhJtsRpjXep+pVMZvtsfh9KkoYrnFIe2h+iU7oq754jjw9g7Rm U8DikQUQgtajAnF5g05duPMOa1NUA3LGup78rqvusv5UmrHMgmX6t74a8L7kYX25Xba6 Uey1xpCAGmgaaQsh216L0cZk3FCGADxwX/v+3o13WIe8kPWHVkMRpXQmbkZZ0rK6KIe+ q596x+ThlK/5UwGmAFCm28AoDbOxNtLf3BsomL5MuluIPyO/8BmG3u9OslJ1YGnSe7De bNjg== X-Forwarded-Encrypted: i=1; AFNElJ9h/jih5UT/rAQH07gAIWNsJIgwzVfs6QzMciB7NVuT9NeUXcFYKrrmmKqgiy4zoeVH3W7PJ2OgutDkR3Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxBz1vstLSjT9+ebKX1zWilu4zDauSHUmJiyJxSxMhk4uZcfmtr E+felXt4guT6xroueq8S2qQ5tO/CJIP2bWp65foHaclUBvI0eip2fCpj7tzSJz3hJs4nFSh+Esb 35x5faw== X-Received: from pfbkt5.prod.google.com ([2002:a05:6a00:4ba5:b0:82f:9be8:3f2c]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1ca8:b0:837:6bb9:acd5 with SMTP id d2e1a72fcca58-8415ef52165mr4423320b3a.0.1779470514560; Fri, 22 May 2026 10:21:54 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 22 May 2026 10:21:49 -0700 In-Reply-To: <20260522172151.3530267-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260522172151.3530267-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.794.g4f17f83d09-goog Message-ID: <20260522172151.3530267-2-seanjc@google.com> Subject: [PATCH v2 1/3] KVM: guest_memfd: Return -EEXIST for overlapping bindings From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zongyao Chen , Ackerley Tng , Sean Christopherson Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zongyao Chen KVM_SET_USER_MEMORY_REGION2 rejects guest_memfd ranges that overlap an existing binding, but kvm_gmem_bind() currently reports the failure through its generic -EINVAL path. That makes binding conflicts indistinguishable from malformed guest_memfd parameters. Return -EEXIST when the target guest_memfd range is already bound, matching the errno used for overlapping GPA memslots and making the two types of range conflicts report the same class of error to userspace. Note, returning -EINVAL was definitely not intentional, as guest_memfd support was accompanied by a selftest to verify that attempting to create overlapping bindings fails with -EEXIST. Except the selftest was also flawed in that it unintentionally overlapped memslot GPAs, and so failed on KVM's common memslot checks before reaching guest_memfd. Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-spe= cific backing memory") Signed-off-by: Zongyao Chen Reviewed-by: Ackerley Tng Tested-by: Ackerley Tng [sean: call out that the original intent was to return -EEXIST] Signed-off-by: Sean Christopherson --- virt/kvm/guest_memfd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index 69c9d6d546b2..46727539d08a 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -675,6 +675,7 @@ int kvm_gmem_bind(struct kvm *kvm, struct kvm_memory_sl= ot *slot, =20 if (!xa_empty(&f->bindings) && xa_find(&f->bindings, &start, end - 1, XA_PRESENT)) { + r =3D -EEXIST; filemap_invalidate_unlock(inode->i_mapping); goto err; } --=20 2.54.0.794.g4f17f83d09-goog From nobody Sun May 24 19:33:39 2026 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 EE92D36A340 for ; Fri, 22 May 2026 17:21:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470518; cv=none; b=W5TqxAU7TTUbPmaSQ4T7q5g0MqqlX24QRM1btF2wN0YaDBLoJr85VGtabOXEvC4rfXM49RANZH9AqGYQj139nS55EbaB3CngWDl8PfBasTmj9gHqNDe6hJiZNKmtqjvDhpUJVbISYrA2VtjDLFFI/Hit0aD8ZeMRnPqaAQf2VdI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470518; c=relaxed/simple; bh=8VUw56+T3RjvwctLlOGVrHVP61jIETZcQoXLXcNsDuU=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Gs/cyo57pdMP0iRovszZ2cLRRBtm6XfTgyq+eyKGlmLKe7NzKGvj7QOvgKdFnJpGyMqISX3INvuz1qzHZ+vO3qc4BS9cVK/9/w6cyrBe8nhc/Tih1ou8z2Vl/S0EDAHK+syPtCO2r9IuJvdZPmHW22Sm4ru93YEcDCdWtD6zbJE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=IQ7rUdzn; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="IQ7rUdzn" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-82fa7c6699fso11631253b3a.1 for ; Fri, 22 May 2026 10:21:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779470516; x=1780075316; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=/d3jj67pPnoaU6PwH8tPSTkB0XF7ZYOVQlKJMFXSJsU=; b=IQ7rUdznM+G0WC8sCpuMb2CfjL+VB4WIoqHctyR+Uacytih8Rop5VuZ6njtQb0Npt7 njlqpw0qMDHvudoD5qKUaop20ke4K3YWdXd7NhRyDu45QDyp4cQKXcXqtNzbdwjAt6CL f5IdujpQ4pOKHwj/NnCOCuHTKgAAVP5haM8y4YkNTn+MpVPuIi0hCe/cy5XkOy7z00yd yrPKrz6fv6MuCLPui1EGnIQP+rRLxj3OuJokZu6UC7tBCWEpCPYGNFUMrF8TRKZ19vwi wdXMVkjIIF/V1ZUd8v7mbgSuyqaf3WoTnLTkqH3ZT24wYRE6qTaYGvdMMGu+6+aJr/CF gXxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779470516; x=1780075316; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/d3jj67pPnoaU6PwH8tPSTkB0XF7ZYOVQlKJMFXSJsU=; b=VAHsHC0W4XEjCGze5bkmaodIuFoY1LWZ+SsYSpLz7V2xA499lI9OIT7kygZFdsP1m2 uUNAYP3Xfwm+Gkv7vGBJAqhJFbhMYqz63F2ox9PT/UFT+4C9YOaX7uOBI1s/zsHbVz3+ QLQOGNx0uR3ZqUqdnTCoLXoq5skqbluHA5f5QmV1uunoxeanno/HQmROWox89tPA/f40 QPXR2GtYGklYKDmxCrgKKZI8HzAvyxEpXP7Kcb3bLFcj5q+lIuC+N1E+wEUFYKnPisBb Fb/o1Os0dQOMPhTHY3qVXVFFeMRxCS+65tbFBM42JeKcjDFJjbOPZYoAJBazHw/r/n+l aazw== X-Forwarded-Encrypted: i=1; AFNElJ9XC0wANlo21Ti5Jg6d5R/TGQFz/2mEwWw/qA+SsWwddKEpO8c71yUzvCLDOp/8pGe6ERcEx4R+bhFdCSQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwTzSVBSxQ9o1YxBeAqyg4HWCMmlUkecQ0i/qegkJPYXTxmFw2x APpzRZkPlF0H4OSkLzOlPCx5gNd/1B/r3QFbj4jZcoaQPOA9/w0pbI+zCfgK6UrERaIgJQPH2tW GYLg1Lg== X-Received: from pfblx5.prod.google.com ([2002:a05:6a00:7545:b0:82f:c34b:9799]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:1807:b0:81f:31c3:2e34 with SMTP id d2e1a72fcca58-8415f330494mr4957284b3a.25.1779470515914; Fri, 22 May 2026 10:21:55 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 22 May 2026 10:21:50 -0700 In-Reply-To: <20260522172151.3530267-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260522172151.3530267-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.794.g4f17f83d09-goog Message-ID: <20260522172151.3530267-3-seanjc@google.com> Subject: [PATCH v2 2/3] KVM: selftests: Test guest_memfd binding overlap without GPA overlap From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zongyao Chen , Ackerley Tng , Sean Christopherson Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zongyao Chen The guest_memfd binding overlap test recreates the deleted slot with GPA ranges that overlap the still-live slot. KVM rejects those attempts from the generic memslot overlap check before reaching kvm_gmem_bind(), so the test can pass even if guest_memfd binding overlap detection is broken. Recreate the slot at its original, non-overlapping GPA and use guest_memfd offsets that overlap the front and back halves of the other slot's binding. Expand the guest_memfd so the back-half case remains within the file size. Fixes: 2feabb855df8 ("KVM: selftests: Expand set_memory_region_test to vali= date guest_memfd()") Signed-off-by: Zongyao Chen Reviewed-by: Ackerley Tng Tested-by: Ackerley Tng [sean: keep the existing GPA overlap testcases] Signed-off-by: Sean Christopherson --- .../selftests/kvm/set_memory_region_test.c | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/t= esting/selftests/kvm/set_memory_region_test.c index 9b919a231c93..be99c1ff5a5a 100644 --- a/tools/testing/selftests/kvm/set_memory_region_test.c +++ b/tools/testing/selftests/kvm/set_memory_region_test.c @@ -510,7 +510,7 @@ static void test_add_overlapping_private_memory_regions= (void) =20 vm =3D vm_create_barebones_type(KVM_X86_SW_PROTECTED_VM); =20 - memfd =3D vm_create_guest_memfd(vm, MEM_REGION_SIZE * 4, 0); + memfd =3D vm_create_guest_memfd(vm, MEM_REGION_SIZE * 5, 0); =20 vm_set_user_memory_region2(vm, MEM_REGION_SLOT, KVM_MEM_GUEST_MEMFD, MEM_REGION_GPA, MEM_REGION_SIZE * 2, 0, memfd, 0); @@ -526,7 +526,30 @@ static void test_add_overlapping_private_memory_region= s(void) vm_set_user_memory_region2(vm, MEM_REGION_SLOT, KVM_MEM_GUEST_MEMFD, MEM_REGION_GPA, 0, NULL, -1, 0); =20 - /* Overlap the front half of the other slot. */ + /* + * Verify that overlap in the guest_memfd bindings (i.e. in guest_memfd + * file offsets), but _not_ in the GPA space, fails with -EEXIST. + */ + r =3D __vm_set_user_memory_region2(vm, MEM_REGION_SLOT, KVM_MEM_GUEST_MEM= FD, + MEM_REGION_GPA, + MEM_REGION_SIZE * 2, + 0, memfd, MEM_REGION_SIZE); + TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EEXIST, + "Overlapping guest_memfd() bindings should fail with EEXIST"); + + /* And now the back half of the other slot's guest_memfd binding. */ + r =3D __vm_set_user_memory_region2(vm, MEM_REGION_SLOT, KVM_MEM_GUEST_MEM= FD, + MEM_REGION_GPA, + MEM_REGION_SIZE * 2, + 0, memfd, MEM_REGION_SIZE * 3); + TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EEXIST, + "Overlapping guest_memfd() bindings should fail with EEXIST"); + + /* + * Repeat the overlap tests, but this time with overlap in the memslots + * GPA space. Regardless of where there is overlap, KVM should return + * -EEXIST. + */ r =3D __vm_set_user_memory_region2(vm, MEM_REGION_SLOT, KVM_MEM_GUEST_MEM= FD, MEM_REGION_GPA * 2 - MEM_REGION_SIZE, MEM_REGION_SIZE * 2, --=20 2.54.0.794.g4f17f83d09-goog From nobody Sun May 24 19:33:39 2026 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 54DEB372662 for ; Fri, 22 May 2026 17:21:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470519; cv=none; b=GT5JQmLKHDYUKLbBe5pEF5nMjqMy2mETANpapnaPfMv8wojb6cdholPUWenDeTXE3N/GY+oFk7Vr8+0LhvmF5WIyQnJV0FGSLO4+4zsnK4jLNM0pAEjIt8N6vZl2IxXllf6u5HQzN3rF62OI78FuKq7/cd+4QiR1/VIdkv++fg0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779470519; c=relaxed/simple; bh=8WpWeyEf3luxQ2wZAyHA8cYkuiddAjE911Qfhzsg90E=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=sNe+Rey+YmMAVewJ+YX0VkWh9EpG2hc2k3fDHz+pvgMOpcIL/KBPCWPrk7zRlT6M8Ej9s/2NjqTof4E+HIagxj1UgIzqTqXduxuxac9+C1jY2Vsw3ZQzLBcbO3L6PRitlQyafXEJrCK21oIFz/dvqk+Y5up4ralJS8cMncXcsUY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ZTab3+fx; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ZTab3+fx" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-841127f960fso2015526b3a.1 for ; Fri, 22 May 2026 10:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779470517; x=1780075317; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=Eefghdyx2WJstvVJS36TMv8XvfuF7zYMCYG6JFPt/vA=; b=ZTab3+fxYVOjUeT0BFEhIpBIt/06bclw8f4IMCC+rbzKWJOaT4coKgCjYRviPj4wt7 w9h2PbZK7aT28sLcqxjpw/5K1741Qe7o+rSujx8WtkWXpBhjKvcfedd8SHsZbcmITHK/ juaNNBiEnqJFzgH1aECvM1jyNEZCP1aRuluDYKqxQxpkOtO5MXIsmMtfwfQCZt79JVOg JlR467WObcwwBP/4lQ0RctIKnctJ+XCrzRvFgca8CpW+X7Rp8JGNH6SkP/CCA8MSZncX NK1zzfNvXzmHwyGtUMEgsFKfMdvaoH3sVPuS5ZrPbLunP5fIHXWZnS0ruxGOwdd99F2X f94Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779470517; x=1780075317; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Eefghdyx2WJstvVJS36TMv8XvfuF7zYMCYG6JFPt/vA=; b=EyRZg0cg2SbZ6lXbPNEbvwAf5vKjDU+Raf/U30x0/P+FgmKi8pMCVsG/5O+68q7Vd6 coHHFRBMMl7yIvszsWYuX0D7QCi9j99c62NTqHt0OloX5sudaGTqXSs/ieXjQOB0fK1x BxHhM/l0IL0ChshQFi7+taqIkZDYGPxLq1k183R/TI77SEodT2roSuiq9P+WaDP+pTaQ /x0hf9bb/6s2gYCFLpuUHRVhN3Cwg7CxDQXAICB6XLE5LWmdoroYQqTAOoLaqEM+RcUl u8IF7SnXzAfJaU2QGvjv+lxCDtHCO9VFUA3oozB8yoiKXpyBNLqyOAbQ0beigINQtQXl 8hJw== X-Forwarded-Encrypted: i=1; AFNElJ/KY3zXu9TzZTxCXfxK/Tvb2dL8VHrxy9G4qZ7D7+gqbVpqbV70uX1C3R4sAtbRLwTDwzBNW2S/us1BpMw=@vger.kernel.org X-Gm-Message-State: AOJu0YwMmYjwhieVKNPl63eoyqCE4+2qsiGuFlP6HQL9bLphXyBSoB0S RrLTIRs9K2fq97nq8tk7/FNS9SiKPZZpBO5z/8wXIoENPi6Fx9B5894LGVJDP5LilhLLPRIVTbh HqJY5ew== X-Received: from pfnc20.prod.google.com ([2002:aa7:81d4:0:b0:829:7f86:623]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:240b:b0:835:3f51:72f8 with SMTP id d2e1a72fcca58-8415f5db6c5mr4494289b3a.18.1779470517177; Fri, 22 May 2026 10:21:57 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 22 May 2026 10:21:51 -0700 In-Reply-To: <20260522172151.3530267-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260522172151.3530267-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.794.g4f17f83d09-goog Message-ID: <20260522172151.3530267-4-seanjc@google.com> Subject: [PATCH v2 3/3] KVM: selftests: Remove unnecessary "%s" formatting of a constant string From: Sean Christopherson To: Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Zongyao Chen , Ackerley Tng , Sean Christopherson Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Drop superfluous %s formatting from assertions in the guest_memfd overlap testcases, as the string being printed doesn't require runtime formatting. No functional change intended. Reported-by: Ackerley Tng Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/set_memory_region_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/set_memory_region_test.c b/tools/t= esting/selftests/kvm/set_memory_region_test.c index be99c1ff5a5a..e0800bfb11eb 100644 --- a/tools/testing/selftests/kvm/set_memory_region_test.c +++ b/tools/testing/selftests/kvm/set_memory_region_test.c @@ -554,7 +554,7 @@ static void test_add_overlapping_private_memory_regions= (void) MEM_REGION_GPA * 2 - MEM_REGION_SIZE, MEM_REGION_SIZE * 2, 0, memfd, 0); - TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EEXIST, "%s", + TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EEXIST, "Overlapping guest_memfd() bindings should fail with EEXIST"); =20 /* And now the back half of the other slot. */ @@ -562,7 +562,7 @@ static void test_add_overlapping_private_memory_regions= (void) MEM_REGION_GPA * 2 + MEM_REGION_SIZE, MEM_REGION_SIZE * 2, 0, memfd, 0); - TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EEXIST, "%s", + TEST_ASSERT(r =3D=3D -1 && errno =3D=3D EEXIST, "Overlapping guest_memfd() bindings should fail with EEXIST"); =20 close(memfd); --=20 2.54.0.794.g4f17f83d09-goog