rng-tools: add patch from upstream to fix rngd (#3442)
"rngd" currently crashes (smashed stack) on 64-bit machines that support the RDRAND instruction, unless you expicitly disable its use. This fixes the problem.
This commit is contained in:
parent
3eb4381e92
commit
193e014141
2 changed files with 25 additions and 1 deletions
24
srcpkgs/rng-tools/patches/rdrand.patch
Normal file
24
srcpkgs/rng-tools/patches/rdrand.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
This patch from upstream (https://github.com/nhorman/rng-tools/commit/f12a80185a4bbf65fbc860f2d2e25af67c70ad6b)
|
||||||
|
will allow rngd to run. It can safely be deleted as soon as there is another upstream release.
|
||||||
|
|
||||||
|
Without this patch, rngd will die with a "smashed stack" on 64-bit machines that support the RDRAND instruction.
|
||||||
|
|
||||||
|
|
||||||
|
--- rngd_rdrand.c.orig 2018-09-25 19:54:05.000000000 +0200
|
||||||
|
+++ rngd_rdrand.c 2018-10-01 05:42:38.655982555 +0200
|
||||||
|
@@ -246,7 +246,14 @@
|
||||||
|
if (ent_src->rng_options[DRNG_OPT_AES].int_val)
|
||||||
|
return xread_drng_with_aes(buf, size, ent_src);
|
||||||
|
|
||||||
|
- x86_rdrand_bytes(buf, size);
|
||||||
|
+ /* NB: x86_rdrand_bytes might overrun end of buffer, if not a multiple of 8 */
|
||||||
|
+ if (size > 7)
|
||||||
|
+ x86_rdrand_bytes(buf, (size&~7));
|
||||||
|
+ if ((size&7) != 0) {
|
||||||
|
+ unsigned char tempbuf[8];
|
||||||
|
+ x86_rdrand_bytes(tempbuf, (size&7));
|
||||||
|
+ memcpy((unsigned char *)buf+(size&~7), tempbuf, (size&7));
|
||||||
|
+ }
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'rng-tools'
|
# Template file for 'rng-tools'
|
||||||
pkgname=rng-tools
|
pkgname=rng-tools
|
||||||
version=6.5
|
version=6.5
|
||||||
revision=1
|
revision=2
|
||||||
wrksrc=${pkgname}-${version}
|
wrksrc=${pkgname}-${version}
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
makedepends="libgcrypt-devel libsysfs-devel libcurl-devel libxml2-devel"
|
makedepends="libgcrypt-devel libsysfs-devel libcurl-devel libxml2-devel"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue