Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 469962 - sys-apps/rng-tools-4-r5 - TEXTREL in usr/sbin/rngd due to rdrand_asm.S
Summary: sys-apps/rng-tools-4-r5 - TEXTREL in usr/sbin/rngd due to rdrand_asm.S
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-15 13:22 UTC by cilly
Modified: 2013-05-22 05:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emergeinfo.txt,5.86 KB, text/plain)
2013-05-15 14:41 UTC, cilly
Details
scanelf -lptg (scanelf-lptg.txt,40.77 KB, text/plain)
2013-05-15 14:47 UTC, cilly
Details
Patch adding propper PIC support to the rdrand code. (add-pic-to-rdrand.patch,1.25 KB, patch)
2013-05-15 16:58 UTC, Francisco Blas Izquierdo Riera
Details | Diff
Same patch but making vapier happy after (c|p)utting a smile on his face :P (add-pic-to-rdrand.patch,1.98 KB, patch)
2013-05-15 18:46 UTC, Francisco Blas Izquierdo Riera
Details | Diff
Small style fixes with tabulators... damned kate (add-pic-to-rdrand.patch,1.92 KB, patch)
2013-05-15 19:01 UTC, Francisco Blas Izquierdo Riera
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description cilly 2013-05-15 13:22:48 UTC
/usr/sbin/rngd has TEXTREL and does not start on hardened-gentoo.
Comment 1 Anthony Basile gentoo-dev 2013-05-15 13:43:16 UTC
cilly, we need to see emerge --info, particularly since it makes a difference if it is x86 or amd64.
Comment 2 cilly 2013-05-15 14:41:14 UTC
Created attachment 348396 [details]
emerge --info

emerge --info
Comment 3 cilly 2013-05-15 14:42:29 UTC
Log while building:


May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: setup: Package:    sys-apps/rng-tools-4-r5
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: setup: Repository: gentoo
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: setup: Maintainer: base-system@gentoo.org
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: setup: USE:        abi_x86_32 elibc_glibc kernel_linux userland_GNU x86
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: setup: FEATURES:   sandbox suidctl
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: prepare: Applying test-for-argp.patch ...
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: prepare: Running eautoreconf in '/var/tmp/portage/sys-apps/rng-tools-4-r5/work/rng-tools-4' ...
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: prepare: Running aclocal ...
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: prepare: Running autoconf ...
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: prepare: Running autoheader ...
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: prepare: Running automake --add-missing --copy ...
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other: QA Notice: The following files contain runtime text relocations
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other:  Text relocations force the dynamic linker to perform extra
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other:  work at startup, waste system resources, and may pose a security
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other:  risk.  On some architectures, the code may not even function
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other:  properly, if at all.
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other:  For more information, see http://hardened.gentoo.org/pic-fix-guide.xml
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other:  Please include the following list of files in your report:
May 15 15:02:05 pluto portage[20565]: sys-apps/rng-tools-4-r5: other: TEXTREL usr/sbin/rngd
Comment 4 cilly 2013-05-15 14:43:09 UTC
Log of grsec:

May 15 15:07:05 pluto kernel: [432922.835167] grsec: From 172.16.17.6: denied RWX mprotect of /usr/sbin/rngd by /usr/sbin/rngd[rngd:9782] uid/euid:0/0 gid/egid:0/0, parent /sbin/rc[start-stop-daem:9781] uid/euid:0/0 gid/egid:0/0
May 15 15:07:29 pluto kernel: [432946.671751] grsec: From 172.16.17.6: denied RWX mprotect of /usr/sbin/rngd by /usr/sbin/rngd[rngd:9858] uid/euid:0/0 gid/egid:0/0, parent /sbin/rc[start-stop-daem:9857] uid/euid:0/0 gid/egid:0/0
Comment 5 cilly 2013-05-15 14:47:00 UTC
Created attachment 348398 [details]
scanelf -lptg

scanelf -lptg
Comment 6 SpanKY gentoo-dev 2013-05-15 16:16:01 UTC
building executables as PIEs are generally a hardened-specific issue, and as such, we don't typically expect maintainers to "fix" their package.  it's up to the hardened team to triage/post patches/ideas, and then upstream/maintainers to investigate merging.
Comment 7 SpanKY gentoo-dev 2013-05-15 16:16:10 UTC
Comment on attachment 348398 [details]
scanelf -lptg

this log is useless/pointless
Comment 8 SpanKY gentoo-dev 2013-05-15 16:16:42 UTC
post the full build log as an attachment, not random snippts from syslog
Comment 9 Anthony Basile gentoo-dev 2013-05-15 16:18:02 UTC
(In reply to comment #8)
> post the full build log as an attachment, not random snippts from syslog

Is due to rdrand_asm.S which is not x86 pic friendly.
Comment 10 Francisco Blas Izquierdo Riera gentoo-dev 2013-05-15 16:58:24 UTC
Created attachment 348408 [details, diff]
Patch adding propper PIC support to the rdrand code.

There is a patch for the issue, if you intend to upstream it please add a small note marking me as the writer and blueness as the tester of said patch. Other than that consider it released under GPLv2 or higher as the original software.
Comment 11 SpanKY gentoo-dev 2013-05-15 17:10:43 UTC
(In reply to comment #10)

nice, code looks good to me.  feel free to commit once you add some details to the top of the file:
http://dev.gentoo.org/~vapier/clean-patches
Comment 12 Francisco Blas Izquierdo Riera gentoo-dev 2013-05-15 18:46:51 UTC
Created attachment 348418 [details, diff]
Same patch but making vapier happy after (c|p)utting a smile on his face :P
Comment 13 Francisco Blas Izquierdo Riera gentoo-dev 2013-05-15 19:01:46 UTC
Created attachment 348420 [details, diff]
Small style fixes with tabulators... damned kate
Comment 14 Francisco Blas Izquierdo Riera gentoo-dev 2013-05-15 19:10:07 UTC
In case you are interested I mailed this patch to upstream too, we'll see what they answer :)

@base-system, can we get an -r6 with the patch for now?
Comment 15 SpanKY gentoo-dev 2013-05-15 19:56:39 UTC
(In reply to comment #14)

in comment #11 i gave blessing to revbump & commit the patch if you want to do it.  otherwise someone on base-system will get around to it.
Comment 16 Francisco Blas Izquierdo Riera gentoo-dev 2013-05-15 20:47:15 UTC
(In reply to comment #15)
> (In reply to comment #14)
> 
> in comment #11 i gave blessing to revbump & commit the patch if you want to
> do it.  otherwise someone on base-system will get around to it.

No tree access for me until I do the dev quizzes, so I'll reassign it back to them :)
Comment 17 Anthony Basile gentoo-dev 2013-05-15 22:52:06 UTC
*rng-tools-4-r6 (15 May 2013)

  15 May 2013; Anthony G. Basile <blueness@gentoo.org>
  +files/fix-textrels-on-PIC-x86.patch, +rng-tools-4-r6.ebuild:
  Fix assemby textrels on rdrand_asm.S on PIC x86, bug #469962
Comment 18 cilly 2013-05-16 07:07:27 UTC
Thx!

sys-apps/rng-tools-4-r6 solves this issue, no TEXTRELs anymore. Tested on x86.
Comment 19 SpanKY gentoo-dev 2013-05-22 05:14:02 UTC
(In reply to comment #17)

for future reference, patches should follow the standard naming convention of being prefixed with ${P}