Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 411919 - app-misc/pax-utils: `scanelf -Xxz m` breaks libraries: nonzero padding in e_ident (due to legacy EI_PAX)
Summary: app-misc/pax-utils: `scanelf -Xxz m` breaks libraries: nonzero padding in e_i...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
: 413237 413671 418197 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-04-14 08:18 UTC by Arfrever Frehtes Taifersar Arahesis
Modified: 2012-07-22 19:15 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arfrever Frehtes Taifersar Arahesis 2012-04-14 08:18:34 UTC
I use app-misc/pax-utils-0.3.0 and sys-apps/paxctl-0.7-r1.

pax-mark() function from pax-utils.eclass uses scanelf if paxctl is unavailable.
'pax-mark m ${file}' would result in 'paxctl -qm ${file}' or
'scanelf -Xxz m ${file}'.

$ cd /tmp
$ touch libtest.c
$ echo "int main(){;}" > test.c
$ gcc -fPIC -shared -o libtest.so libtest.c
$ gcc -o test test.c -Wl,-rpath,. -L. -ltest
$ ./test
$ scanelf -x libtest.so
 TYPE    PAX   FILE 
ET_DYN ---xe- libtest.so
$ /sbin/paxctl -m libtest.so
$ scanelf -x libtest.so
 TYPE    PAX   FILE 
ET_DYN --mxe- libtest.so
$ ./test
$ 

# Recreate libtest.so to avoid any interference with changes made by paxctl

$ gcc -fPIC -shared -o libtest.so libtest.c
$ scanelf -Xxz m libtest.so
 TYPE    PAX   FILE 
ET_DYN --mxe- libtest.so 
$ ./test
./test: error while loading shared libraries: ./libtest.so: nonzero padding in e_ident
$
Comment 1 SpanKY gentoo-dev 2012-04-26 03:26:06 UTC
*** Bug 413237 has been marked as a duplicate of this bug. ***
Comment 2 SpanKY gentoo-dev 2012-04-28 04:34:51 UTC
*** Bug 413671 has been marked as a duplicate of this bug. ***
Comment 3 SpanKY gentoo-dev 2012-04-28 04:47:03 UTC
looking at the history, seems like this flag has always been broken.  checking out the original implementation shows the same behavior.

$ make clean && make -j4 scanelf && gcc -fPIC test.c -o libfoo.so -shared
$ ./scanelf -Xxz m libfoo.so && readelf -h libfoo.so | sed -n 2p
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 04 00
Comment 4 SpanKY gentoo-dev 2012-04-28 05:16:49 UTC
since `chpax` is unsupported, i think we should drop EI_PAX from pax-utils too.  our linker has produce PT_PAX_FLAGS for a very long time now.  that's what's causing things to break -- scanelf will update both PT_PAX_FLAGS and EI_PAX where as the paxctl tool will modify PT_PAX_FLAGS and skip EI_PAX if the PT exists.

http://sources.gentoo.org/gentoo-projects/pax-utils/scanelf.c?r1=1.241&r2=1.242
Comment 5 SpanKY gentoo-dev 2012-06-01 19:42:28 UTC
*** Bug 418197 has been marked as a duplicate of this bug. ***
Comment 6 Jacob Godserv 2012-06-13 03:51:29 UTC
The latest 20120601 armv7a stage is still affected by this bug. When is this fix going to be deployed?
Comment 7 Jacob Godserv 2012-07-22 19:15:03 UTC
...and there we are! :) Thanks guys.