Fix race condition in arc4random (#1166878)

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2014-11-26 14:20:31 +01:00
parent 6cdcf55a00
commit 3249758581
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From b4200f7e7ac1ca4a315df84e92cd31d8ba423cee Mon Sep 17 00:00:00 2001
From: wouter <wouter@be551aaa-1e26-0410-a405-d3ace91eadb9>
Date: Fri, 21 Nov 2014 08:22:18 +0000
Subject: [PATCH] - Fix crash on multiple thread random usage on systems
without arc4random.
git-svn-id: http://unbound.nlnetlabs.nl/svn/trunk@3277 be551aaa-1e26-0410-a405-d3ace91eadb9
---
compat/arc4_lock.c | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/compat/arc4_lock.c b/compat/arc4_lock.c
index ce8bb41..faa743d 100644
--- a/compat/arc4_lock.c
+++ b/compat/arc4_lock.c
@@ -53,8 +53,10 @@ static int arc4lockinit = 0;
void _ARC4_LOCK(void)
{
- if(!arc4lockinit)
+ if(!arc4lockinit) {
+ arc4lockinit = 1;
lock_quick_init(&arc4lock);
+ }
lock_quick_lock(&arc4lock);
}
--
1.9.3

View File

@ -19,7 +19,7 @@
Summary: Validating, recursive, and caching DNS(SEC) resolver
Name: unbound
Version: 1.5.0
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD
Url: http://www.nlnetlabs.nl/unbound/
Source: http://www.unbound.net/downloads/%{name}-%{version}.tar.gz
@ -41,6 +41,8 @@ Source14: unbound.sysconfig
Source15: unbound.cron
Source16: unbound-munin.README
Patch0: unbound-1.5.0-arc4random-race-condition.patch
Group: System Environment/Daemons
BuildRequires: flex, openssl-devel
BuildRequires: libevent-devel expat-devel
@ -113,6 +115,8 @@ Python modules and extensions for unbound
%prep
%setup -q
%patch0 -p1 -b .arc4random_fix
%build
# This is needed to rebuild the configure script to support Python 3.x
@ -290,6 +294,9 @@ exit 0
/bin/systemctl try-restart unbound-keygen.service >/dev/null 2>&1 || :
%changelog
* Wed Nov 26 2014 Tomas Hozza <thozza@redhat.com> - 1.5.0-2
- Fix race condition in arc4random (#1166878)
* Wed Nov 19 2014 Tomas Hozza <thozza@redhat.com> - 1.5.0-1
- update to 1.5.0