Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 614998 - sys-apps/portage: Makes .so linker scripts executable
Summary: sys-apps/portage: Makes .so linker scripts executable
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Ebuild Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-08 10:22 UTC by Michał Górny
Modified: 2023-01-26 19:42 UTC (History)
3 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 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-04-08 10:22:03 UTC
it seems that the Portage logic for making .so files executable is too greedy.

When building sys-libs/libcxx, I get:

making executable: usr/lib/libc++.so
making executable: usr/lib64/libc++.so

However, both files are not really shared libraries but just linker scripts. Making them executable is therefore not necessary, and results in bash attempting to execute them as bash commands (not a good idea). For comparison, regular shared libraries are executed as programs which either triggers some main() function or a reliable SEGV ;-).

Furthermore, there is no need for linker scripts to be ever +x. This is only necessary for actual binary libraries; see: http://unix.stackexchange.com/a/48479/22833
Comment 1 Alexander Kurakin 2023-01-25 23:57:26 UTC
May check for .so's `interpreter`?
Comment 2 Alexander Kurakin 2023-01-26 12:43:31 UTC
And maybe it'd be good to have `QA_DONTMAKEEXECUTABLE` option.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-26 19:42:34 UTC
(In reply to Alexander Kurakin from comment #2)
> And maybe it'd be good to have `QA_DONTMAKEEXECUTABLE` option.

QA_* is purely intended for warnings.