commit 3276ac576a46363ff187dcaaf2cd662b78db6553 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:52:40 2019 -0400 Package init diff --git a/bugfix-cpu-cache-size-detection.patch b/bugfix-cpu-cache-size-detection.patch new file mode 100644 index 0000000..a07788a --- /dev/null +++ b/bugfix-cpu-cache-size-detection.patch @@ -0,0 +1,29 @@ +From f2193587e8e51aa42b192c17ad39467931e2d4c2 Mon Sep 17 00:00:00 2001 +From: Natanael Copa +Date: Wed, 19 Sep 2018 09:51:43 +0200 +Subject: [PATCH] Fix segfault on arm machines + +Some ARM cpus does not report the cache size or say it is -1 in sysfs. +It has been observed on xgene and thunderx machines. + +Fall back to the generic cache size when that happens so we don't +segfault. + +Should fix https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=866306 +--- + src/havegetune.c | 2 ++ + 1 file changed, 2 insertions(+) + +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); + } + } diff --git a/fix-the-core-file-problem.patch b/fix-the-core-file-problem.patch new file mode 100644 index 0000000..5c9a421 --- /dev/null +++ b/fix-the-core-file-problem.patch @@ -0,0 +1,32 @@ +From 9ab2ff6874db0182714d8c09dceda9ee22e177f8 Mon Sep 17 00:00:00 2001 +From: zhangtianxing +Date: Fri, 6 Sep 2019 19:09:13 +0800 +Subject: [PATCH] huawei fix the core file problem + +Signed-off-by: zhangtianxing +--- + src/haveged.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/haveged.c b/src/haveged.c +index d629e17..7496f56 100644 +--- a/src/haveged.c ++++ b/src/haveged.c +@@ -351,6 +351,7 @@ int main(int argc, char **argv) + else run_daemon(handle); + #endif + havege_destroy(handle); ++ handle = NULL; + exit(0); + } + #ifndef NO_DAEMON +@@ -513,6 +514,7 @@ static void error_exit( /* RETURN: nothing */ + } + } + havege_destroy(handle); ++ handle = NULL; + exit(params->exit_code); + } + /** +-- +1.8.3.1 diff --git a/haveged-1.9.1.tar.gz b/haveged-1.9.1.tar.gz new file mode 100644 index 0000000..336a2b0 Binary files /dev/null and b/haveged-1.9.1.tar.gz differ diff --git a/haveged.service b/haveged.service new file mode 100644 index 0000000..f746084 --- /dev/null +++ b/haveged.service @@ -0,0 +1,13 @@ +[Unit] +Description=Entropy Daemon based on the HAVEGE algorithm +Documentation=man:haveged(8) http://www.issihosts.com/haveged/ + +[Service] +Type=simple +ExecStart=/usr/sbin/haveged -w 1024 -v 1 --Foreground +SuccessExitStatus=143 +Restart=always + +[Install] +WantedBy=multi-user.target + diff --git a/haveged.spec b/haveged.spec new file mode 100644 index 0000000..26dde8f --- /dev/null +++ b/haveged.spec @@ -0,0 +1,117 @@ +# NOTICE: this spec file is reriverd from the HAVEGED project(see Source0 as below)attachment +# and made some modifications. The exactly file path is ./contrib/build/fedora.spec. +Summary: A Linux entropy source using the HAVEGE algorithm +Name: haveged +Version: 1.9.1 +Release: 3 +License: GPLv3+ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +URL: http://www.irisa.fr/caps/projects/hipsor/ +Source0: http://www.issihosts.com/haveged/%{name}-%{version}.tar.gz +Source1: haveged.service + +Patch6000: bugfix-cpu-cache-size-detection.patch +Patch9000: fix-the-core-file-problem.patch + +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +BuildRequires: automake gdb coreutils glibc-common systemd + +%description +A Linux entropy source using the HAVEGE algorithm + +Haveged is a user space entropy daemon which is not dependent upon the +standard mechanisms for harvesting randomness for the system entropy +pool. This is important in systems with high entropy needs or limited +user interaction (e.g. headless servers). + +Haveged uses HAVEGE (HArdware Volatile Entropy Gathering and Expansion) +to maintain a 1M pool of random bytes used to fill /dev/random +whenever the supply of random bits in /dev/random falls below the low +water mark of the device. The principle inputs to haveged are the +sizes of the processor instruction and data caches used to setup the +HAVEGE collector. The haveged default is a 4kb data cache and a 16kb +instruction cache. On machines with a cpuid instruction, haveged will +attempt to select appropriate values from internal tables. + +%package devel +Summary: Headers and shared development libraries for HAVEGE algorithm +Requires: %{name} = %{version}-%{release} + +%description devel +Headers and shared object symbolic links for the HAVEGE algorithm + +%package help +Summary: Help information for user. + +%description help +Help information for user. + +%prep +%setup -q + +%build +%configure --enable-olt=no +make + +%check +make check + + +%install +rm -rf %{buildroot} +make install DESTDIR=%{buildroot} INSTALL="install -p" + +chmod 0644 COPYING README ChangeLog AUTHORS + +rm -rf %{buildroot}/etc/init.d +pushd $RPM_BUILD_ROOT +mkdir -p .%{_unitdir} +install -p -m644 %{SOURCE1} .%{_unitdir}/haveged.service +popd + +rm -rf %{buildroot}%{_libdir}/libhavege.*a + +%clean +rm -rf %{buildroot} + +%post +/sbin/ldconfig +%systemd_post haveged.service + +%preun +%systemd_preun haveged.service + +%postun +/sbin/ldconfig +%systemd_postun_with_restart haveged.service + +%files +%defattr(-, root, root, -) +%{_sbindir}/haveged +%{_unitdir}/haveged.service +%{_libdir}/*so.* +%doc COPYING README ChangeLog AUTHORS + +%files devel +%defattr(-, root, root, -) +%dir %{_includedir}/%{name} +%{_includedir}/%{name}/havege.h +%doc contrib/build/havege_sample.c +%{_libdir}/*.so + +%files help +%defattr(-, root, root, -) +%{_mandir}/man8/haveged.8* +%{_mandir}/man3/libhavege.3* + +%changelog +* Fri Sep 27 2019 openEuler Buildteam - 1.9.1-3 +- fix the core file problem + +* Fri Sep 27 2019 openEuler Buildteam - 1.9.1-2 +- adjust requires + +* Wed Sep 4 2019 openEuler Buildteam - 1.9.1-1 +- rewrite spec file based upstream spec