Page MenuHomeFreeBSD

armv8crypto: add missing unlock for session (fix "sleeping thread owns a non-sleepable lock")
ClosedPublic

Authored by greg_unrelenting.technology on Jul 21 2019, 3:07 PM.

Details

Summary

Attempts to use cryptodev (e.g. tests at /usr/src/tests/sys/opencrypto with armv8crypto added to the module lists) were causing a panic:

panic: sleeping thread                                                                                                                                
cpuid = 1                                                                                                                                             
time = 1563713038                                                                                                                                     
KDB: stack backtrace:                                                                                                                                 
[…]
__rw_wlock_hard() at armv8_crypto_newsession+0x80                                                                                                     
         pc = 0xffff00000040017c  lr = 0xffff000001556e14                                                                                             
         sp = 0xffff0000719c1620  fp = 0xffff0000719c1640                                                                                             
                                                                                                                                                      
armv8_crypto_newsession() at crypto_newsession+0x498                                                                                                  
         pc = 0xffff000001556e14  lr = 0xffff0000006448b4                                                                                             
         sp = 0xffff0000719c1650  fp = 0xffff0000719c16c0                                                                                             
                                                                                                                                                      
crypto_newsession() at cryptof_ioctl+0x1168                                                                                                           
         pc = 0xffff0000006448b4  lr = 0xffff000075b9739c                                                                                             
         sp = 0xffff0000719c16d0  fp = 0xffff0000719c1890                                                                                             
                                                                                                                                                      
cryptof_ioctl() at kern_ioctl+0x2f4                                                                                                                   
         pc = 0xffff000075b9739c  lr = 0xffff00000046f518                                                                                             
         sp = 0xffff0000719c18a0  fp = 0xffff0000719c18f0
[…]

Looks like the lock was just never unlocked in the happy case.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

emaste accepted this revision.Jul 22 2019, 1:38 AM
emaste added a subscriber: emaste.
emaste added inline comments.
sys/crypto/armv8/armv8_crypto.c
266 ↗(On Diff #59985)

As an aside the word is dying

This revision is now accepted and ready to land.Jul 22 2019, 1:38 AM
sys/crypto/armv8/armv8_crypto.c
266 ↗(On Diff #59985)

I have noticed that, but didn't want to add typo fixes to an unrelated patch :)

emaste added a comment.Aug 8 2019, 2:31 PM

Looks like this was broken in rS336439

This revision was automatically updated to reflect the committed changes.