Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 590334 - media-video/mpv-0.18.1 error thrown by dev-lang/python-3.4 during configure phase
Summary: media-video/mpv-0.18.1 error thrown by dev-lang/python-3.4 during configure p...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: The Gentoo Linux Hardened Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-02 20:51 UTC by mvaenskae
Modified: 2017-05-21 17:10 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info,5.18 KB, text/plain)
2016-08-02 20:52 UTC, mvaenskae
Details
emerge --info =media-video/mpv-0.18.1 (emerge-info-mpv,5.29 KB, text/plain)
2016-08-02 20:53 UTC, mvaenskae
Details
emerge --pqv =media-video/mpv-0.18.1 (emerge-pqv-mpv,402 bytes, text/plain)
2016-08-02 20:53 UTC, mvaenskae
Details
build.log (build.log,11.67 KB, text/plain)
2016-08-02 20:53 UTC, mvaenskae
Details
environment (environment,150.84 KB, text/plain)
2016-08-02 20:54 UTC, mvaenskae
Details
emerge --info dev-lang/python:3.4 (emerge-info-python,5.92 KB, text/plain)
2016-08-03 00:59 UTC, mvaenskae
Details
config.log (build.log,11.67 KB, text/plain)
2016-08-03 20:34 UTC, mvaenskae
Details
config.log (config.log,6.91 KB, text/x-log)
2016-08-04 19:16 UTC, mvaenskae
Details
strace of python:3.4 (python34-strace.log,49.29 KB, text/x-log)
2016-08-04 19:18 UTC, mvaenskae
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mvaenskae 2016-08-02 20:51:22 UTC
Cheers,

Attached you will see 'emerge --info', 'emerge --info =media-video/mpv-0.18.1', 'emerge -pqv =media-video/mpv-0.18.1', and mpv's build.log.

The setup is a hardened Gentoo desktop.

Reproducible:
1. Get current portage tree
2. Follow update recommendation of portage and let it emerge mpv
3. Wait for python to die during the configure phase

Actual Result:
Python fails during the configure phase of the package.

Expected Result:
New mpv version installed.
Comment 1 mvaenskae 2016-08-02 20:52:20 UTC
Created attachment 442316 [details]
emerge --info
Comment 2 mvaenskae 2016-08-02 20:53:04 UTC
Created attachment 442318 [details]
emerge --info =media-video/mpv-0.18.1
Comment 3 mvaenskae 2016-08-02 20:53:34 UTC
Created attachment 442320 [details]
emerge --pqv =media-video/mpv-0.18.1
Comment 4 mvaenskae 2016-08-02 20:53:57 UTC
Created attachment 442322 [details]
build.log
Comment 5 mvaenskae 2016-08-02 20:54:11 UTC
Created attachment 442324 [details]
environment
Comment 6 Mike Gilbert gentoo-dev 2016-08-02 23:45:17 UTC
Please show emerge --info dev-lang/python:3.4.

Also, rebuilding dev-lang/python:3.4 can't hurt.
Comment 7 mvaenskae 2016-08-03 00:59:59 UTC
Created attachment 442342 [details]
emerge --info dev-lang/python:3.4

