Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 614998

Summary: sys-apps/portage: Makes .so linker scripts executable
Product: Portage Development Reporter: Michał Górny <mgorny>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: aballier, kuraga333, llvm
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

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.