Maintained by: NLnet Labs

[Unbound-users] unbound-1.5.0 crash(arc4random) on rhel7

W.C.A. Wijngaards
Fri Nov 21 09:23:41 CET 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Jarno,

On 20/11/14 19:18, Jarno Huuskonen wrote:
> Hi,
> 
> Just started testing unbound-1.5.0 on rhel7 and I'm getting random 
> crashes. Couple of times unbound crashed when run with gdb (run
> -d): on those times it crashed in arc4random: #0  arc4random () at
> compat/arc4random.c:220 #1  0x00007f5261e39075 in
> arc4random_uniform (upper_bound=29768) at
> compat/arc4random_uniform.c:51 #2  0x00007f5261e397a3 in
> ub_random_max (x=<optimized out>, state=<optimized out>) at
> util/random.c:110 ...
> 
> compile options: %configure  --with-libevent --with-pthreads
> --with-ssl \ --disable-rpath --enable-debug --disable-static \ 
> --with-conf-file=%{_sysconfdir}/%{name}/unbound.conf \ 
> --with-pidfile=%{_localstatedir}/run/%{name}/%{name}.pid \ 
> --with-rootkey-file=%{_sharedstatedir}/unbound/root.key \ 
> --enable-sha2 --disable-gost
> 
> unbound.conf has: num-threads: 2
> 
> The crash usually happens when I use a simple test ruby script
> that send queries(with few hundred threads).

There is a race condition in the new arc4random fallback code.

> Any ideas how I could debug this further ? Or can I provide more
> information if somebody else could look into this ?

This is the bugfix for it:

Index: compat/arc4_lock.c
===================================================================
- --- compat/arc4_lock.c	(revision 3276)
+++ compat/arc4_lock.c	(working copy)
@@ -53,8 +53,10 @@

 void _ARC4_LOCK(void)
 {
- -	if(!arc4lockinit)
+	if(!arc4lockinit) {
+		arc4lockinit = 1;
 		lock_quick_init(&arc4lock);
+	}
 	lock_quick_lock(&arc4lock);
 }


Best regards,
   Wouter

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCAAGBQJUbvaNAAoJEJ9vHC1+BF+NgiwP/j6HiUyZZUJWknOJ+18O7ZtV
EVkeU1kaNkQ/LslnBz8dUhUBck/7d2WQpdnYOWSxglQ2Euk47oWf6IDjOMb2+mGv
AVBDLsb2LKhM3cGzF+DlL4hZ9j66OZZudskvMxZe+ekJw5GoGnCd6uWS3lbp4Zm7
bWzQeQ2TwmllPcXNPj+Ri1McvKj8JPzijrlOUudvKQWqYVbVFgM/Qst393orB5qj
lS+1G694P0XVJ+wYYVHkIklhGzIzxsrfiMXymdDwV/sDQg4G4ICJO7XGAaYusQEI
ImQd1VTFnHFa/653GIBjCurT73LqqCNturVijpniZfvtOvnQUMs4TGWjDL0aHP2x
GHBWAbonV70qAPS3Er7ZNh3IrFazxn1IB2H/H2l2r7lDCUvEcpEuPxoFdSDBk2Ap
Y4o0R75q+vktBmTJ5PGvE8BLzYPY+4ZgBQ43vRF8PsZqEY6rNXZfew7LJVhs2y+g
n9bRL1UL3TDel3C2BJ/OhmvrNekcYzBAyInY2y4Dz76ZYKMtjlJcL5/gdv/tPyV6
HpzatcGgLgQADRZcB+m2UdnDre21PDb2YN2zV33J8SmF5Iv3lAqWbAKENdAmF8nh
haKsm7fBUki1McOcOx68TtIKAfh2hQ50xmPOPjegQA888FDBg0ylHULv9H1FmQty
1Obb7wRMINoJMudKuXBR
=7+6S
-----END PGP SIGNATURE-----