Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 115566 - TEXTREL in media-video/transcode-1.0.2 when building as PIE
Summary: TEXTREL in media-video/transcode-1.0.2 when building as PIE
Status: RESOLVED LATER
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Hardened (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
: 265869 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-12-14 11:06 UTC by Lares Moreau
Modified: 2009-04-12 18:11 UTC (History)
5 users (show)

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


Attachments
transcode-0.6.14-pic-fix.patch (transcode-0.6.14-pic-fix.patch,65.71 KB, patch)
2005-12-14 11:36 UTC, solar (RETIRED)
Details | Diff
transcode-1.0.2-r1 compile log (transcode_compile.log,509.80 KB, text/plain)
2006-01-13 00:42 UTC, Sascha G.
Details
requested scanelf -T output (transcode-textrels.log,5.80 KB, text/plain)
2006-01-13 01:20 UTC, Sascha G.
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lares Moreau 2005-12-14 11:06:15 UTC
After some instructions form solar:

media-video/transcode-0.6.14-r2 (/usr/lib/transcode/export_mpeg.so)
media-video/transcode-0.6.14-r2 (/usr/lib/transcode/filter_test.so)
media-video/transcode-0.6.14-r2 (/usr/lib/transcode/filter_pp.so)
Comment 1 solar (RETIRED) gentoo-dev 2005-12-14 11:36:34 UTC
Created attachment 74749 [details, diff]
transcode-0.6.14-pic-fix.patch

I think the media herd said transcode-0.6.x is being phased out. 
The attached patch from PaX Team is untested by me but should fix them.
Comment 2 SpanKY gentoo-dev 2005-12-14 12:18:45 UTC
if it's fixed in 1.x then i dont think we should bother unless 0.6.x is going
to be around for a while
Comment 3 Sascha G. 2005-12-15 19:32:12 UTC
(In reply to comment #2)

No, it is not fixed as of version 1.0.2-r1. Lots of TEXTRELs are still in there.
Comment 4 SpanKY gentoo-dev 2005-12-15 19:50:04 UTC
it's coming across clean for me on x86:

vapier ~ # emerge -pv transcode
[ebuild   R   ] media-video/transcode-1.0.2-r1  +3dnow +X +a52 (-altivec) +dv
+dvdread +fame +ffmpeg +gtk +imagemagick +jpeg +lzo +mjpeg +mmx +mp3 +mpeg
-network +ogg -pvm +quicktime +sdl +sse +sse2 +theora +truetype -v4l +vorbis
+xml2 +xvid

vapier ~ # scanelf -qet `qlist transcode`
vapier ~ # 
Comment 5 PaX Team 2005-12-17 17:46:22 UTC
(In reply to comment #3)
> (In reply to comment #2)
> 
> No, it is not fixed as of version 1.0.2-r1. Lots of TEXTRELs are still in there.
> 

can you put your compile log online somewhere? i verified this ebuild version as well and got no textrels, so something must be peculiar in your environment.
Comment 6 Sascha G. 2006-01-13 00:39:20 UTC
(In reply to comment #5)

> can you put your compile log online somewhere? i verified this ebuild version
> as well and got no textrels, so something must be peculiar in your environment.

I'm sorry for the late answer - I simply forgot to add myself to the CC list.
I'll attach the log.

Some further information:

[ebuild   R   ] media-video/transcode-1.0.2-r1  -3dnow +X +a52 (-altivec) +dv +dvdread +fame +ffmpeg -gtk -imagemagick +jpeg -lzo -mjpeg +mmx +mp3 -mpeg +network +ogg -quicktime +sdl +sse +sse2 +theora +truetype -v4l2 +vorbis +xml2 +xvid 0 kB 

sam@zeus ~ $ scanelf -qet `qlist transcode`
TEXTREL  /usr/bin/avifix
TEXTREL  /usr/bin/aviindex
TEXTREL  /usr/bin/avimerge
TEXTREL  /usr/bin/avisplit
TEXTREL  /usr/bin/avisync
TEXTREL  /usr/bin/tccat
TEXTREL  /usr/bin/tcdecode
TEXTREL  /usr/bin/tcdemux
TEXTREL  /usr/bin/tcextract
TEXTREL  /usr/bin/tcmodinfo
TEXTREL  /usr/bin/tcprobe
TEXTREL  /usr/bin/tcrequant
TEXTREL  /usr/bin/tcscan
TEXTREL  /usr/bin/tcxmlcheck
TEXTREL  /usr/bin/transcode

Built with nasm-0.98.39-r3, it's the same with previous nasm versions.

Gentoo Base System version 1.6.13
Portage 2.0.53 (selinux/2005.1/x86/hardened, gcc-3.4.4, glibc-2.3.5-r2, 2.6.14-hardened-r3 i686)
=================================================================
System uname: 2.6.14-hardened-r3 i686 Intel(R) Pentium(R) 4 CPU 1.60GHz
dev-lang/python:     2.4.2
sys-apps/sandbox:    1.2.12
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1
sys-devel/libtool:   1.5.20
virtual/os-headers:  2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=pentium4 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.4/env /usr/kde/3.4/share/config /usr/kde/3.4/s
hutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -pipe -march=pentium4 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks loadpolicy sandbox selinux sfperms strict userpriv usersandbox"
GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/ ftp://ftp.wh2.tu-dresden.de/pub/mi
rrors/gentoo ftp://mirrors.sec.informatik.tu-darmstadt.de/gentoo/"
LANG="en_US.UTF-8"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 X a52 aac alsa avi bzip2 caps cdparanoia cjk crypt cups curl dts dv dvd dvdr dvdread encode ffmpeg flac fortran gif glut gnutls gtk hardened idn ipv6 joystick jpeg jpeg2k kdeenablefinal lcms lirc
 mad matroska mikmod mmap mmx mp3 ncurses nls nptl offensive ogg opengl pam pdflib pic png readline sdl selinux sndfile sse ssl theora threads tiff truetype unicode usb vcd vorbis win32codecs xine xml2 xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LC_ALL, LDFLAGS, LINGUAS, PORTDIR_OVERLAY
Comment 7 Sascha G. 2006-01-13 00:42:26 UTC
Created attachment 76970 [details]
transcode-1.0.2-r1 compile log
Comment 8 SpanKY gentoo-dev 2006-01-13 00:48:33 UTC
run this:
$ scanelf -qT `qlist transcode` >& transcode-textrels.log

and post the transcode-textrels.log as an attachment
Comment 9 Sascha G. 2006-01-13 01:20:01 UTC
Created attachment 76973 [details]
requested scanelf -T output
Comment 10 PaX Team 2006-01-13 03:00:37 UTC
(In reply to comment #6)
> sam@zeus ~ $ scanelf -qet `qlist transcode`
> TEXTREL  /usr/bin/avifix
> TEXTREL  /usr/bin/aviindex
> TEXTREL  /usr/bin/avimerge
> TEXTREL  /usr/bin/avisplit
> TEXTREL  /usr/bin/avisync
> TEXTREL  /usr/bin/tccat
> TEXTREL  /usr/bin/tcdecode
> TEXTREL  /usr/bin/tcdemux
> TEXTREL  /usr/bin/tcextract
> TEXTREL  /usr/bin/tcmodinfo
> TEXTREL  /usr/bin/tcprobe
> TEXTREL  /usr/bin/tcrequant
> TEXTREL  /usr/bin/tcscan
> TEXTREL  /usr/bin/tcxmlcheck
> TEXTREL  /usr/bin/transcode
> 
> Built with nasm-0.98.39-r3, it's the same with previous nasm versions.
> 
> Gentoo Base System version 1.6.13
> Portage 2.0.53 (selinux/2005.1/x86/hardened, gcc-3.4.4, glibc-2.3.5-r2,
> 2.6.14-hardened-r3 i686)

'hardened' is your problem, and in particular the fact that you're building PIEs by default (note how all the textrels occur in executables, not libraries, that's why we didn't see them). looking at aclib/tcmemcpy.c i can see why they occur (non-PIC calculation of addresses like "lea 0f, %%edx") and it's not hard to fix but it raises a more generic question: do we want to bother with PIE textrels at this time (i'm surprised we're not getting a bunch more reports due to broken builds or non-PIC asm)?
Comment 11 SpanKY gentoo-dev 2006-01-13 03:10:18 UTC
ah so this is just a PIE issue

without actually testing this, i think it's related to the internal labels used by the ac_memcpy_mmx() and ac_memcpy_sse() functions:

void *ac_memcpy_mmx(void *dest, const void *src, size_t bytes)
{
    asm("\
...
    jb mmx.memcpy_last  # Just use movs if <64 bytes        \n\
...
mmx.memcpy_last:                            \n\
...
   ");
}

i wonder if we add a ".hidden mmx.memcpy_last" right above the label, it'll fix this ...
Comment 12 SpanKY gentoo-dev 2006-01-13 03:12:49 UTC
actually, you're prob right, it's prob the "lea" rather than the local labels ... especially since the local labels are called twice while the "lea" are used three times (and the scanelf output reports 3 TEXTRELs per func)

i say we treat TEXTRELs in PIEs as "someday we may fix it" and mark all such bugs as LATER ...
Comment 13 SpanKY gentoo-dev 2006-02-08 21:26:06 UTC
lets do so now ...
Comment 14 Peter Alfredsen (RETIRED) gentoo-dev 2009-04-12 18:11:18 UTC
*** Bug 265869 has been marked as a duplicate of this bug. ***