Re: [kvm-unit-tests PATCH v1 4/4] s390x: add a test for SIE without MSO/MSL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/5/23 21:55, Nina Schoetterl-Glausch wrote:
On Mon, 2023-03-27 at 10:21 +0200, Nico Boehr wrote:
Since we now have the ability to run guests without MSO/MSL, add a test
to make sure this doesn't break.

Signed-off-by: Nico Boehr <nrb@xxxxxxxxxxxxx>
---

[...]

+static inline void force_exit_value(uint64_t val)
+{
+	asm volatile(
+		"	diag	%[val],0,0x9c\n"
+		: : [val] "d"(val)
+	);
+}
+
+__attribute__((section(".text"))) int main(void)

Why is the attribute necessary? I know all the snippets have it, but I don't see
why it's necessary.
@Janosch ?

"Historical growth" :)

If it doesn't work without it then we need to find a way to fix it.
If it does work without it then we should remove the attribute from all snippets.

But this issue is a low priority for me.


+{
+	uint8_t *invalid_ptr;
+
+	memset(test_page, 0, sizeof(test_page));
+	/* tell the host the page's physical address (we're running DAT off) */
+	force_exit_value((uint64_t)test_page);
+
+	/* write some value to the page so the host can verify it */
+	for (size_t i = 0; i < TEST_PAGE_COUNT; i++)
+		test_page[i * PAGE_SIZE] = 42 + i;
+
+	/* indicate we've written all pages */
+	force_exit();
+
+	/* the first unmapped address */
+	invalid_ptr = (uint8_t *)(TOTAL_PAGE_COUNT * PAGE_SIZE);

Why not just use an address high enough you know it will not be mapped?
-1 should do just fine.

+	*invalid_ptr = 42;
+
+	/* indicate we've written the non-allowed page (should never get here) */
+	force_exit();
+
+	return 0;
+}
diff --git a/s390x/unittests.cfg b/s390x/unittests.cfg
index d97eb5e943c8..aab0e670f2d4 100644
--- a/s390x/unittests.cfg
+++ b/s390x/unittests.cfg
@@ -215,3 +215,6 @@ file = migration-skey.elf
  smp = 2
  groups = migration
  extra_params = -append '--parallel'
+
+[sie-dat]
+file = sie-dat.elf





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux