s390x/intercept: Test invalid prefix argument to SET PREFIX
PATCH 1/1 s390x/intercept: Test invalid prefix argument to SET PREFIX
According to the architecture, SET PREFIX must try to access the new prefix area and recognize an addressing exception if the area is not accessible.
Test that the exception occurs when we try to set a prefix higher than the available memory.
--- s390x/intercept.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
s390x/intercept.c +14 -0
@@ -74,6 +74,20 @@ static void test_spx(void)expect_pgm_int (); asmvolatile (" spx 0(%0) " : :"r" (-8L ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); + + new_prefix =get_ram_size () &0x7fffe000 ; +if (get_ram_size () - new_prefix <2 *PAGE_SIZE ) { +expect_pgm_int (); + asmvolatile ("spx %0 " : :"Q" (new_prefix)); +check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); + +/* +* Cannot test inaccessibility of the second page the same way. +* If we try to use the last page as first half of the prefix +* area and our ram size is a multiple of 8k, after SPX aligns +* the address to 8k we have a completely accessible area. +*/ + } }/* Test the STORE CPU ADDRESS instruction */
base-commit: 110c69492b53f0070e1bbce986fb635e72a423b4
Signature · 1 line
2.36.1
Quoted 23 lines · On Mon, 27 Jun 2022 14:43:56 +0200 Janis Schoetterl-Glausch…
According to the architecture, SET PREFIX must try to access the new prefix area and recognize an addressing exception if the area is not accessible.
Test that the exception occurs when we try to set a prefix higher than the available memory.Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- s390x/intercept.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)s390x/intercept.c +4
-0@@ -74,6 +74,20 @@ static void test_spx(void)expect_pgm_int (); asmvolatile (" spx 0(%0) " : :"r" (-8L ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); + + new_prefix =get_ram_size () &0x7fffe000 ; +if (get_ram_size () - new_prefix <2 *PAGE_SIZE ) { +expect_pgm_int ();
s390x/intercept.c static void test_spx(void) · line 90
Quoted 10 lines
s390x/intercept.c +10
-0+ asmvolatile ("spx %0 " : :"Q" (new_prefix)); +check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); + +/* +* Cannot test inaccessibility of the second page the same way. +* If we try to use the last page as first half of the prefix +* area and our ram size is a multiple of 8k, after SPX aligns +* the address to 8k we have a completely accessible area. +*/ + }
please add something like:
else {
report_skip("Inaccessible prefix");
}Quoted 5 lines
s390x/intercept.c +0
-0}/* Test the STORE CPU ADDRESS instruction */ base-commit:
110c69492b53f0070e1bbce986fb635e72a423b4
Quoted 39 lines · Claudio Imbrenda
Quoted 23 lines · On Mon, 27 Jun 2022 14:43:56 +0200 Janis Schoetterl-Glausch…
According to the architecture, SET PREFIX must try to access the new prefix area and recognize an addressing exception if the area is not accessible.
Test that the exception occurs when we try to set a prefix higher than the available memory.Signed-off-by Janis Schoetterl-Glausch <[email protected]>--- s390x/intercept.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)s390x/intercept.c +4
-0@@ -74,6 +74,20 @@ static void test_spx(void)expect_pgm_int (); asmvolatile (" spx 0(%0) " : :"r" (-8L ));check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); + + new_prefix =get_ram_size () &0x7fffe000 ; +if (get_ram_size () - new_prefix <2 *PAGE_SIZE ) { +expect_pgm_int ();s390x/intercept.c static void test_spx(void) · line 90
Quoted 10 lines
s390x/intercept.c +10
-0+ asmvolatile ("spx %0 " : :"Q" (new_prefix)); +check_pgm_int_code (PGM_INT_CODE_ADDRESSING ); + +/* +* Cannot test inaccessibility of the second page the same way. +* If we try to use the last page as first half of the prefix +* area and our ram size is a multiple of 8k, after SPX aligns +* the address to 8k we have a completely accessible area. +*/ + }please add something like:
Quoted 4 lines
else {
report_skip("Inaccessible prefix");
}Yeah, good idea.
Is there any low effort way of generating an invalid prefix other than > ram_size ? That might then allow for testing the second page also.
Quoted 6 lines
Quoted 5 lines
s390x/intercept.c +0
-0}/* Test the STORE CPU ADDRESS instruction */ base-commit:
110c69492b53f0070e1bbce986fb635e72a423b4