Just reemerged dev-lang/python:3.4 and tried reemerging mpv. Still fails. Here is what emerge --info dev-lang/python:3.4 reports.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-03 04:59:26 UTC
Missing PYTHON_REQ_USE?
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-03 05:09:30 UTC
(In reply to Michał Górny from comment #8)
> Missing PYTHON_REQ_USE?

Hmm, nah. Flags look fine ;-f.

Maybe it's waf using some obsolete/too new interfaces?
Comment 10 Coacher 2016-08-03 05:27:27 UTC
Not reproducible on my regular system. I am currently building hardened chroot and will try to reproduce there.
Comment 11 Coacher 2016-08-03 05:28:33 UTC
Please attach "/var/tmp/portage/media-video/mpv-0.18.1/work/mpv-0.18.1/build/config.log" as well.
Comment 12 Coacher 2016-08-03 05:33:33 UTC
(In reply to Michał Górny from comment #9)
> Maybe it's waf using some obsolete/too new interfaces?
This waf version was tested to work properly with a wide range of python versions from 2.7 to 3.5. Unless smth broke between python-3.4.3-r1 and python-3.4.5 it should be fine.
Comment 13 Coacher 2016-08-03 09:47:45 UTC
Also not reproducible on ~amd64 system with python-3.4.5.
Must be a hardened issue.
Comment 14 mvaenskae 2016-08-03 20:34:57 UTC
Created attachment 442432 [details]
config.log

Per request my config.log of mpv.

On a sidenote, I also experience build issues on www-client/chromium and trying to rebuild dev-libs/glib. I can open new bug reports for them as well. In that case and if my logs grow beyonf the 1000KB limit, may you be so kind and recommend me a way to compress my logs (meaning the command name, I can read up the usage via manpages). Last time I used tar and you didn't like it.

I have a hunch in that something corrupted my FS and broke some of my system libs.
Comment 15 Mike Gilbert gentoo-dev 2016-08-03 20:40:30 UTC
(In reply to mvaenskae from comment #14)
> On a sidenote, I also experience build issues on www-client/chromium and
> trying to rebuild dev-libs/glib. I can open new bug reports for them as
> well. In that case and if my logs grow beyonf the 1000KB limit, may you be
> so kind and recommend me a way to compress my logs (meaning the command
> name, I can read up the usage via manpages). Last time I used tar and you
> didn't like it.

Any of xz, bzip2, xz are acceptable. They all work the same way -- they compress a single file without adding an unnecessary wrapper around it.

Usage: xz build.log
Comment 16 Mike Gilbert gentoo-dev 2016-08-03 20:41:29 UTC
Also, you should file separate bugs for separate packages. You can link them together using the See Also field if you think the failures are related.
Comment 17 Mike Gilbert gentoo-dev 2016-08-03 20:42:16 UTC
(In reply to Mike Gilbert from comment #15)
> Any of xz, bzip2, xz are acceptable.

That should say xz, bzip2, gzip.
Comment 18 Mike Gilbert gentoo-dev 2016-08-04 00:37:28 UTC
This is likely the same MPROTECT problem as bug 590422.
Comment 19 Mike Gilbert gentoo-dev 2016-08-04 00:43:27 UTC
commit b8cb87b5af9ab23e60864a4c66988c0f595f5b77
Author: Mike Gilbert <floppym@gentoo.org>
Date:   Wed Aug 3 20:41:29 2016 -0400

    dev-lang/python: disable MPROTECT
    
    The hardened team can figure this shit out.
    
    Package-Manager: portage-2.3.0_p16

 dev-lang/python/python-2.7.12.ebuild | 7 +------
 dev-lang/python/python-3.4.5.ebuild  | 7 +------
 dev-lang/python/python-3.5.2.ebuild  | 7 +------
 3 files changed, 3 insertions(+), 18 deletions(-)
Comment 20 Mike Gilbert gentoo-dev 2016-08-04 04:23:56 UTC
(In reply to Mike Gilbert from comment #19)

I reverted this.
Comment 21 Coacher 2016-08-04 04:40:30 UTC
(In reply to mvaenskae from comment #14)
> Created attachment 442432 [details]
> config.log
> 
> Per request my config.log of mpv.
You've attached "temp/build.log" again.
Please attach "work/mpv-0.18.1/build/config.log" instead.
Comment 22 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-04 05:02:41 UTC
Did you ever install any Python modules manually or via pip?
Comment 23 mvaenskae 2016-08-04 09:32:56 UTC
(In reply to Coacher from comment #21)
> (In reply to mvaenskae from comment #14)
> > Created attachment 442432 [details]
> > config.log
> > 
> > Per request my config.log of mpv.
> You've attached "temp/build.log" again.
> Please attach "work/mpv-0.18.1/build/config.log" instead.

Oh, that is stupid of me and I apologize. I will have it uploaded later today in roughly 8 to 10 hours when I am back home.
Comment 24 mvaenskae 2016-08-04 10:05:25 UTC
(In reply to Michał Górny from comment #22)
> Did you ever install any Python modules manually or via pip?

I actually did that for one package, namely tensorflow for dev-lang/python:3.4. Confusingly this error had never appeared before I removed the package that was then not needed anymore. I did remove it now though and checked with the following command what was installed by pip and what wasn't: 
`pip list | while read l a; do loc=$(pip show "$l" | fgrep Location | awk '{ print $2 }') && find "${loc}" '(' -name "${l}*" -o -name "${l//-/_}*" ')' | head -n 1 | xargs qfile >/dev/null || echo "$l"; done` (Reference: https://forums.gentoo.org/viewtopic-t-1040730-start-0.html)

I at least learned my lesson to never again use pip, but back then I didn't know and was more pressured into the quick and dirty solution due to time constraints.

I would think doing a python-rebuild would fix this issue of the python packages having incorrect pax-flags (with MPROTECT turned off) and then recompile all leftover python packages (i.e. dev-lang/python) for getting their flags again correct.
Comment 25 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-04 11:16:55 UTC
Well, the problem with Python is that packages can influence many issues, often in an completely unpredictable way. This also includes leftover files after packages.

I would suggest checking system Python directories for orphan files. I can suggest a tool for it when I get home, of possibly another team member would be able to suggest one earlier.
Comment 26 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-04 12:23:24 UTC
Here's a good command (you need app-portage/portage-utils):

  find /usr/lib64/python* -print0 | xargs -0 qfile -o
Comment 27 Mike Gilbert gentoo-dev 2016-08-04 14:32:20 UTC
The strace log attached to bug 590422 shows python2.7 trying to mmap some memory with PROT_WRITE|PROT_EXEC just before it would call clone(2) to create a new thread.

Can you try the same strace test with python3.4 for this bug?
Comment 28 mvaenskae 2016-08-04 14:46:26 UTC
(In reply to Mike Gilbert from comment #27)
> The strace log attached to bug 590422 shows python2.7 trying to mmap some
> memory with PROT_WRITE|PROT_EXEC just before it would call clone(2) to
> create a new thread.
> 
> Can you try the same strace test with python3.4 for this bug?

I will do so later when I get home. I assume you want the default pax-flags set per default on it.
Comment 29 mvaenskae 2016-08-04 14:48:06 UTC
(In reply to Michał Górny from comment #25)
> Well, the problem with Python is that packages can influence many issues,
> often in an completely unpredictable way. This also includes leftover files
> after packages.
> 
> I would suggest checking system Python directories for orphan files. I can
> suggest a tool for it when I get home, of possibly another team member would
> be able to suggest one earlier.

Thanks for the command in comment #26.
What should I be doing in the case of finding some?
Comment 30 Mike Gilbert gentoo-dev 2016-08-04 15:33:31 UTC
(In reply to mvaenskae from comment #28)
> I will do so later when I get home. I assume you want the default pax-flags
> set per default on it.

Well, I'm really just looking for the mmap call, and whether it gets passed PROT_WRITE|PROT_EXEC. If it does, we are looking at the same problem with both python2.7 and python3.4.

The PaX flags will simply determine whether the mmap call gets treated as an error or not.
Comment 31 mvaenskae 2016-08-04 19:16:39 UTC
Created attachment 442542 [details]
config.log

Hopefully this time the correct config.log file
Comment 32 mvaenskae 2016-08-04 19:18:37 UTC
Created attachment 442544 [details]
strace of python:3.4

Per comment #30 I have uploaded my strace of the same execution done prior with python2.7. It does the same mmap with READ|WRITE|EXEC from the looks before the clone.
Comment 33 Attila Tóth 2016-08-11 15:42:09 UTC
Your problem is caused by python binary without GNU_STACK header.
The same problem causes your other bug:
https://bugs.gentoo.org/show_bug.cgi?id=590422
Workaround: paxctl-ng -m the python binary.
Solution: figure out how your toolchain's problem (PAX_MARKINGS, PT_PAX support: I suggest to disable PT and keep XT) and re-emerge python. I also suggest to eselect python 3.4 or 2.7 but not 3.5 (pypax).
Comment 34 Coacher 2017-05-05 15:55:47 UTC
mvaenskae, I see that bug 590422 is now resolved.
Does this bug is still valid or it was resolved as well?
Comment 35 Coacher 2017-05-21 17:10:07 UTC
(In reply to Coacher from comment #34)
> mvaenskae, I see that bug 590422 is now resolved.
> Does this bug is still valid or it was resolved as well?
mvaenskae, after more than 2 weeks of your silence I consider this bug as resolved. I tend to agree with comment 33 that this bug is indeed a dupe of bug 590422, but I cannot reproduce so I cannot say for sure.
Closing as FIXED similarly to bug 590422.