| Summary: | -fprofile-generate leads in root-owned files | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Harald Reindl <h.reindl> |
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED INSUFFICIENT_DATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 24 | CC: | davejohansen, jakub, jwakely, law, mpolacek |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-10-12 13:33:47 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
GCC has not way to become root, so this must be an issue with rpmbuild or your environment. i thought so too
in fact it does and that sounds like something is running with suid in case of profile guided optimization because when %pgo_build is 0 all is fine
# build php with 'profile-guided-optimization' when enabled
%if %pgo_build
echo "PROFILE-GUIDED-OPTIMIZATION: Stage 1"
make %{?_smp_mflags} prof-gen
/rpmbuild/PHP-PGO/profile.sh $PWD
make clean
echo "PROFILE-GUIDED-OPTIMIZATION: Stage 2"
make %{?_smp_mflags} prof-use
%else
make %{?_smp_mflags}
%endif
The *.gcda files aren't written by gcc, but by the application you're testing (when compiled/linked with -fprofile-generate). It uses whatever uid the process has. Perhaps you are dlopening your -fprofile-generate built library into some suid app or something similar? In any case, there is nothing that can be done about it on the gcc side. while i have no idea why this is currently not reproduceable and all seems to working fine without any changes in the php.spec or involved scripts there where *in fact* also non-gcda files like .o owned by root and the whole process is started in a ssh session with a restricted user very strange and that it stopped with this behavior without knowing why don't make me terrible happy - the "don't know why" part especially |
i am trying to use profile-guided-optimization for a PHP build "rpmbuild -bb php.spec" is called as restricted user make %{?_smp_mflags} prof-gen /rpmbuild/PHP-PGO/profile.sh $PWD make clean make %{?_smp_mflags} prof-use op-vectorize -ftree-slp-vectorize -ftree-vectorize -funroll-loops -funswitch-loops -minline-all-stringops -Wno-pointer-sign -Wno-stack-protector -fPIC -Wa,--noexecstack -fvisibility=hidden -fprofile-generate -c /home/builduser/rpmbuild/BUILD/php-7.0.11/ext/date/lib/unixtime2tm.c -o ext/date/lib/unixtime2tm.lo Assembler messages: Fatal error: can't create ext/date/.libs/php_date.o: Permission denied Assembler messages: Fatal error: can't create ext/date/lib/.libs/timelib.o: Permission denied Assembler messages: Fatal error: can't create ext/date/lib/.libs/dow.o: Permission denied how is it possible /rpmbuild/BUILD/php-7.0.11/ext/standard/.libs: insgesamt 572K drwxr-xr-x 2 root root 4,0K 2016-09-19 11:40 . drwxr-xr-x 4 builduser builduser 4,0K 2016-09-19 11:40 .. -rw-r--r-- 1 root root 35K 2016-09-19 11:45 array.gcda -rw-r--r-- 1 root root 5,5K 2016-09-19 11:45 assert.gcda -rw-r--r-- 1 root root 2,5K 2016-09-19 11:45 base64.gcda -rw-r--r-- 1 root root 22K 2016-09-19 11:45 basic_functions.gcda -rw-r--r-- 1 root root 5,4K 2016-09-19 11:45 browscap.gcda -rw-r--r-- 1 root root 1,6K 2016-09-19 11:45 crc32.gcda -rw-r--r-- 1 root root 2,7K 2016-09-19 11:45 credits.gcda -rw-r--r-- 1 root root 2,4K 2016-09-19 11:45 crypt_blowfish.gcda