public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Janosch Frank <frankja@linux.ibm.com>
To: kvm390 mailing list <kvm390-list@tuxmaker.boeblingen.de.ibm.com>
Cc: kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	imbrenda@linux.ibm.com, thuth@redhat.com, seiden@linux.ibm.com,
	nrb@linux.ibm.com, scgl@linux.ibm.com
Subject: [kvm-unit-tests PATCH v2 8/8] s390x: uv-host: Fix init storage origin and length check
Date: Wed,  6 Jul 2022 06:40:24 +0000	[thread overview]
Message-ID: <20220706064024.16573-9-frankja@linux.ibm.com> (raw)
In-Reply-To: <20220706064024.16573-1-frankja@linux.ibm.com>

The origin and length are masked with the HPAGE_MASK and PAGE_MASK
respectively so adding a few bytes doesn't matter at all.

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 s390x/uv-host.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/s390x/uv-host.c b/s390x/uv-host.c
index 1ed8ded1..b1412a20 100644
--- a/s390x/uv-host.c
+++ b/s390x/uv-host.c
@@ -516,17 +516,22 @@ static void test_init(void)
 	       "storage invalid length");
 	uvcb_init.stor_len += 8;
 
-	uvcb_init.stor_origin =  get_max_ram_size() + 8;
+	/* Storage origin is 1MB aligned, the length is 4KB aligned */
+	uvcb_init.stor_origin = get_max_ram_size();
 	rc = uv_call(0, (uint64_t)&uvcb_init);
-	report(rc == 1 && uvcb_init.header.rc == 0x104,
+	report(rc == 1 && (uvcb_init.header.rc == 0x104 || uvcb_init.header.rc == 0x105),
 	       "storage origin invalid");
 	uvcb_init.stor_origin = mem;
 
-	uvcb_init.stor_origin = get_max_ram_size() - 8;
-	rc = uv_call(0, (uint64_t)&uvcb_init);
-	report(rc == 1 && uvcb_init.header.rc == 0x105,
-	       "storage + length invalid");
-	uvcb_init.stor_origin = mem;
+	if (uvcb_init.stor_len >= HPAGE_SIZE) {
+		uvcb_init.stor_origin = get_max_ram_size() - HPAGE_SIZE;
+		rc = uv_call(0, (uint64_t)&uvcb_init);
+		report(rc == 1 && uvcb_init.header.rc == 0x105,
+		       "storage + length invalid");
+		uvcb_init.stor_origin = mem;
+	} else {
+		report_skip("storage + length invalid, stor_len < HPAGE_SIZE");
+	}
 
 	uvcb_init.stor_origin = 1UL << 30;
 	rc = uv_call(0, (uint64_t)&uvcb_init);
-- 
2.34.1


  parent reply	other threads:[~2022-07-06  6:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  6:40 [kvm-unit-tests PATCH v2 0/8] s390x: uv-host: Access check extensions and improvements Janosch Frank
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 1/8] s390x: uv-host: Add access checks for donated memory Janosch Frank
2022-07-06 16:33   ` Claudio Imbrenda
2022-07-07  8:16     ` Janosch Frank
2022-07-07  9:19       ` Claudio Imbrenda
2022-07-25 13:08         ` [kvm-unit-tests PATCH v3] " Janosch Frank
2022-08-03  7:22           ` Nico Boehr
2022-08-03  9:46           ` Claudio Imbrenda
2022-08-03 11:18             ` Janosch Frank
2022-08-11 13:18             ` [kvm-unit-tests PATCH v4] " Janosch Frank
2022-08-11 14:17               ` Claudio Imbrenda
2022-08-11 15:00                 ` [kvm-unit-tests PATCH v5] " Janosch Frank
2022-08-11 15:15                   ` Claudio Imbrenda
2022-07-07  8:11   ` [kvm-unit-tests PATCH v2 1/8] " Steffen Eiden
2022-07-07  8:20     ` Janosch Frank
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 2/8] s390x: uv-host: Add uninitialized UV tests Janosch Frank
2022-07-08  9:10   ` Steffen Eiden
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 3/8] s390x: uv-host: Test uv immediate parameter Janosch Frank
2022-07-08 10:02   ` Steffen Eiden
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 4/8] s390x: uv-host: Add access exception test Janosch Frank
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 5/8] s390x: uv-host: Add a set secure config parameters test function Janosch Frank
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 6/8] s390x: uv-host: Remove duplicated + Janosch Frank
2022-07-06  6:40 ` [kvm-unit-tests PATCH v2 7/8] s390x: uv-host: Fence against being run as a PV guest Janosch Frank
2022-07-08 10:08   ` Steffen Eiden
2022-07-06  6:40 ` Janosch Frank [this message]
2022-07-08 10:19   ` [kvm-unit-tests PATCH v2 8/8] s390x: uv-host: Fix init storage origin and length check Steffen Eiden

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220706064024.16573-9-frankja@linux.ibm.com \
    --to=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm390-list@tuxmaker.boeblingen.de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nrb@linux.ibm.com \
    --cc=scgl@linux.ibm.com \
    --cc=seiden@linux.ibm.com \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox