Skip to contentSkip to conversation

s390x: Fix stsi unaligned test and add selector tests

PATCH In review Janosch Frank 4 participants 6 messages Sep 20, 2019 – Sep 23, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x: Fix stsi unaligned test and add selector tests

Alignment and selectors test order is not specified and so, if you have an unaligned address and invalid selectors it's up to the hypervisor to decide which error is presented.

Let's add valid selectors to the unalignmnet test and add selector tests.

---
 s390x/stsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
s390x/stsi.c +3 -1
index 7232cb0..c5bd0a2 100644
@@ -35,7 +35,7 @@ static void test_specs(void)
 
 	report_prefix_push("unaligned");
 	expect_pgm_int();
-	stsi(pagebuf + 42, 1, 0, 0);
+	stsi(pagebuf + 42, 1, 1, 1);
 	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 	report_prefix_pop();
 
@@ -71,6 +71,8 @@ static inline unsigned long stsi_get_fc(void *addr)
 static void test_fc(void)
 {
 	report("invalid fc",  stsi(pagebuf, 7, 0, 0) == 3);
+	report("invalid selector 1", stsi(pagebuf, 1, 0, 1) == 3);
+	report("invalid selector 2", stsi(pagebuf, 1, 1, 0) == 3);
 	report("query fc >= 2",  stsi_get_fc(pagebuf) >= 2);
 }
 
Signature · 1 line
2.17.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Janosch Frank

Alignment and selectors test order is not specified and so, if you have an unaligned address and invalid selectors it's up to the hypervisor to decide which error is presented.

Let's add valid selectors to the unalignmnet test and add selector tests.

Quoted 27 lines
---
 s390x/stsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
s390x/stsi.c +3 -1
index 7232cb0..c5bd0a2 100644
@@ -35,7 +35,7 @@ static void test_specs(void)
 
 	report_prefix_push("unaligned");
 	expect_pgm_int();
-	stsi(pagebuf + 42, 1, 0, 0);
+	stsi(pagebuf + 42, 1, 1, 1);
 	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 	report_prefix_pop();
 
@@ -71,6 +71,8 @@ static inline unsigned long stsi_get_fc(void *addr)
 static void test_fc(void)
 {
 	report("invalid fc",  stsi(pagebuf, 7, 0, 0) == 3);
+	report("invalid selector 1", stsi(pagebuf, 1, 0, 1) == 3);
+	report("invalid selector 2", stsi(pagebuf, 1, 1, 0) == 3);
 	report("query fc >= 2",  stsi_get_fc(pagebuf) >= 2);
 }
 
Acked-by on v1 1/1
#2 lore raw
In reply to Janosch Frank
Quoted 27 lines · Janosch Frank

Alignment and selectors test order is not specified and so, if you have an unaligned address and invalid selectors it's up to the hypervisor to decide which error is presented.

Let's add valid selectors to the unalignmnet test and add selector tests.

---
 s390x/stsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
s390x/stsi.c +1 -1
index 7232cb0..c5bd0a2 100644
@@ -35,7 +35,7 @@ static void test_specs(void)
 
 	report_prefix_push("unaligned");
 	expect_pgm_int();
-	stsi(pagebuf + 42, 1, 0, 0);
+	stsi(pagebuf + 42, 1, 1, 1);
 	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 	report_prefix_pop();
 

s390x/stsi.c static inline unsigned long stsi_get_fc(void *addr) · line 78

Quoted 8 lines
s390x/stsi.c +2 -0
@@ -71,6 +71,8 @@ static inline unsigned long stsi_get_fc(void *addr)
 static void test_fc(void)
 {
 	report("invalid fc",  stsi(pagebuf, 7, 0, 0) == 3);
+	report("invalid selector 1", stsi(pagebuf, 1, 0, 1) == 3);
+	report("invalid selector 2", stsi(pagebuf, 1, 1, 0) == 3);
 	report("query fc >= 2",  stsi_get_fc(pagebuf) >= 2);
 }
 
Signature · 3 lines
Thanks,

David / dhildenb
#3 lore raw
Quoted 26 lines · David Hildenbrand
Quoted 25 lines · Janosch Frank

Alignment and selectors test order is not specified and so, if you have an unaligned address and invalid selectors it's up to the hypervisor to decide which error is presented.

Let's add valid selectors to the unalignmnet test and add selector tests.

---
 s390x/stsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
s390x/stsi.c +1 -1
index 7232cb0..c5bd0a2 100644
@@ -35,7 +35,7 @@ static void test_specs(void)
 
 	report_prefix_push("unaligned");
 	expect_pgm_int();
-	stsi(pagebuf + 42, 1, 0, 0);
+	stsi(pagebuf + 42, 1, 1, 1);
 	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 	report_prefix_pop();
 
Quoted 4 lines

s390x/stsi.c static inline unsigned long stsi_get_fc(void *addr) · line 73

Quoted 4 lines
s390x/stsi.c +0 -0
@@ -71,6 +71,8 @@ static inline unsigned long stsi_get_fc(void *addr)
 static void test_fc(void)
 {
 	report("invalid fc",  stsi(pagebuf, 7, 0, 0) == 3);

While you're at it, wouldn't it be better to use "(pagebuf, 7, 1, 1)" here?

Thomas

Quoted 9 lines

s390x/stsi.c static inline unsigned long stsi_get_fc(void *addr) · line 78

Quoted 6 lines
s390x/stsi.c +2 -0
+	report("invalid selector 1", stsi(pagebuf, 1, 0, 1) == 3);
+	report("invalid selector 2", stsi(pagebuf, 1, 1, 0) == 3);
 	report("query fc >= 2",  stsi_get_fc(pagebuf) >= 2);
 }
 
#4 lore raw
Quoted 27 lines · Thomas Huth
Quoted 26 lines · David Hildenbrand
Quoted 25 lines · Janosch Frank

Alignment and selectors test order is not specified and so, if you have an unaligned address and invalid selectors it's up to the hypervisor to decide which error is presented.

Let's add valid selectors to the unaligned test and add selector tests.

---
 s390x/stsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
s390x/stsi.c +1 -1
index 7232cb0..c5bd0a2 100644
@@ -35,7 +35,7 @@ static void test_specs(void)
 
 	report_prefix_push("unaligned");
 	expect_pgm_int();
-	stsi(pagebuf + 42, 1, 0, 0);
+	stsi(pagebuf + 42, 1, 1, 1);
 	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 	report_prefix_pop();
 
Quoted 6 lines
Quoted 4 lines

s390x/stsi.c static inline unsigned long stsi_get_fc(void *addr) · line 73

Quoted 4 lines
s390x/stsi.c +0 -0
@@ -71,6 +71,8 @@ static inline unsigned long stsi_get_fc(void *addr)
 static void test_fc(void)
 {
 	report("invalid fc",  stsi(pagebuf, 7, 0, 0) == 3);

While you're at it, wouldn't it be better to use "(pagebuf, 7, 1, 1)" here?

The selectors depend on the command, so they need to be checked after the command. I don't think it would make much sense to change the zeroes here.

Quoted 14 lines

Thomas

Quoted 9 lines

s390x/stsi.c static inline unsigned long stsi_get_fc(void *addr) · line 78

Quoted 6 lines
s390x/stsi.c +2 -0
+	report("invalid selector 1", stsi(pagebuf, 1, 0, 1) == 3);
+	report("invalid selector 2", stsi(pagebuf, 1, 1, 0) == 3);
 	report("query fc >= 2",  stsi_get_fc(pagebuf) >= 2);
 }
 
#5 lore raw
Quoted 35 lines · Janosch Frank
Quoted 27 lines · Thomas Huth
Quoted 26 lines · David Hildenbrand
Quoted 25 lines · Janosch Frank

Alignment and selectors test order is not specified and so, if you have an unaligned address and invalid selectors it's up to the hypervisor to decide which error is presented.

Let's add valid selectors to the unaligned test and add selector tests.

---
 s390x/stsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
s390x/stsi.c +1 -1
index 7232cb0..c5bd0a2 100644
@@ -35,7 +35,7 @@ static void test_specs(void)
 
 	report_prefix_push("unaligned");
 	expect_pgm_int();
-	stsi(pagebuf + 42, 1, 0, 0);
+	stsi(pagebuf + 42, 1, 1, 1);
 	check_pgm_int_code(PGM_INT_CODE_SPECIFICATION);
 	report_prefix_pop();
 
Quoted 6 lines
Quoted 4 lines

s390x/stsi.c static inline unsigned long stsi_get_fc(void *addr) · line 73

Quoted 4 lines
s390x/stsi.c +0 -0
@@ -71,6 +71,8 @@ static inline unsigned long stsi_get_fc(void *addr)
 static void test_fc(void)
 {
 	report("invalid fc",  stsi(pagebuf, 7, 0, 0) == 3);

While you're at it, wouldn't it be better to use "(pagebuf, 7, 1, 1)" here?

Quoted 3 lines

The selectors depend on the command, so they need to be checked after the command. I don't think it would make much sense to change the zeroes here.

OK, fair. Patche queued.

Thomas