summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2017-08-14 14:07:03 +0200
committerLars Wendler <polynomial-c@gentoo.org>2017-08-14 15:35:42 +0200
commitc6a8fda5117616d36874aff862fc8093953e5e44 (patch)
tree8dfee98fda1b47a3bbaa06c6be0adf355408e82f
parentnet-libs/ntirpc: Bump to version 1.5.2 (diff)
downloadgentoo-c6a8fda5117616d36874aff862fc8093953e5e44.tar.gz
gentoo-c6a8fda5117616d36874aff862fc8093953e5e44.tar.bz2
gentoo-c6a8fda5117616d36874aff862fc8093953e5e44.zip
sys-apps/rng-tools: Bump to version 6
Package-Manager: Portage-2.3.7, Repoman-2.3.3
-rw-r--r--sys-apps/rng-tools/Manifest1
-rw-r--r--sys-apps/rng-tools/files/rng-tools-5-fix-noctty.patch4
-rw-r--r--sys-apps/rng-tools/files/rng-tools-5-man-fill-watermark.patch4
-rw-r--r--sys-apps/rng-tools/files/rng-tools-5-man-rng-device.patch4
-rw-r--r--sys-apps/rng-tools/files/rng-tools-6-fix-noctty.patch45
-rw-r--r--sys-apps/rng-tools/files/test-for-argp.patch4
-rw-r--r--sys-apps/rng-tools/rng-tools-6.ebuild46
7 files changed, 100 insertions, 8 deletions
diff --git a/sys-apps/rng-tools/Manifest b/sys-apps/rng-tools/Manifest
index e8ef399c125d..108daf63caa7 100644
--- a/sys-apps/rng-tools/Manifest
+++ b/sys-apps/rng-tools/Manifest
@@ -1,2 +1,3 @@
DIST rng-tools-4.tar.gz 110943 SHA256 b71bdfd4222c05e8316001556be90e1606f2a1bac3efde60153bd84e873cc195 SHA512 328627a9ede924026c7a7c391b04be05f098d713d35f7f38d939d52b794853b4f6db3ae125568710ab5a59640236b343f3e9fc0f735806b020cc675c02f80b08 WHIRLPOOL da58bc7d3b7d9cdf6d83d258717f22ba3552482a690311fa2c820e4ce125a5e6c6e498e0b63461ed6c9dc16dff77b2cb47377933845fb9397efa205183346e5b
DIST rng-tools-5.tar.gz 122182 SHA256 60a102b6603bbcce2da341470cad42eeaa9564a16b4490e7867026ca11a3078e SHA512 58047c37cad4f5f1210b696e4dba122878f78e57d05d9cb822f79234240ecce31efd2d39061fea1eb5b2e81d48d8c3bf6b92d06451f1ce5d5db7117704e89c50 WHIRLPOOL 073dbeb9d27189db44658a9f25657b93a320b125fbfc8230f7ce7849b8e7c1f7802b4c3a53de3417525b02739194fab8a6e5eb03d5db317a23deb275d72fbb21
+DIST rng-tools-6.tar.gz 26024 SHA256 6d9c3f72824d1ea15dd2a80bfcf71f6a73c8843c6344f7f774a97a4ca7641b4c SHA512 2aea947c4dba5e8c4df33396957f7224b62200be0e3d10aac08c84155fa473a67df5f49e07a07b2cbea4dfd772d90c1b194e8fce3d8eea762463a7f4a16d6ce4 WHIRLPOOL 4e53c626288219a7cb9c94cf29d22878df5ad3298ca5ebedea46978e519d9b5b0ad94f765e217563105258f4b02b72b0033e551a7d37939ced9ca5d92f0a1048
diff --git a/sys-apps/rng-tools/files/rng-tools-5-fix-noctty.patch b/sys-apps/rng-tools/files/rng-tools-5-fix-noctty.patch
index a48b235ac17c..568ebe04589d 100644
--- a/sys-apps/rng-tools/files/rng-tools-5-fix-noctty.patch
+++ b/sys-apps/rng-tools/files/rng-tools-5-fix-noctty.patch
@@ -32,8 +32,8 @@ pinpointing the issue as well as confirming the fix.
Gentoo-Bug-URL: https://bugs.gentoo.org/556456
Reported-By: John Bowler <jbowler@acm.org>
---- rngd_entsource.c
-+++ rngd_entsource.c
+--- a/rngd_entsource.c
++++ b/rngd_entsource.c
@@ -175,7 +175,7 @@
*/
int init_entropy_source(struct rng *ent_src)
diff --git a/sys-apps/rng-tools/files/rng-tools-5-man-fill-watermark.patch b/sys-apps/rng-tools/files/rng-tools-5-man-fill-watermark.patch
index 4cedf8fc97d3..ea249a5ebdfb 100644
--- a/sys-apps/rng-tools/files/rng-tools-5-man-fill-watermark.patch
+++ b/sys-apps/rng-tools/files/rng-tools-5-man-fill-watermark.patch
@@ -2,8 +2,8 @@ https://bugs.gentoo.org/555094
patch by Gokturk Yuksek <gokturk@binghamton.edu>
---- rngd.8.in
-+++ rngd.8.in
+--- a/rngd.8.in
++++ b/rngd.8.in
@@ -66,7 +66,9 @@
.TP
\fB\-W\fI n\fR, \fB\-\-fill\-watermark=\fInnn\fR
diff --git a/sys-apps/rng-tools/files/rng-tools-5-man-rng-device.patch b/sys-apps/rng-tools/files/rng-tools-5-man-rng-device.patch
index fd6b97eff326..82a0cf295765 100644
--- a/sys-apps/rng-tools/files/rng-tools-5-man-rng-device.patch
+++ b/sys-apps/rng-tools/files/rng-tools-5-man-rng-device.patch
@@ -2,8 +2,8 @@ https://bugs.gentoo.org/555106
patch by Gokturk Yuksek <gokturk@binghamton.edu>
---- rngd.8.in
-+++ rngd.8.in
+--- a/rngd.8.in
++++ b/rngd.8.in
@@ -59,7 +59,7 @@
.TP
\fB\-r\fI file\fR, \fB\-\-rng-device=\fIfile\fR
diff --git a/sys-apps/rng-tools/files/rng-tools-6-fix-noctty.patch b/sys-apps/rng-tools/files/rng-tools-6-fix-noctty.patch
new file mode 100644
index 000000000000..e915150adb58
--- /dev/null
+++ b/sys-apps/rng-tools/files/rng-tools-6-fix-noctty.patch
@@ -0,0 +1,45 @@
+From: Gokturk Yuksek <gokturk@binghamton.edu>
+Subject: [PATCH] Fix rngd to open the entropy source with 'O_NOCTTY' flag
+
+When start-stop-daemon starts a rngd instance configured to use a tty
+device as its entropy source, the application crashes due to not being
+able to read from the entropy device. This is caused by
+start-stop-daemon calling setsid() before executing rngd, which
+disassociates the controlling terminal. When rngd attempts to open a
+hardware entropy source that's a tty device, per POSIX rules, the
+device becomes the controlling terminal for the process. Then rngd
+calls daemon(), which internally calls setsid(), and consequently
+disassociates the controlling terminal for the child. Meanwhile the
+parent rngd process exits. This results in tty device hanging up. By
+looking at the strace logs attached to the bug, it can be observed
+that although the parent rngd process is able to read() from the
+entropy source successfully, further attempts to read() by the child
+rngd process return 0. This complies with the POSIX, which states that
+read() calls on a hung up terminal shall return 0.
+
+Note that when rngd is started without start-stop-daemon, this problem
+does not happen because at the time of opening the entropy source rngd
+already has a controlling terminal.
+
+Prevent the entropy source from becoming the controlling terminal by
+passing 'O_NOCTTY' flag to open() when opening an entropy source. This
+flag prevents a tty device from becoming the controlling terminal for
+a process without a controlling terminal at the time of open().
+
+Thanks to John Bowler <jbowler@acm.org> for debugging the problem and
+pinpointing the issue as well as confirming the fix.
+
+Gentoo-Bug-URL: https://bugs.gentoo.org/556456
+Reported-By: John Bowler <jbowler@acm.org>
+
+--- rng-tools-rng-tools-6/rngd_entsource.c
++++ rng-tools-rng-tools-6/rngd_entsource.c
+@@ -162,7 +162,7 @@
+ struct sysfs_attribute *rngavail;
+ char buf[16];
+
+- ent_src->rng_fd = open(ent_src->rng_fname, O_RDONLY);
++ ent_src->rng_fd = open(ent_src->rng_fname, O_RDONLY | O_NOCTTY);
+ if (ent_src->rng_fd == -1) {
+ message(LOG_DAEMON|LOG_DEBUG, "Unable to open file: %s", ent_src->rng_fname);
+ return 1;
diff --git a/sys-apps/rng-tools/files/test-for-argp.patch b/sys-apps/rng-tools/files/test-for-argp.patch
index 129a522e5686..4ed2aa40b6df 100644
--- a/sys-apps/rng-tools/files/test-for-argp.patch
+++ b/sys-apps/rng-tools/files/test-for-argp.patch
@@ -10,8 +10,8 @@ Reported-by: Ed Wildgoose <gentoo@wildgooses.com>
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
---- configure.ac.orig 2012-05-26 22:45:42.753478198 +0000
-+++ configure.ac 2012-05-27 00:36:23.175844081 +0000
+--- a/configure.ac
++++ b/configure.ac
@@ -47,6 +47,28 @@
dnl Checks for optional library functions
dnl -------------------------------------
diff --git a/sys-apps/rng-tools/rng-tools-6.ebuild b/sys-apps/rng-tools/rng-tools-6.ebuild
new file mode 100644
index 000000000000..3a559236e0c7
--- /dev/null
+++ b/sys-apps/rng-tools/rng-tools-6.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils autotools systemd toolchain-funcs
+
+DESCRIPTION="Daemon to use hardware random number generators"
+HOMEPAGE="https://github.com/nhorman/rng-tools"
+SRC_URI="https://github.com/nhorman/${PN}/archive/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~ppc ~x86"
+IUSE="selinux"
+
+DEPEND="dev-libs/libgcrypt:0
+ dev-libs/libgpg-error"
+RDEPEND="${DEPEND}
+ sys-fs/sysfsutils
+ selinux? ( sec-policy/selinux-rngd )"
+
+S="${WORKDIR}/${PN}-${P}"
+
+PATCHES=(
+ "${FILESDIR}"/test-for-argp.patch
+ "${FILESDIR}"/${PN}-5-fix-textrels-on-PIC-x86.patch #469962
+ "${FILESDIR}"/${PN}-5-man-fill-watermark.patch #555094
+ "${FILESDIR}"/${PN}-6-fix-noctty.patch #556456
+)
+
+src_prepare() {
+ echo 'bin_PROGRAMS = randstat' >> contrib/Makefile.am || die
+ default
+ eautoreconf
+
+ sed -i '/^AR /d' Makefile.in || die
+ tc-export AR
+}
+
+src_install() {
+ default
+ newinitd "${FILESDIR}"/rngd-initd-r1-4.1 rngd
+ newconfd "${FILESDIR}"/rngd-confd-4.1 rngd
+ systemd_dounit "${FILESDIR}"/rngd.service
+}