Shared library permissions in Debian-land and Red Hat-land
John Reiser
jreiser at bitwagon.com
Mon Mar 28 20:35:02 UTC 2011
>> Files which aren't executable aren't even considered as candidates for being
>> ELF files to extract debuginfo from.
>>
>> Without execute permission, you'd have to check EVERY SINGLE installed FILE
>> for being ELF, that might be a significant performance hit. It'd have to be
>> tried at least.
The heuristic 0==memcmp(ELFMAG, &file[0..3], SELFMAG) is 99.99% effective,
and never gives a false negative. The cost is {open+read} for checking ELFMAG,
vs {stat} for checking __S_IEXEC. Most of the cost of open() and stat()
is the same: looking up the filename. The cost of a 4-byte read() is small.
Therefore using ELFMAG costs about the same as using __S_IEXEC, as long as
the total number of execve() is nearly the same.
Implement as a filter: read file names from stdin, write the names of
the ELF files onto stdout:
find . -type f | ELF_filter | xargs extract_debuginfo
replacing
find . -type f -a -perm /u+x | xargs extract_debuginfo
--
More information about the devel
mailing list