CONFIG_PAX_NOELFRELOCS, DRI, etc.

Declan Moriarty junk_mail at iol.ie
Tue Jan 24 13:56:59 PST 2006


Recently, Somebody Somewhere wrote these words
> 
> 
> Can someone translate this errorspeak?
> 
> Error while loading shared library /usr/X11R6/lib/libGL.so.1
> cannot make segment writable for relocation. Permission denied.
> 
> I also get an error from the module on the symbol drm_cleanup_pci,
> which is apparently exported in some .c file in the source,
> although I have yet to find what that is when compiled.

Gentoo and google finally obliged on my request above.

It seems there are text relocations in the DRI stuff,
CONFIG_PAX_NOELFRELOCS is just for that purpose. After reading the
kernel help, I decided CONFIG_PAX_NOELFRELOCS has to stay. I never
quite got this little bit:

NOTE: if you are using dynamic ELF executables (as suggested
when using ASLR) then you must have made sure that you linked
your files using the PIC version of crt1 (the et_dyn.tar.gz
package
referenced there has already been updated to support this).

ASLR? Can someone elucidate or dumb it down please?

These files in the dri have relocations
TEXTREL in exe /usr/X11R6/lib/dri-old.libGL.so.1.2 (AFAIK, that is
the file from the common DRM tarball renamed by an install)
TEXTREL in exe /usr/X11R6/lib/libGL.so.1.2 (Made by X-6.9.0 with
#define BuildXF86DRI  YES  added to host.def)
TEXTREL library /usr/local/lib/libGL.so.1 exec /usr/X11R6/lib/libGLU.so.1.3
TEXTREL in exe /usr/X11R6/lib/libOSMesa.so.4.0
TEXTREL library /usr/local/lib/libGL.so.1 exec
/usr/X11R6/lib/libOSMesa.so.4.0

So I'll have to file another bug. Everyone can get patching or at
least stop wasting time on this.

Attached is a small gentoo script for checking for relocations. One 
of the readelf commands produces the output "Nothing to do!"
Usage is script file(s) and it works with wildcards. I had to add
the interpeter line, so I gather it's an idea more than a tool.



--

	With best Regards,


	Declan Moriarty.
	 
-------------- next part --------------
#!/bin/sh
get_textrel() {
	exe=$1
	echo -- $exe --
	if file $exe | grep "ELF " >/dev/null  ; then
		readelf -d $exe 2>/dev/null | grep TEXTREL  2>&1>/dev/null && echo TEXTREL in exe $exe
		ldd $exe | awk '{print $3}' | while read lib; do
			readelf -d $lib | grep TEXTREL 2>&1>/dev/null && echo TEXTREL library $lib exec $exe
		done
	fi
}

if [ "$1" = "" ]; then
	echo Usage: $0 "<path/filename>"
	#exit 1
	#paths=`echo ${PATH} | tr ':' '\n'`
fi

for exe in "$@" $paths ; do
	[ -f $exe ] && get_textrel $exe
	[ -d $exe ] && (
		for e in $exe/* ; do
		get_textrel $e
		done
	)
done



More information about the hlfs-dev mailing list