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

Bug 421527

Summary: sys-devel/{llvm,clang}: clang runtime executable stack (WX sections) QA Notice
Product: Gentoo Linux Reporter: Rafał Mużyło <galtgendo>
Component: [OLD] DevelopmentAssignee: Gentoo Clang Team (OBSOLETE) <clang+obsolete>
Status: RESOLVED FIXED    
Severity: minor CC: AlphatPC, atoth, isidansick, marbacz
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Proposed patch to sed the .S files to add GNU-stack stuff

Description Rafał Mużyło 2012-06-17 08:06:49 UTC
* !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:ashldi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:ashrdi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:divdi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:floatdidf.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:floatdisf.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:floatdixf.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:floatundidf.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:floatundisf.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:floatundixf.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:lshrdi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:moddi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:muldi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:udivdi3.o
 * !WX --- --- usr/lib/clang/3.1/lib/linux/libclang_rt.full-i386.a:umoddi3.o

Any reason those files can't get the standard
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
treatment ?
Not saying "I know this would work", just asking "any reason it wouldn't ?".
Comment 1 Rafał Mużyło 2014-06-27 20:00:29 UTC
So, there's bug 455262 and now bug 515542 - different only in version, so I'm not marking those as duplicates even if they effectively are.

Also, as I noted in a different bug affects both x86 and amd64, especially with abi_x86_32.
Comment 2 Bernard Cafarelli gentoo-dev 2014-09-01 08:39:54 UTC
Indeed, thanks for tracking them! Looks like 3.4.2 is "less worse" with floatundi?f.o parts, but still not there.
Comment 3 Bernard Cafarelli gentoo-dev 2014-09-01 08:41:14 UTC
*** Bug 455262 has been marked as a duplicate of this bug. ***
Comment 4 Bernard Cafarelli gentoo-dev 2014-09-01 08:41:29 UTC
*** Bug 515542 has been marked as a duplicate of this bug. ***
Comment 5 Mark Wright gentoo-dev 2015-08-30 00:13:31 UTC
Same problem with sys-devel/llvm-3.7.0_rc3

 * QA Notice: The following files contain writable and executable sections
 *  Files with such sections will not work properly (or at all!) on some
 *  architectures/operating systems.  A bug should be filed at
 *  http://bugs.gentoo.org/ to make sure the issue is fixed.
 *  For more information, see:
 * 
 *    https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
 * 
 *  Please include the following list of files in your report:
 *  Note: Bugs should be filed for the respective maintainers
 *  of the package in question and not hardened@g.o.
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-x86_64.a:floatundidf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-x86_64.a:floatundisf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-x86_64.a:floatundixf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:ashldi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:ashrdi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:divdi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:floatdidf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:floatdisf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:floatdixf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:floatundidf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:floatundisf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:floatundixf.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:lshrdi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:moddi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:muldi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:udivdi3.S.o
 * !WX --- --- usr/lib/clang/3.7.0/lib/linux/libclang_rt.builtins-i386.a:umoddi3.S.o
Comment 6 Mark Wright gentoo-dev 2015-08-30 06:44:42 UTC
Created attachment 410586 [details, diff]
Proposed patch to sed the .S files to add GNU-stack stuff

The find command adds the GNU-stack stuff to the .S files as described here:
https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart#Patching
Comment 7 Rafał Mużyło 2015-08-30 07:28:38 UTC
(In reply to Mark Wright from comment #6)
> The find command adds the GNU-stack stuff to the .S files as described here:
> https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart#Patching

Well, all this time the real question was if the maintainer knows any reason that this could break anything in clang.
Comment 8 Attila Tóth 2015-08-30 13:17:09 UTC
(In reply to Rafał Mużyło from comment #7)
> (In reply to Mark Wright from comment #6)
> > The find command adds the GNU-stack stuff to the .S files as described here:
> > https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart#Patching
> 
> Well, all this time the real question was if the maintainer knows any reason
> that this could break anything in clang.

Introducing WX sections in an executable is simply a bad practice, regardless of any symptoms it might cause. If llvm/clang would not obey this principle, it couldn't be an alternative for those who care. I know that my opinion doesn't really matter - but I am one of those.
Comment 9 Attila Tóth 2015-08-30 15:14:56 UTC
(In reply to Mark Wright from comment #6)
> Created attachment 410586 [details, diff] [details, diff]
> Proposed patch to sed the .S files to add GNU-stack stuff
> 
> The find command adds the GNU-stack stuff to the .S files as described here:
> https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart#Patching

Works for me, thanks.
Comment 10 Bernard Cafarelli gentoo-dev 2015-09-02 09:51:31 UTC
No reason that this should break compiler-rt, and tests are still ok, so this is in 3.7.0 ebuild now, thanks gienah!