main/haveged: fix for armhf and aarch64

armhf and aarch64 apparently does not expose the cpu cache size via
sysfs. It set it to -1 and that confuses haveged. Make it fallback to
default cache size when sysfs reports -1.
This commit is contained in:
Natanael Copa 2018-05-18 14:39:26 +00:00
parent 5db9c7d1de
commit 3cb6d79b93
3 changed files with 18 additions and 1 deletions

View File

@ -3,7 +3,7 @@
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=haveged
pkgver=1.9.2
pkgrel=0
pkgrel=1
pkgdesc="Entropy harvesting daemon using CPU timings"
url="https://sourceforge.net/projects/haveged"
arch="all"
@ -11,6 +11,7 @@ license="GPL"
subpackages="$pkgname-doc"
makedepends="linux-headers"
source="$pkgname-$pkgver.tar.gz::https://sourceforge.net/projects/haveged/files/$pkgname-$pkgver.tar.gz/download
fix-cpu-cache-size-detection.patch
haveged.initd
haveged.confd"
builddir="$srcdir/$pkgname-$pkgver"
@ -45,5 +46,6 @@ package() {
}
sha512sums="65f70950fb90ef9c24ff3bf1b26e19a9cde2bec4749e2e64d5461a51646a20cf610efa2a5014219b8605957afa0084abd2ba11c7dc15f9379afce784971627b8 haveged-1.9.2.tar.gz
6279296b057f19daf25020ac14997268230af4b11510d6e5c4a86989c119d6b081d2501069af198772302d5cce1464514c749033a4928fb95671268825a84ba8 fix-cpu-cache-size-detection.patch
5d1e4186580951d4e6e01193e9c8827ceddaf3c2e28a981fc9176cb446bed32b059304796a77d9db6fb761a21f8fd27dd3d31e06a0fb7a5985b4ea94978fcd64 haveged.initd
57201472fc659aaab919562a00d474d3823d5becea62e8b13ef93eda05e1fd667721c968f224fcae871d13cfcd16d1924403d9181e0899fa214fa00bf4fefc75 haveged.confd"

View File

View File

@ -0,0 +1,15 @@
Some ARM cpus does not report the cache size or say it is -1
diff --git a/src/havegetune.c b/src/havegetune.c
index f1a99f2..de39c53 100644
--- a/src/havegetune.c
+++ b/src/havegetune.c
@@ -795,6 +795,8 @@ static int vfs_configInfoCache(
ctype = vfs_configFile(pAnchor, path, vfs_configType);
strcpy(path+plen, "size");
size = vfs_configFile(pAnchor, path, vfs_configInt);
+ if (size == -1)
+ size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;
cfg_cacheAdd(pAnchor, SRC_VFS_INDEX, pArgs[1], level, ctype, size);
}
}