Bug 237449

Summary: sys.opencrypto.runtests.main is failing on i386 with EINVAL when calling `fcntl.ioctl`
Product: Base System Reporter: Enji Cooper <ngie>
Component: testsAssignee: Li-Wen Hsu <lwhsu>
Status: Open ---    
Severity: Affects Some People CC: jhb, lwhsu
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Enji Cooper freebsd_committer freebsd_triage 2019-04-21 22:11:02 UTC
This is happening on all branches, AFAICT. From https://ci.freebsd.org/job/FreeBSD-head-i386-test/5132/testReport/junit/sys.opencrypto/runtests/main/ :

```
+ python2 /usr/tests/sys/opencrypto/cryptotest.py
EE.EsEEE.EEE
======================================================================
ERROR: test_cbc (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 70, in test_cbc
    self.runCBC(i)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 178, in runCBC
    c = Crypto(cryptodev.CRYPTO_AES_CBC, cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_gcm (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 75, in test_gcm
    self.runGCM(i, 'ENCRYPT')
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 115, in runGCM
    mackey=cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_sha1hmac (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 269, in test_sha1hmac
    self.runSHA1HMAC(i)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 311, in runSHA1HMAC
    crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_xts (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 65, in test_xts
    self.runXTS(i, cryptodev.CRYPTO_AES_XTS)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 211, in runXTS
    c = Crypto(meth, cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_cbc (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 70, in test_cbc
    self.runCBC(i)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 178, in runCBC
    c = Crypto(cryptodev.CRYPTO_AES_CBC, cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_gcm (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 75, in test_gcm
    self.runGCM(i, 'ENCRYPT')
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 115, in runGCM
    mackey=cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_sha1hmac (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 269, in test_sha1hmac
    self.runSHA1HMAC(i)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 311, in runSHA1HMAC
    crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_tdes (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 226, in test_tdes
    self.runTDES(i)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 252, in runTDES
    c = Crypto(cryptodev.CRYPTO_3DES_CBC, cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

======================================================================
ERROR: test_xts (__main__.GendCryptoTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 65, in test_xts
    self.runXTS(i, cryptodev.CRYPTO_AES_XTS)
  File "/usr/tests/sys/opencrypto/cryptotest.py", line 211, in runXTS
    c = Crypto(meth, cipherkey, crid=crid)
  File "/usr/tests/sys/opencrypto/cryptodev.py", line 181, in __init__
    ioctl(_cryptodev, CIOCGSESSION2, s, 1)
IOError: [Errno 22] Invalid argument

----------------------------------------------------------------------
Ran 12 tests in 0.010s

FAILED (errors=9, skipped=1)
```

It might be because of this error in ioctl(2), but it could also be an issue with the request itself:

```
     [EINVAL]           The request or argp argument is not valid.
```
Comment 1 John Baldwin freebsd_committer freebsd_triage 2021-05-26 20:15:19 UTC
Li-wen, do you know if this failure is still occurring?  The last freebsd-main-i386-test job I looked at was failing to run any tests at all as fsck is dying with a bizarre malloc request:

18:30:48 Starting file system checks:
18:30:48 fsck_ufs: Initial malloc(-1515870811) failed
18:30:48 Automatic file system check failed; help!
18:30:48 ERROR: ABORTING BOOT (sending SIGTERM to parent)!

Do you know if the issues with this particular crypto test were previously fixed on i386?
Comment 2 Li-Wen Hsu freebsd_committer freebsd_triage 2021-05-27 03:44:21 UTC
(In reply to John Baldwin from comment #1)
I'll check and report back.  There are also some characters in the test report not escaped correctly.  They needs to be fixed also.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-01-19 15:59:55 UTC
^Triage: reset "In Progress" status and assign to investigator.