Identify PIE binaries (application/x-sharedlib) as executable files
ClosedPublic

Authored by fvogt on May 28 2017, 12:55 PM.

Details

Summary

x86_64 binaries compiled with PIE are just shared objects with the
executable bit set. Without this patch, kio does not know that they
can be executed as well, causing "kioclient5 exec" to ask for an
application that can handle application/x-sharedlib.

BUG: 350018

Test Plan

Can run applications fine again.

Diff Detail

Repository
R241 KIO
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
fvogt created this revision.May 28 2017, 12:55 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptMay 28 2017, 12:55 PM
dfaure accepted this revision.May 29 2017, 7:08 AM

This is a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=97226 but indeed, there seems to be no other way.

Maybe add a link to that bug report in one of the uses of x-sharedlib in your patch?

This revision is now accepted and ready to land.May 29 2017, 7:08 AM
fvogt updated this revision to Diff 14928.May 29 2017, 9:04 AM

Add a comment referencing the fdo bug report

fvogt added a comment.May 29 2017, 9:06 AM

This is a workaround for https://bugs.freedesktop.org/show_bug.cgi?id=97226 but indeed, there seems to be no other way.

Maybe add a link to that bug report in one of the uses of x-sharedlib in your patch?

Not really a workaround - it's the proper solution. There is no difference between shared libraries and PIE executables,
if a shared lib has executable permissions, you can run it, whether it makes sense or not.
As that is how the kernel behaves it's also how KIO should behave.

dfaure accepted this revision.May 29 2017, 11:34 AM
This revision was automatically updated to reflect the committed changes.

Then isExecutable() is wrong API, it misses the check for the executable bit. But that's non trivial to fix (check if callers would have the info, deprecate method and add replacement which takes more info as input...).

Then isExecutable() is wrong API, it misses the check for the executable bit. But that's non trivial to fix (check if callers would have the info, deprecate method and add replacement which takes more info as input...).

Well, for application/x-shellscript it was broken before this in the same way, I'd say: Without the executable bit it's simply data.