Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-85954

openssl calls "close(-1)" if /dev/z90crypt is missing on s390x

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • openssl-3.5.0-1.el9
    • Yes
    • Moderate
    • 2
    • rhel-security-crypto-diamonds
    • ssg_security
    • 11
    • 26
    • 0.1
    • QE ack, Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • Crypto25Q2, Crypto25August
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • s390x
    • None

      What were you trying to do that didn't work?

      Runing PCP testsuite with linked openssl on s390x under valgrind governance is causing error report

       File descriptor -1 Invalid file descriptor 

      This breaks a lot of upstream as well as downstream tests of PCP.

      What is the impact of this issue to you?

      Broken upstream as well as downstream testsuite when using valgrind.

      Please provide the package NVR for which the bug is seen:

      openssl-3.2.2-6.el9_5.1.s390x

      How reproducible is this bug?:

      Always

      Steps to reproduce

      The reproduction scenario is quite complicated as it involves setup of PCP environment and testsuite preparation, however I was able to pinpoint the broken/missing code in openssl instead:
      File crypto/s390xcap.c

      216     if (cex == 0) {
      217         OPENSSL_s390xcex = -1;
      218     } else {
      219         OPENSSL_s390xcex = open("/dev/z90crypt", O_RDWR | O_CLOEXEC);
      220         if (probe_cex() == 1)
      221             OPENSSL_atexit(OPENSSL_s390x_cleanup);
      222     }
      

      If the /dev/z90crypt is missing then OPENSSL_s390xcex is set to -1 and probe_cex() is called. In probe_cex() we can see then:

      249     if (ioctl(OPENSSL_s390xcex, ICARSAMODEXPO, &me) == -1) {
      250         (void)close(OPENSSL_s390xcex);
      251         OPENSSL_s390xcex = -1;
      252         rc = 0;
      

      ioctl() is called with file descriptor -1 and the close() is called with file descriptor -1.

      Expected results

      No issues reported by valgrind.

      Actual results

      Valgrind reports

       File descriptor -1 Invalid file descriptor 
      

              dbelyavs@redhat.com Dmitry Belyavskiy
              jkurik@redhat.com Jan Kurik
              Dmitry Belyavskiy Dmitry Belyavskiy
              Georgios Stavros Pantelakis Georgios Stavros Pantelakis
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: