From patchwork Fri May 13 09:50:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12848600 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBA7DC433F5 for ; Fri, 13 May 2022 09:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379188AbiEMJvv (ORCPT ); Fri, 13 May 2022 05:51:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379160AbiEMJvs (ORCPT ); Fri, 13 May 2022 05:51:48 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5A0859089; Fri, 13 May 2022 02:51:47 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D80jxU024781; Fri, 13 May 2022 09:51:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=mGXMzkGA2hf+OzGbroVOqmibZfDBb8CEpJL7TG8b4CY=; b=GzMHmm+CgVmbeG2td2JEder9qkQ6TxEZiBTyf6x4qUYf9vFyIY8+pw8yFKO3agOv9Nnm MxIwQELZdJ+FXPGu7YPsOnoGFoEg8yptjW55VDDz0wiogyHK5eWHQ9a1/+wtjVM3Khd9 BgwDznFtc3TMKcBFZSuVZXZqjYT05RGyngPukIHFIqwvlalp774QjwpRIbA3Z2EhSxST FeGZuG+wHwTYvl3UOTEctM2LbnzG2Yub+juttvzCjVSj2Q+ydAJYlYfV8s6tgipNIzpU yqumFxp1gjGPys5xfMgoxBX7O8DDtT2PCJwh1tpidt/nYrnuHAdn6be8xZjYx6up9v0t 5Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1ket1xv6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:47 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24D9jB1t009699; Fri, 13 May 2022 09:51:46 GMT Received: from ppma01fra.de.ibm.com (46.49.7a9f.ip4.static.sl-reverse.com [159.122.73.70]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1ket1xup-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:46 +0000 Received: from pps.filterd (ppma01fra.de.ibm.com [127.0.0.1]) by ppma01fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24D9SShc021575; Fri, 13 May 2022 09:51:44 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma01fra.de.ibm.com with ESMTP id 3fwgd8pj48-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:44 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24D9pfIY33489286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 09:51:41 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 086E34C04E; Fri, 13 May 2022 09:51:41 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33F134C046; Fri, 13 May 2022 09:51:40 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 09:51:40 +0000 (GMT) From: Janosch Frank To: kvm390 mailing list 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 1/6] s390x: uv-host: Add access checks for donated memory Date: Fri, 13 May 2022 09:50:12 +0000 Message-Id: <20220513095017.16301-2-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220513095017.16301-1-frankja@linux.ibm.com> References: <20220513095017.16301-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: SKWGjkzi_brYQO2KDfMGk2DVN3IiDnZs X-Proofpoint-GUID: 9zYEpzz3WrLp4dnUiLNPFbiBiTRSksJX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 adultscore=0 clxscore=1015 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130041 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's check if the UV really protected all the memory we donated. Signed-off-by: Janosch Frank Reviewed-by: Nico Boehr --- s390x/uv-host.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index a1a6d120..0f0b18a1 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -142,7 +142,8 @@ static void test_cpu_destroy(void) static void test_cpu_create(void) { int rc; - unsigned long tmp; + unsigned long tmp, i; + uint8_t *access_ptr; report_prefix_push("csc"); uvcb_csc.header.len = sizeof(uvcb_csc); @@ -194,6 +195,18 @@ static void test_cpu_create(void) report(rc == 0 && uvcb_csc.header.rc == UVC_RC_EXECUTED && uvcb_csc.cpu_handle, "success"); + rc = 1; + for (i = 0; i < uvcb_qui.cpu_stor_len / PAGE_SIZE; i++) { + expect_pgm_int(); + access_ptr = (void *)uvcb_csc.stor_origin + PAGE_SIZE * i; + *access_ptr = 42; + if (clear_pgm_int() != PGM_INT_CODE_SECURE_STOR_ACCESS) { + rc = 0; + break; + } + } + report(rc, "Storage protection"); + tmp = uvcb_csc.stor_origin; uvcb_csc.stor_origin = (unsigned long)memalign(PAGE_SIZE, uvcb_qui.cpu_stor_len); rc = uv_call(0, (uint64_t)&uvcb_csc); @@ -205,8 +218,9 @@ static void test_cpu_create(void) static void test_config_create(void) { int rc; - unsigned long vsize, tmp; + unsigned long vsize, tmp, i; static struct uv_cb_cgc uvcb; + uint8_t *access_ptr; uvcb_cgc.header.cmd = UVC_CMD_CREATE_SEC_CONF; uvcb_cgc.header.len = sizeof(uvcb_cgc); @@ -292,6 +306,30 @@ static void test_config_create(void) rc = uv_call(0, (uint64_t)&uvcb_cgc); report(rc == 0 && uvcb_cgc.header.rc == UVC_RC_EXECUTED, "successful"); + rc = 1; + for (i = 0; i < vsize / PAGE_SIZE; i++) { + expect_pgm_int(); + access_ptr = (void *)uvcb_cgc.conf_var_stor_origin + PAGE_SIZE * i; + *access_ptr = 42; + if (clear_pgm_int() != PGM_INT_CODE_SECURE_STOR_ACCESS) { + rc = 0; + break; + } + } + report(rc, "Base storage protection"); + + rc = 1; + for (i = 0; i < uvcb_qui.conf_base_phys_stor_len / PAGE_SIZE; i++) { + expect_pgm_int(); + access_ptr = (void *)uvcb_cgc.conf_base_stor_origin + PAGE_SIZE * i; + *access_ptr = 42; + if (clear_pgm_int() != PGM_INT_CODE_SECURE_STOR_ACCESS) { + rc = 0; + break; + } + } + report(rc, "Variable storage protection"); + uvcb_cgc.header.rc = 0; uvcb_cgc.header.rrc = 0; tmp = uvcb_cgc.guest_handle; From patchwork Fri May 13 09:50:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12848599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E65F9C433EF for ; Fri, 13 May 2022 09:51:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379180AbiEMJvu (ORCPT ); Fri, 13 May 2022 05:51:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379171AbiEMJvs (ORCPT ); Fri, 13 May 2022 05:51:48 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 604565716C; Fri, 13 May 2022 02:51:48 -0700 (PDT) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D9gUE8012908; Fri, 13 May 2022 09:51:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=1o01ehLqlX/YYeb5qV6xwxVs/1Huj6/O1R4x+qwv2l0=; b=mD8B1FuAsNqTwfzBDZBS6VcB1LT522nBmcZebr6dc9dRF+C/0HSoatYVh2XcGLtzVx3E xExr8R47MJQjtshQg0DFzSGeRggSUIFIJagaVkeZsNan3AgZRfiIPYNB+6KNNJqN7Ju5 sPUlMQ9ButNPO1a0rlINJvESSzzMqbsqGE44L/1kj/ihJMOP2ud5qRyhKqfKlwd/bnCj qF81XSSqVBiaXDMaLO+asy6oBA0V0yHx5azHhGoEazC27cFFtVPNXK6NRei9eSiru7w4 PHFsQO6nSh27wVuD19u8/VQnbfzcqu7trIGd8KXfAu96mNhBvZzO4D343GCU3ZW678O8 4A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1jjn36du-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:47 +0000 Received: from m0098396.ppops.net (m0098396.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24D8lwN5010850; Fri, 13 May 2022 09:51:47 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1jjn36dc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:47 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24D9SnGG026829; Fri, 13 May 2022 09:51:45 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03ams.nl.ibm.com with ESMTP id 3fwgd90cmq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:45 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24D9pg5h36176218 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 09:51:42 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0359B4C04E; Fri, 13 May 2022 09:51:42 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E94D4C044; Fri, 13 May 2022 09:51:41 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 09:51:41 +0000 (GMT) From: Janosch Frank To: kvm390 mailing list 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 2/6] s390x: uv-host: Add uninitialized UV tests Date: Fri, 13 May 2022 09:50:13 +0000 Message-Id: <20220513095017.16301-3-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220513095017.16301-1-frankja@linux.ibm.com> References: <20220513095017.16301-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: sbLResKu52Cm8Vr72IoafvS4qLbVFIrU X-Proofpoint-GUID: hZwwggLV-jHWTMCtPgQsZh1xm-qnrSSS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 spamscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130041 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's also test for rc 0x3 Signed-off-by: Janosch Frank Reviewed-by: Nico Boehr --- s390x/uv-host.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 0f0b18a1..f846fc42 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -83,6 +83,24 @@ static void test_priv(void) report_prefix_pop(); } +static void test_uv_uninitialized(void) +{ + struct uv_cb_header uvcb = {}; + int i; + + report_prefix_push("uninitialized"); + + /* i = 1 to skip over initialize */ + for (i = 1; cmds[i].name; i++) { + expect_pgm_int(); + uvcb.cmd = cmds[i].cmd; + uvcb.len = cmds[i].len; + uv_call_once(0, (uint64_t)&uvcb); + report(uvcb.rc == UVC_RC_INV_STATE, "%s", cmds[i].name); + } + report_prefix_pop(); +} + static void test_config_destroy(void) { int rc; @@ -477,13 +495,68 @@ static void test_invalid(void) report_prefix_pop(); } +static void test_clear_setup(void) +{ + unsigned long vsize; + int rc; + + uvcb_cgc.header.cmd = UVC_CMD_CREATE_SEC_CONF; + uvcb_cgc.header.len = sizeof(uvcb_cgc); + + uvcb_cgc.guest_stor_origin = 0; + uvcb_cgc.guest_stor_len = 42 * (1UL << 20); + vsize = uvcb_qui.conf_base_virt_stor_len + + ((uvcb_cgc.guest_stor_len / (1UL << 20)) * uvcb_qui.conf_virt_var_stor_len); + + uvcb_cgc.conf_base_stor_origin = (uint64_t)memalign(PAGE_SIZE * 4, uvcb_qui.conf_base_phys_stor_len); + uvcb_cgc.conf_var_stor_origin = (uint64_t)memalign(PAGE_SIZE, vsize); + uvcb_cgc.guest_asce = (uint64_t)memalign(PAGE_SIZE, 4 * PAGE_SIZE) | ASCE_DT_SEGMENT | REGION_TABLE_LENGTH | ASCE_P; + uvcb_cgc.guest_sca = (uint64_t)memalign(PAGE_SIZE * 4, PAGE_SIZE * 4); + + rc = uv_call(0, (uint64_t)&uvcb_cgc); + assert(rc == 0); + + uvcb_csc.header.len = sizeof(uvcb_csc); + uvcb_csc.header.cmd = UVC_CMD_CREATE_SEC_CPU; + uvcb_csc.guest_handle = uvcb_cgc.guest_handle; + uvcb_csc.stor_origin = (unsigned long)memalign(PAGE_SIZE, uvcb_qui.cpu_stor_len); + uvcb_csc.state_origin = (unsigned long)memalign(PAGE_SIZE, PAGE_SIZE); + + rc = uv_call(0, (uint64_t)&uvcb_csc); + assert(rc == 0); +} + static void test_clear(void) { - uint64_t *tmp = (void *)uvcb_init.stor_origin; + uint64_t *tmp; + + report_prefix_push("load normal reset"); + + /* + * Setup a config and a cpu so we can check if a diag308 reset + * clears the donated memory and makes the pages unsecure. + */ + test_clear_setup(); diag308_load_reset(1); sclp_console_setup(); - report(!*tmp, "memory cleared after reset 1"); + + tmp = (void *)uvcb_init.stor_origin; + report(!*tmp, "uv init donated memory cleared"); + + tmp = (void *)uvcb_cgc.conf_base_stor_origin; + report(!*tmp, "config base donated memory cleared"); + + tmp = (void *)uvcb_cgc.conf_base_stor_origin; + report(!*tmp, "config variable donated memory cleared"); + + tmp = (void *)uvcb_csc.stor_origin; + report(!*tmp, "cpu donated memory cleared after reset 1"); + + /* Check if uninitialized after reset */ + test_uv_uninitialized(); + + report_prefix_pop(); } static void setup_vmem(void) @@ -514,6 +587,7 @@ int main(void) test_priv(); test_invalid(); + test_uv_uninitialized(); test_query(); test_init(); From patchwork Fri May 13 09:50:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12848601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD81C433EF for ; Fri, 13 May 2022 09:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379202AbiEMJvx (ORCPT ); Fri, 13 May 2022 05:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379171AbiEMJvu (ORCPT ); Fri, 13 May 2022 05:51:50 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 887D45716C; Fri, 13 May 2022 02:51:49 -0700 (PDT) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D7UooF006336; Fri, 13 May 2022 09:51:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=CBlQFujlHui4J0+Bukn5kJ6beRwi1q8Q0IXGaXG08WA=; b=F2hpGAotyu6hV3HgJ7xpxWCscJzobgRS5o83Bnldmq39eu46GNfl68agVUEO0QO2CZrh qjhCA3iRQwLaHh+Iv0fsTXHOCGitQRFSydxc/QFcfCgjzKBVSLv7tCviIryx3TamjXv3 +5+fjA4vGndVHhr4Q7W9ZjMcSXxqjlQZUvfE3XvcCyGOKW22QQ3+Id5RrbjABbi7BhlX efuSWFOxQQb05FHps4/lGS1capnKB/AvrPMYP3KZzsAfg3bGJCT7BmT3mwXGvE4re9++ 3Uxxh9svlw2YgpweEyzaAp/r5ZPg0GszNVKuZsTSOAjUBh6GzSQMwDgXJNiHCm101wnx YA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1k0s2gw5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:48 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24D9e862018260; Fri, 13 May 2022 09:51:48 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1k0s2gvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:47 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24D9RJGI006771; Fri, 13 May 2022 09:51:46 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma03fra.de.ibm.com with ESMTP id 3g0kn79x15-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:46 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24D9pJLP27787592 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 09:51:19 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07C624C05A; Fri, 13 May 2022 09:51:43 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 294FF4C044; Fri, 13 May 2022 09:51:42 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 09:51:42 +0000 (GMT) From: Janosch Frank To: kvm390 mailing list 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 3/6] s390x: uv-host: Test uv immediate parameter Date: Fri, 13 May 2022 09:50:14 +0000 Message-Id: <20220513095017.16301-4-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220513095017.16301-1-frankja@linux.ibm.com> References: <20220513095017.16301-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: DQIw_PX2P2uvRyfT1Uea1cTzt1XwiLo9 X-Proofpoint-ORIG-GUID: j0I6DDIt_qkwP3Wi99MMT_AjFEFtY5MH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 suspectscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 bulkscore=0 clxscore=1015 impostorscore=0 mlxlogscore=957 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130041 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's check if we get a specification PGM exception if we set a non-zero i3 when doing a UV call. Signed-off-by: Janosch Frank --- s390x/uv-host.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index f846fc42..fcb82d24 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -64,6 +64,28 @@ static struct cmd_list cmds[] = { { NULL, 0, 0 }, }; +static void test_i3(void) +{ + struct uv_cb_header uvcb = { + .cmd = UVC_CMD_INIT_UV, + .len = sizeof(struct uv_cb_init), + }; + unsigned long r1 = 0; + int cc; + + report_prefix_push("i3"); + expect_pgm_int(); + asm volatile( + "0: .insn rrf,0xB9A40000,%[r1],%[r2],4,2\n" + " ipm %[cc]\n" + " srl %[cc],28\n" + : [cc] "=d" (cc) + : [r1] "a" (r1), [r2] "a" (&uvcb) + : "memory", "cc"); + check_pgm_int_code(PGM_INT_CODE_SPECIFICATION); + report_prefix_pop(); +} + static void test_priv(void) { struct uv_cb_header uvcb = {}; @@ -585,6 +607,7 @@ int main(void) goto done; } + test_i3(); test_priv(); test_invalid(); test_uv_uninitialized(); From patchwork Fri May 13 09:50:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12848602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4FF2C433EF for ; Fri, 13 May 2022 09:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379205AbiEMJvy (ORCPT ); Fri, 13 May 2022 05:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379190AbiEMJvv (ORCPT ); Fri, 13 May 2022 05:51:51 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A095E5838F; Fri, 13 May 2022 02:51:50 -0700 (PDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D8BcxP028356; Fri, 13 May 2022 09:51:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=7zAyM2ZRtBrSHzKiQ797Zm03ztOww4v7EOWmF622auo=; b=ZuXjk9d+wZEnqJe059QmjHrKLCMgRFp7F5QhMTVLVwqwxpp+ZXkJugYYR1TWEG4+YaWv Nagvn/AERM65wv3Cs5cojgG1l/XT7e6x/kwncEu7TsnJIijXlix4Nt7fUi3xc0cf8knX cvZOimrX4j4C410y8yRv5SZCjh2xR/koISbAL8JyWrbfjPpab0SfMXEpqzMB3iw2/lry MkVwih8pr4cfgGYV25ecnGX2MwLnNrDduWswJBqHh6b1FCHUI5mJtzanJq7W65bsVq5n xpPqIzmH3Zz3rDQTPzZ69e3GQSVxdt2S4UzmhgMw28/vLQ9EPGVsRnAzW5N0kh4bmuVL lA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1ket1xvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:50 +0000 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24D9XWQN002680; Fri, 13 May 2022 09:51:49 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1ket1xvh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:49 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24D9RY51029729; Fri, 13 May 2022 09:51:47 GMT Received: from b06avi18626390.portsmouth.uk.ibm.com (b06avi18626390.portsmouth.uk.ibm.com [9.149.26.192]) by ppma04ams.nl.ibm.com with ESMTP id 3fwgd90c8w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:47 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24D9c3TB47317378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 09:38:03 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 017FB4C044; Fri, 13 May 2022 09:51:44 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2D1754C046; Fri, 13 May 2022 09:51:43 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 09:51:43 +0000 (GMT) From: Janosch Frank To: kvm390 mailing list 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 4/6] s390x: uv-host: Add access exception test Date: Fri, 13 May 2022 09:50:15 +0000 Message-Id: <20220513095017.16301-5-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220513095017.16301-1-frankja@linux.ibm.com> References: <20220513095017.16301-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: XIwFjc1ELiumUgXgHj1Kvf5lBvXZtXQZ X-Proofpoint-GUID: qtDL989YwIpFpskRAqLvfoRh0zFVvF6Q X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 adultscore=0 clxscore=1015 malwarescore=0 bulkscore=0 priorityscore=1501 mlxlogscore=999 phishscore=0 impostorscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130041 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Let's check that we get access exceptions if the UVCB is on an invalid page or starts at a valid page and crosses into an invalid one. Signed-off-by: Janosch Frank Reviewed-by: Nico Boehr Reviewed-by: Steffen Eiden --- s390x/uv-host.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index fcb82d24..153a94e1 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -15,12 +15,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -123,6 +125,54 @@ static void test_uv_uninitialized(void) report_prefix_pop(); } +static void test_access(void) +{ + struct uv_cb_header *uvcb; + void *pages = alloc_pages(1); + uint16_t pgm; + int i; + + /* Put UVCB on second page which we will protect later */ + uvcb = pages + PAGE_SIZE; + + report_prefix_push("access"); + + report_prefix_push("non-crossing"); + protect_page(uvcb, PAGE_ENTRY_I); + for (i = 0; cmds[i].name; i++) { + expect_pgm_int(); + mb(); + uv_call_once(0, (uint64_t)uvcb); + pgm = clear_pgm_int(); + report(pgm == PGM_INT_CODE_PAGE_TRANSLATION, "%s", cmds[i].name); + } + report_prefix_pop(); + + report_prefix_push("crossing"); + /* + * Put the header into the readable page 1, everything after + * the header will be on the second, invalid page. + */ + uvcb -= 1; + for (i = 0; cmds[i].name; i++) { + uvcb->cmd = cmds[i].cmd; + uvcb->len = cmds[i].len; + + expect_pgm_int(); + mb(); + uv_call_once(0, (uint64_t)uvcb); + pgm = clear_pgm_int(); + report(pgm == PGM_INT_CODE_PAGE_TRANSLATION, "%s", cmds[i].name); + } + report_prefix_pop(); + + uvcb += 1; + unprotect_page(uvcb, PAGE_ENTRY_I); + + free_pages(pages); + report_prefix_pop(); +} + static void test_config_destroy(void) { int rc; @@ -615,6 +665,8 @@ int main(void) test_init(); setup_vmem(); + test_access(); + test_config_create(); test_cpu_create(); test_cpu_destroy(); From patchwork Fri May 13 09:50:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12848604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DF47C433F5 for ; Fri, 13 May 2022 09:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379213AbiEMJv5 (ORCPT ); Fri, 13 May 2022 05:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379200AbiEMJvw (ORCPT ); Fri, 13 May 2022 05:51:52 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 963375716C; Fri, 13 May 2022 02:51:51 -0700 (PDT) Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D8l1UL017330; Fri, 13 May 2022 09:51:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=Oi6VVb6LHV67qgW+GLrA+NNjrQLt95htfOR/g/RMC0A=; b=X4LbRtdnMR3YBU6lh5tYJU74e7pxMiVh1/acmvSIUzhJTibFXTu1LFDAUpJAyL4a8mZw qtAs0vXL4D6uJRFOcC1NFDc1dnZmOa8DnkNABvBWWjyYhSfOtC7OEh87NpJtzKh+Q8Rp +5c+p7s60L3rzaqxusagWud5Z8UZtMMBbHuFPJf8ctJEGiRfQsWUgfhMicqJU3l4uvBR gZToER6vXBR8M/Q7MALmioqF/TuZGCnzUrwC4xO/BkAeKMVyNrt/ac3oHEYkk8jRrtSV harrf9U9bB8vuWC9T0VrR3FdlMP3BX+jNQC1pvaXObwTJ4zWOaBpPJY97wz5HcwKNzjs qw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1m4g93xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:50 +0000 Received: from m0127361.ppops.net (m0127361.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24D9hZfr010406; Fri, 13 May 2022 09:51:50 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1m4g93x9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:50 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24D9RvDW024501; Fri, 13 May 2022 09:51:48 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma06fra.de.ibm.com with ESMTP id 3fwg1hxhu7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:48 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24D9pjdV49152388 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 09:51:45 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F05E54C046; Fri, 13 May 2022 09:51:44 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 27C044C044; Fri, 13 May 2022 09:51:44 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 09:51:44 +0000 (GMT) From: Janosch Frank To: kvm390 mailing list 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 5/6] s390x: uv-host: Add a set secure config parameters test function Date: Fri, 13 May 2022 09:50:16 +0000 Message-Id: <20220513095017.16301-6-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220513095017.16301-1-frankja@linux.ibm.com> References: <20220513095017.16301-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Yyt9zraNINHo9TnfF4x9tMtoUKIK_E5y X-Proofpoint-ORIG-GUID: vmiBrgr68MNdcbS3d19W9Rixz4WR28OT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 clxscore=1015 malwarescore=0 spamscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130041 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Time for more tests. Signed-off-by: Janosch Frank Reviewed-by: Steffen Eiden --- s390x/uv-host.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 153a94e1..20d805b8 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -229,6 +229,52 @@ static void test_cpu_destroy(void) report_prefix_pop(); } +static void test_set_se_header(void) +{ + struct uv_cb_ssc uvcb = { + .header.cmd = UVC_CMD_SET_SEC_CONF_PARAMS, + .header.len = sizeof(uvcb), + .guest_handle = uvcb_cgc.guest_handle, + .sec_header_origin = 0, + .sec_header_len = 0x1000, + }; + void *pages = alloc_pages(1); + void *inv; + int rc; + + report_prefix_push("sscp"); + + uvcb.header.len -= 8; + rc = uv_call(0, (uint64_t)&uvcb); + report(rc == 1 && uvcb.header.rc == UVC_RC_INV_LEN, + "hdr invalid length"); + uvcb.header.len += 8; + + uvcb.guest_handle += 1; + rc = uv_call(0, (uint64_t)&uvcb); + report(rc == 1 && uvcb.header.rc == UVC_RC_INV_GHANDLE, "invalid handle"); + uvcb.guest_handle -= 1; + + inv = pages + PAGE_SIZE; + uvcb.sec_header_origin = (uint64_t)inv; + protect_page(inv, PAGE_ENTRY_I); + rc = uv_call(0, (uint64_t)&uvcb); + report(rc == 1 && uvcb.header.rc == 0x103, + "se hdr access exception"); + + /* + * Shift the ptr so the first few DWORDs are accessible but + * the following are on an invalid page. + */ + uvcb.sec_header_origin -= 0x20; + rc = uv_call(0, (uint64_t)&uvcb); + report(rc == 1 && uvcb.header.rc == 0x103, + "se hdr access exception crossing"); + unprotect_page(inv, PAGE_ENTRY_I); + + report_prefix_pop(); +} + static void test_cpu_create(void) { int rc; @@ -669,6 +715,7 @@ int main(void) test_config_create(); test_cpu_create(); + test_set_se_header(); test_cpu_destroy(); test_config_destroy(); test_clear(); From patchwork Fri May 13 09:50:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janosch Frank X-Patchwork-Id: 12848603 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1960CC43219 for ; Fri, 13 May 2022 09:51:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379209AbiEMJv4 (ORCPT ); Fri, 13 May 2022 05:51:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379201AbiEMJvx (ORCPT ); Fri, 13 May 2022 05:51:53 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E8805D665; Fri, 13 May 2022 02:51:52 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24D9hEAc012721; Fri, 13 May 2022 09:51:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=52fDuQPYFXca0LYfFeybSBKZW6kXkBnj3Ycnrl6qObg=; b=J1k0KKn09FDl8twDPZWvZq5yJyz9SEMR1BEk5xxtQ+EMRNOSrkAfi3w7oHbD8WBBfW3f XT0Wx8ZNIOwqz/aCbaPBpov0w8wCtATG+JKhO584XaO5WBbKPdUp/lDZ5koaqb7yLcz8 qAj8AOcqLdQIAqUURSwLs7uD6KBf4R6/z9GWwCZ+EKOnBM3nPdkg5uAj74T0ijg/R9nA TlzIGVbhIVCIfCWhJqXlbw9Oi352ecXLtUhUOjYj+glkSI8BzQsjUXBXX5iHIjfRiX8k mSsGrQca913nTU0zotP/GfMuFxmCtAKAGSYM0LyVzQ4XX5ur3mDmb6vBDEgXw3wYI7fD ng== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1mxr04dn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:51 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24D9hNu7012828; Fri, 13 May 2022 09:51:50 GMT Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3g1mxr04d3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:50 +0000 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24D9TC7D027268; Fri, 13 May 2022 09:51:49 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03ams.nl.ibm.com with ESMTP id 3fwgd90cmu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 May 2022 09:51:48 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24D9pkVD56295798 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 May 2022 09:51:46 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3A804C046; Fri, 13 May 2022 09:51:45 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 223A44C044; Fri, 13 May 2022 09:51:45 +0000 (GMT) Received: from linux6.. (unknown [9.114.12.104]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 13 May 2022 09:51:45 +0000 (GMT) From: Janosch Frank To: kvm390 mailing list 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 6/6] s390x: uv-host: Remove duplicated + Date: Fri, 13 May 2022 09:50:17 +0000 Message-Id: <20220513095017.16301-7-frankja@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220513095017.16301-1-frankja@linux.ibm.com> References: <20220513095017.16301-1-frankja@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: lfCAIvmL-b_vK9syU0kUlkIMjnr7js8c X-Proofpoint-ORIG-GUID: 6-sJr5Gb_H6ym3a4Is1ORcGWZYOrhQNR X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-13_04,2022-05-12_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2205130041 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org One + is definitely enough here. Signed-off-by: Janosch Frank Reviewed-by: Claudio Imbrenda Reviewed-by: Steffen Eiden --- s390x/uv-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s390x/uv-host.c b/s390x/uv-host.c index 20d805b8..ed16f850 100644 --- a/s390x/uv-host.c +++ b/s390x/uv-host.c @@ -433,7 +433,7 @@ static void test_config_create(void) uvcb_cgc.guest_sca = tmp; tmp = uvcb_cgc.guest_sca; - uvcb_cgc.guest_sca = get_max_ram_size() + + PAGE_SIZE * 4; + uvcb_cgc.guest_sca = get_max_ram_size() + PAGE_SIZE * 4; rc = uv_call(0, (uint64_t)&uvcb_cgc); report(uvcb_cgc.header.rc == 0x10d && rc == 1, "sca inaccessible");