Message ID | 20220523132406.1820550-4-scgl@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | More skey instr. emulation test | expand |
On Mon, 23 May 2022 15:24:06 +0200 Janis Schoetterl-Glausch <scgl@linux.ibm.com> wrote: > Test that key-controlled protection does not apply to diag 308. > > Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > s390x/skey.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/s390x/skey.c b/s390x/skey.c > index a55034b5..074667e2 100644 > --- a/s390x/skey.c > +++ b/s390x/skey.c > @@ -300,6 +300,31 @@ static void test_store_cpu_address(void) > report_prefix_pop(); > } > > +static void test_diag_308(void) > +{ > + uint16_t response; > + uint32_t *ipib = (uint32_t *)pagebuf; > + > + report_prefix_push("DIAG 308"); > + WRITE_ONCE(ipib[0], 0); /* Invalid length */ > + set_storage_key(ipib, 0x28, 0); > + /* key-controlled protection does not apply */ > + asm volatile ( > + "lr %%r2,%[ipib]\n\t" > + "spka 0x10\n\t" > + "diag %%r2,%[code],0x308\n\t" > + "spka 0\n\t" > + "lr %[response],%%r3\n" > + : [response] "=d" (response) > + : [ipib] "d" (ipib), > + [code] "d" (5) > + : "%r2", "%r3" > + ); > + report(response == 0x402, "no exception on fetch, response: invalid IPIB"); > + set_storage_key(ipib, 0x00, 0); > + report_prefix_pop(); > +} > + > /* > * Perform CHANNEL SUBSYSTEM CALL (CHSC) instruction while temporarily executing > * with access key 1. > @@ -712,6 +737,7 @@ int main(void) > test_chg(); > test_test_protection(); > test_store_cpu_address(); > + test_diag_308(); > test_channel_subsystem_call(); > > setup_vm();
diff --git a/s390x/skey.c b/s390x/skey.c index a55034b5..074667e2 100644 --- a/s390x/skey.c +++ b/s390x/skey.c @@ -300,6 +300,31 @@ static void test_store_cpu_address(void) report_prefix_pop(); } +static void test_diag_308(void) +{ + uint16_t response; + uint32_t *ipib = (uint32_t *)pagebuf; + + report_prefix_push("DIAG 308"); + WRITE_ONCE(ipib[0], 0); /* Invalid length */ + set_storage_key(ipib, 0x28, 0); + /* key-controlled protection does not apply */ + asm volatile ( + "lr %%r2,%[ipib]\n\t" + "spka 0x10\n\t" + "diag %%r2,%[code],0x308\n\t" + "spka 0\n\t" + "lr %[response],%%r3\n" + : [response] "=d" (response) + : [ipib] "d" (ipib), + [code] "d" (5) + : "%r2", "%r3" + ); + report(response == 0x402, "no exception on fetch, response: invalid IPIB"); + set_storage_key(ipib, 0x00, 0); + report_prefix_pop(); +} + /* * Perform CHANNEL SUBSYSTEM CALL (CHSC) instruction while temporarily executing * with access key 1. @@ -712,6 +737,7 @@ int main(void) test_chg(); test_test_protection(); test_store_cpu_address(); + test_diag_308(); test_channel_subsystem_call(); setup_vm();
Test that key-controlled protection does not apply to diag 308. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> --- s390x/skey.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)