View Issue Details

IDProjectCategoryView StatusLast Update
0013358CentOS-7rng-toolspublic2018-11-10 03:19
Reporterkabe 
PrioritynormalSeveritymajorReproducibilityalways
Status assignedResolutionreopened 
Platformi686OSCentOSOS Version7
Product Version7.3.1611 
Target VersionFixed in Version 
Summary0013358: rngd dumps core on kernel-3.10.0-514.21.1.el7.centos.plus.i686 on boot
DescriptionOn boot, /sbin/rngd dumps core.

$ systemctl status -l rngd
* rngd.service - Hardware RNG Entropy Gatherer Daemon
   Loaded: loaded (/usr/lib/systemd/system/rngd.service; enabled; vendor preset: enabled)
   Active: failed (Result: core-dump) since Fri 2017-06-02 15:51:50 JST; 31min ago
  Process: 513 ExecStart=/sbin/rngd -f (code=dumped, signal=SEGV)
 Main PID: 513 (code=dumped, signal=SEGV)

Jun 02 15:51:39 TSPC330-i686 systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Jun 02 15:51:39 TSPC330-i686 systemd[1]: Starting Hardware RNG Entropy Gatherer Daemon...
Jun 02 15:51:39 TSPC330-i686 rngd[513]: read error
Jun 02 15:51:39 TSPC330-i686 rngd[513]: read error
Jun 02 15:51:50 TSPC330-i686 systemd[1]: rngd.service: main process exited, code=dumped, status=11/SEGV
Jun 02 15:51:50 TSPC330-i686 systemd[1]: Unit rngd.service entered failed state.
Jun 02 15:51:50 TSPC330-i686 systemd[1]: rngd.service failed.

Manually starting by "systemctl start rngd" works.
Steps To ReproduceUpdate to latest kernel-3.10.0-514.21.1.el7.centos.plus.i686 and reboot.
Additional InformationExamining the corpse in /var/spool/abrt/ccpp-*:
# gdb /sbin/rngd coredump
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-94.el7
...
Core was generated by `/sbin/rngd -f'.
Program terminated with signal 11, Segmentation fault.
#0 x86_rdseed_or_rdrand_bytes () at rdrand_asm.S:165
165 mov %eax, (%edx)

SIGSEGV inside a hand-assembly section.


This may be related to 32-bit specific bug mentioned in
[abrt] rng-tools: x86_rdseed_or_rdrand_bytes(): rngd killed by SIGSEGV
https://bugzilla.redhat.com/show_bug.cgi?id=1276858
I'll try rebuilding rngd with this patch.
Tagsi386
abrt_hash
URL

Activities

kabe

kabe

2017-06-02 08:03

reporter   ~0029392

The fix in https://bugzilla.redhat.com/show_bug.cgi?id=1276858 worked;
rngd doesn't coredump on boot.

This is a patch for rnd-tools rpmbuild directory:
https://bugs.centos.org/file_download.php?file_id=20495&type=bug

This is 32-bit specific, so is unlikely to be fixed in upstream RHEL rnd-tools.
This is not a kernel patch (which could be stuffed into centosplus kernel)
but for a userland package.
Was there any provisions for such patch?
JohnnyHughes

JohnnyHughes

2017-06-19 12:39

administrator   ~0029520

I can change i686 packages which need to be modified .. let me add this to the i686 mod packages and roll in this patch.
JohnnyHughes

JohnnyHughes

2017-06-19 13:02

administrator   ~0029521

That patch does not work .. what I need is your actual patch named patch-32bit-coredump.patch
JohnnyHughes

JohnnyHughes

2017-06-19 13:21

administrator  

rng-tools-32bit-rpmbuild.patch (363 bytes)
diff -uNrp rng-tools-5.orig/rdrand_asm.S rng-tools-5/rdrand_asm.S
--- rng-tools-5.orig/rdrand_asm.S	2017-06-19 13:06:18.076203634 +0000
+++ rng-tools-5/rdrand_asm.S	2017-06-19 13:11:38.541196211 +0000
@@ -165,8 +165,8 @@ ENTRY(x86_rdseed_or_rdrand_bytes)
 	mov	%eax, (%edx)
 	add	$4, %edx
 	sub	$4, %esi
-	jnz	1b
-	ja	4b
+	ja	1b
+	jmp	4b
 5:
 	dec	%ecx
 	rep;nop
JohnnyHughes

JohnnyHughes

2017-06-19 13:22

administrator   ~0029522

I attached the actual patch that I used and created a new RPM .. I'll sign and upload it shortly
JohnnyHughes

JohnnyHughes

2017-06-19 13:42

administrator   ~0029523

Before we actually push this update, please verify that these rpms work:

https://buildlogs.centos.org/c7.1611.u/rng-tools/20170619131709/5-8.el7.centos.i386/

(Those are unsigned, directly from the builder)

Please feedback if these solve the problem and are updated by yum from the original c7-i686 packages.
kabe

kabe

2017-06-20 00:43

reporter   ~0029525

The provided rng-tools-5-8.el7.centos.i686.rpm on http://buildlogs fixed the problem;
rngs does not coredump on boot.

[kabe@TSPC330-i686 ~]$ systemctl status -l rngd
* rngd.service - Hardware RNG Entropy Gatherer Daemon
   Loaded: loaded (/usr/lib/systemd/system/rngd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-06-20 09:36:58 JST; 1min 44s ago
 Main PID: 488 (rngd)
   CGroup: /system.slice/rngd.service
           `-488 /sbin/rngd -f

Jun 20 09:36:58 TSPC330-i686 systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Jun 20 09:36:58 TSPC330-i686 systemd[1]: Starting Hardware RNG Entropy Gatherer Daemon...
Jun 20 09:36:58 TSPC330-i686 rngd[488]: read error
Jun 20 09:36:58 TSPC330-i686 rngd[488]: read error


I guess initial "read error" is something not related to this bug; the rngd itself is working.
toracat

toracat

2018-10-09 22:34

manager   ~0032889

Does the current version .5-13.el7 have the fix? It does not have a .centos tag...
kabe

kabe

2018-10-10 08:57

reporter   ~0032896

I haven't checked if the vanilla rngd has the fix, but rngd fails to start for another reason;
no rng source. Isn't coredumping.
Testing on Hyper-V; the latest kernel-3.10.0-862.14.4.el7.centos.plus.i686 fails to boot into
multiuser mode in Hyper-V (another bug probably), uname is the old kernel.

[kabe@TSPC330-i686 ~]$ rpm -q rng-tools
rng-tools-5-13.el7.i686
[kabe@TSPC330-i686 ~]$ rngd -v
Failed to init entropy source 0: Hardware RNG Device

Failed to init entropy source 1: TPM RNG Device

Available entropy sources: <<<<<<<no entropy sources

