NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/42656: netbsd-5: panic LOCKDEBUG in opencrypto(9)




Looking more into the interaction of opencrypto and rnd,
points:
1/3: disabling rnd collection from hifn0 => still panics
2/3: removing pseudo-device rnd from the kernel => needed for hifn(4)
3/3: patching arc4_randrekey() to not use rnd_extract_data() =>

Details:

1/2:
The panic still happens if the hifn0 device is not used for collecting random data.

# rndctl -l
Source                 Bits Type      Flags
wd0                    2367 disk estimate, collect
hifn0                522989 rng  collect
# rndctl -C -d hifn0
# rndctl -l
Source                 Bits Type      Flags
wd0                    2367 disk estimate, collect
hifn0                526426 rng
# while true ; do  openssl speed -evp aes-128-cbc -elapsed ; done
...
Mutex error: lockdebug_barrier: spin lock held

lock address : 0x00000000c04a9954 type     :               spin
initialized  : 0x00000000c0113204
shared holds :                  0 exclusive:                  1
shares wanted:                  0 exclusive:                  0
current cpu  :                  0 last held:                  0
current lwp  : 0x00000000cb9f85c0 last held: 0x00000000cb9f85c0
last locked  : 0x00000000c0117984 unlocked : 0x00000000c0118b69
owner field  : 0x0000000000010600 wait/spin:                0/1

panic: LOCKDEBUG
fatal breakpoint trap in supervisor mode
trap type 1 code 0 eip c034f34c cs 8 eflags 246 cr2 bb9bd770 ilevel 6
Stopped in pid 475.1 (openssl) at netbsd:breakpoint+0x4: popl %ebp
db{0}>
db{0}> bt
breakpoint(c0438322,cb91e7f8,c0464cc0,c02aba4f,6,1,0,0,cb91e7f8,c0100e1a) at 
netbsd:breakpoint+0x4
panic(c0438324,c0434736,c04066e8,c043833d,5b40,1000001,6,0,0,0) at 
netbsd:panic+0x1b0
lockdebug_abort1(c043833d,1,0,0,0,cb9f85c0,0,0,cb9f85c0,cb91e934) at 
netbsd:lockdebug_abort1+0xbb
mutex_vector_enter(c04b006c,cb9e8d40,cb91e8ec,c02a44df,cba65b4c,cb9e8d40,cb91e8ec,c02a48ba,8,20)
 at netbsd:mutex_vector_enter+0x3b7
rnd_extract_data(cb91e8f0,20,1,4,4,4,293,c027955e,0,0) at 
netbsd:rnd_extract_data+0x13
arc4_randrekey(cad0117c,10,c04a9956,c1198101,cad0117c,0,0,4,0,0) at 
netbsd:arc4_randrekey+0x3d
hifn_newsession(cad01000,cb91ea5c,cb91eb0c,c027955e,0,0,4,c03df1b6,cb642880,0) 
at netbsd:hifn_newsession+0xeb
crypto_newsession(cb91eb54,cb91eb0c,1,c0419cbc,62d,cb6267d8,0,c02eb5b7,0,cb91eb0c)
 at netbsd:crypto_newsession+0xac
cryptodev_session(c11a8f00,cb91ec50,297,c027955e,7,0,cb91ebac,c03df1b6,c0700ec0,c11a8f00)
 at netbsd:cryptodev_session+0x432
cryptof_ioctl(cb9e6100,c0206370,cb91ec50,0,c0296014,cb9f85c0,7,c06fc014,3,0) at 
netbsd:cryptof_ioctl+0x78
sys_ioctl(cb9f85c0,cb91ed00,cb91ed28,cb91ed40,c0343532,ca47ae40,293,3,c0206370,bb8120d0)
 at netbsd:sys_ioctl+0x13f
syscall(cb91ed48,b3,ab,1f,1f,bb8120f0,b,bfbfb748,bbb99640,bb8120d0) at 
etbsd:syscall+0xc8
db{0}>


2/2:
Disabling "pseudo-device rnd" in the kernel is a no-go:

/usr/src-5/sys/dev/pci/hifn7751.c:56:2: error: #error hifn7751 requires rnd 
pseudo-devices


3/3:
patching arc4_randrekey() to not use rnd_extract_data()
gives makes the above "openssl speed -evp aes-128-cbc -elapsed" run for several hours without panic.

Unfortunately, performance still bad:
aes-128-cbc        137.54k      541.53k     1677.18k     4404.90k    14008.05k
aes-128-cbc        135.32k      536.01k     1816.32k     4451.51k    13926.40k
aes-128-cbc        137.91k      531.14k     1689.77k     4468.86k    14024.38k


 - Hubert


Home | Main Index | Thread Index | Old Index