[Rpm-maint] [PATCH] Split the processing programs and libraries
Panu Matilainen
pmatilai at laiskiainen.org
Fri Nov 12 07:04:49 UTC 2010
On Thu, 11 Nov 2010, Kirill A. Shutemov wrote:
> On Thu, Nov 11, 2010 at 03:05:27PM +0200, Panu Matilainen wrote:
>> On Sat, 30 Oct 2010, Alexey Gladkov wrote:
>>
>>> The elfdeps runs only for executable files, but some
>>> Linux distributions, remove the executable bit from shared libraries.
>>>
>> [...]
>>> diff --git a/fileattrs/elf.attr b/fileattrs/elf.attr
>>> index fba180b..7355b8f 100644
>>> --- a/fileattrs/elf.attr
>>> +++ b/fileattrs/elf.attr
>>> @@ -1,4 +1,4 @@
>>> %__elf_provides %{_rpmconfigdir}/elfdeps --provides %{?__filter_GLIBC_PRIVATE:--filter-private}
>>> %__elf_requires %{_rpmconfigdir}/elfdeps --requires %{?__filter_GLIBC_PRIVATE:--filter-private}
>>> -%__elf_magic ^ELF (32|64)-bit.*$
>>> +%__elf_magic ^ELF (32|64)-bit.* executable, .*$
>> ^^^^^^^^^^^^
>> BTW just noticed something strange here... Looking around /bin/ and
>> friends on Fedora 13/14, not all executables are identified as such. For
>> example:
>>
>> [pmatilai at dhcp102 ~]$ file /bin/*|grep ELF|grep -v executable
>> /bin/dbus-daemon: ELF 64-bit LSB shared object, x86-64,
>> version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
>> 2.6.32, stripped
>> /bin/mount: setuid ELF 64-bit LSB shared object,
>> x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for
>> GNU/Linux 2.6.32, stripped
>> /bin/su: setuid ELF 64-bit LSB shared object,
>> x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for
>> GNU/Linux 2.6.32, stripped
>> /bin/tracepath: ELF 64-bit LSB shared object, x86-64,
>> version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
>> 2.6.18, stripped
>> /bin/tracepath6: ELF 64-bit LSB shared object, x86-64,
>> version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux
>> 2.6.18, stripped
>> /bin/umount: setuid ELF 64-bit LSB shared object,
>> x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for
>> GNU/Linux 2.6.32, stripped
>>
>> All these are rather obviously executable, so the question is why doesn't
>> file see them as such?
>
> All PIE binaries are ELF shared object, not ELF executable.
Ahhah. I suspected it'd be something like that, thanks for saving me the
trouble of figuring it out from build logs and the like.
>
> In ALT Linux RPM we have some heuristic to check whether a shared object
> is executable:
>
> http://git.altlinux.org/people/ldv/packages/rpm.git?p=rpm.git;a=blob;f=scripts/fixup-libraries
>
> It's rather robust.
Any volunteers to patch libmagic to perform similar heuristics? :) Of
course if shared libraries weren't installed and packaged with executable
bits set, the whole thing would become rather moot: if a file doesn't have
executable bit set, it can't be executed so it can't be an executable...
- Panu -
More information about the Rpm-maint
mailing list