[kabe@TSPC330-i686 ~]$ systemctl -l status rngd
* rngd.service - Hardware RNG Entropy Gatherer Daemon
   Loaded: loaded (/usr/lib/systemd/system/rngd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-10-10 17:53:27 JST; 1min 41s left
  Process: 538 ExecStart=/sbin/rngd -f (code=exited, status=1/FAILURE)
 Main PID: 538 (code=exited, status=1/FAILURE)

Oct 10 17:53:27 TSPC330-i686 systemd[1]: Started Hardware RNG Entropy Gatherer Daemon.
Oct 10 17:53:27 TSPC330-i686 systemd[1]: Starting Hardware RNG Entropy Gatherer Daemon...
Oct 10 17:53:27 TSPC330-i686 rngd[538]: Failed to init entropy source 0: Hardware RNG Device
Oct 10 17:53:27 TSPC330-i686 rngd[538]: Failed to init entropy source 1: TPM RNG Device
Oct 10 17:53:27 TSPC330-i686 rngd[538]: can't open any entropy source
Oct 10 17:53:27 TSPC330-i686 rngd[538]: Maybe RNG device modules are not loaded
Oct 10 17:53:27 TSPC330-i686 systemd[1]: rngd.service: main process exited, code=exited, status=1/FAILURE
Oct 10 17:53:27 TSPC330-i686 systemd[1]: Unit rngd.service entered failed state.
Oct 10 17:53:27 TSPC330-i686 systemd[1]: rngd.service failed.

[kabe@TSPC330-i686 ~]$ uname -a
Linux TSPC330-i686 3.10.0-862.3.2.el7.centos.plus.i686 #1 SMP Tue May 29 20:42:55 JST 2018 i686 i686 i386 GNU/Linux
kabe

kabe

2018-11-10 03:19

reporter   ~0033097

Regarding CentOS 7.5 rng-tools-5-13.el7:

The RHEL patch in the src.rpm to use RDRAND instruction only enables the feature on x86_64;
this patch will enable it on i686 too.
After this patch, rngd will recognize RDRAND source on i686:

$ ./rngd -l
Failed to init entropy source 0: Hardware RNG Device

Failed to init entropy source 1: TPM RNG Device

Available entropy sources:
2: Intel RDRAND Instruction RNG

The code does NOT include 32bit assembly patch of
https://bugzilla.redhat.com/show_bug.cgi?id=1276858 , but it seems to be working even after reboot.

RHEL 7.6 rng-tools-6.3.1-3.el7 already has fix to enable RDRAND on i686, so we could just wait for
CentOS 7.6 to come out.
People who needs working rngd with RDRAND could pick up the replacement from
https://buildlogs.centos.org/c7.1810.00.x86_64/rng-tools/20181030234557/6.3.1-3.el7.i386/rng-tools-6.3.1-3.el7.i686.rpm

patch-rdrand32.patch (700 bytes)
diff -up ./configure.ac.rdrand32 ./configure.ac
--- ./configure.ac.rdrand32	2018-11-10 11:16:06.317401567 +0900
+++ ./configure.ac	2018-11-10 11:27:11.071036576 +0900
@@ -43,8 +43,8 @@ AC_PROG_GCC_TRADITIONAL
 AC_CANONICAL_HOST
 
 echo $host_cpu
-AM_CONDITIONAL([RDRAND], [test $host_cpu = x86_64])
-AS_IF([test $host_cpu = x86_64], [AC_DEFINE([HAVE_RDRAND],1,[Enable RDRAND])],[])
+AM_CONDITIONAL([RDRAND], [test $host_cpu = x86_64 -o $host_cpu = i686])
+AS_IF([test $host_cpu = x86_64 -o $host_cpu = i686], [AC_DEFINE([HAVE_RDRAND],1,[Enable RDRAND])],[])
 
 AM_CONDITIONAL([DARN], [test $host_cpu = powerpc64le])
 AS_IF([test $host_cpu = powerpc64le], [AC_DEFINE([HAVE_DARN],1,[Enable DARN])],[])
patch-rdrand32.patch (700 bytes)

Issue History

Date Modified Username Field Change
2017-06-02 07:31 kabe New Issue
2017-06-02 07:31 kabe Tag Attached: i386
2017-06-02 07:57 kabe File Added: rng-tools-32bit-rpmbuild.patch
2017-06-02 08:03 kabe Note Added: 0029392
2017-06-02 10:41 toracat Status new => acknowledged
2017-06-19 12:39 JohnnyHughes Note Added: 0029520
2017-06-19 13:02 JohnnyHughes Note Added: 0029521
2017-06-19 13:18 JohnnyHughes File Deleted: rng-tools-32bit-rpmbuild.patch
2017-06-19 13:21 JohnnyHughes File Added: rng-tools-32bit-rpmbuild.patch
2017-06-19 13:22 JohnnyHughes Note Added: 0029522
2017-06-19 13:42 JohnnyHughes Status acknowledged => feedback
2017-06-19 13:42 JohnnyHughes Note Added: 0029523
2017-06-20 00:43 kabe Note Added: 0029525
2017-06-20 00:43 kabe Status feedback => assigned
2018-05-12 07:44 toracat Status assigned => resolved
2018-05-12 07:44 toracat Resolution open => fixed
2018-10-09 22:34 toracat Status resolved => feedback
2018-10-09 22:34 toracat Resolution fixed => reopened
2018-10-09 22:34 toracat Note Added: 0032889
2018-10-10 08:57 kabe Note Added: 0032896
2018-10-10 08:57 kabe Status feedback => assigned
2018-11-10 03:19 kabe File Added: patch-rdrand32.patch
2018-11-10 03:19 kabe Note Added: 0033097