lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <36670270-13f7-f044-7419-57f444317fd9@linux.ibm.com>
Date:   Mon, 13 Aug 2018 11:24:48 +0200
From:   Harald Freudenberger <freude@...ux.ibm.com>
To:     Cornelia Huck <cohuck@...hat.com>,
        Tony Krowiak <akrowiak@...ux.vnet.ibm.com>
Cc:     linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org, freude@...ibm.com, schwidefsky@...ibm.com,
        heiko.carstens@...ibm.com, borntraeger@...ibm.com,
        kwankhede@...dia.com, bjsdjshi@...ux.vnet.ibm.com,
        pbonzini@...hat.com, alex.williamson@...hat.com,
        pmorel@...ux.vnet.ibm.com, alifm@...ux.vnet.ibm.com,
        mjrosato@...ux.vnet.ibm.com, jjherne@...ux.vnet.ibm.com,
        thuth@...hat.com, pasic@...ux.vnet.ibm.com, berrange@...hat.com,
        fiuczy@...ux.vnet.ibm.com, buendgen@...ibm.com,
        frankja@...ux.ibm.com
Subject: Re: [PATCH v8 04/22] s390/zcrypt: Integrate ap_asm.h into
 include/asm/ap.h.

Here is now the add-on patch which changes the returncode for the
ap_instructions_available() function.

I talked with Heiko Carstens and this patch will go into the next pull
request for the 4.19 kernel.

-----------------------------------------------------------------------------------------
>From 9e050f843f3281da1f65292422e30f2dd1fd6d98 Mon Sep 17 00:00:00 2001
From: Harald Freudenberger <freude@...ux.ibm.com>
Date: Thu, 9 Aug 2018 11:59:34 +0200
Subject: [PATCH] s390/zcrypt: fix ap_instructions_available() returncodes

During review of KVM patches it was complained that the
ap_instructions_available() function returns 0 if AP
instructions are available and -ENODEV if not. The function
acts like a boolean function to check for AP instructions
available and thus should return 0 on failure and != 0 on
success. Changed to the suggested behaviour and adapted
the one and only caller of this function which is the ap
bus core code.

Signed-off-by: Harald Freudenberger <freude@...ux.ibm.com>
---
 arch/s390/include/asm/ap.h   | 10 +++++-----
 drivers/s390/crypto/ap_bus.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/s390/include/asm/ap.h b/arch/s390/include/asm/ap.h
index 046e044a48d0..887494aa164f 100644
--- a/arch/s390/include/asm/ap.h
+++ b/arch/s390/include/asm/ap.h
@@ -49,20 +49,20 @@ struct ap_queue_status {
 /**
  * ap_intructions_available() - Test if AP instructions are available.
  *
- * Returns 0 if the AP instructions are installed.
+ * Returns 1 if the AP instructions are installed, otherwise 0.
  */
 static inline int ap_instructions_available(void)
 {
     register unsigned long reg0 asm ("0") = AP_MKQID(0, 0);
-    register unsigned long reg1 asm ("1") = -ENODEV;
-    register unsigned long reg2 asm ("2");
+    register unsigned long reg1 asm ("1") = 0;
+    register unsigned long reg2 asm ("2") = 0;
 
     asm volatile(
         "   .long 0xb2af0000\n"        /* PQAP(TAPQ) */
-        "0: la    %0,0\n"
+        "0: la    %0,1\n"
         "1:\n"
         EX_TABLE(0b, 1b)
-        : "+d" (reg1), "=d" (reg2)
+        : "+d" (reg1), "+d" (reg2)
         : "d" (reg0)
         : "cc");
     return reg1;
diff --git a/drivers/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c
index b023e35786ec..b1b73945d746 100644
--- a/drivers/s390/crypto/ap_bus.c
+++ b/drivers/s390/crypto/ap_bus.c
@@ -1475,7 +1475,7 @@ static int __init ap_module_init(void)
     if (rc)
         return rc;
 
-    if (ap_instructions_available() != 0) {
+    if (!ap_instructions_available()) {
         pr_warn("The hardware system does not support AP instructions\n");
         return -ENODEV;
     }
-- 
2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