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

Bug 598593

Summary: media-libs/mesa-13.0.0_rc2: libGL crashes on hardened AMD64
Product: Gentoo Linux Reporter: Christian Apeltauer <c.apeltauer>
Component: Current packagesAssignee: Gentoo X packagers <x11>
Status: RESOLVED FIXED    
Severity: normal CC: creideiki+gentoo-bugzilla, hardened, jstein, miro.rovis, tsmksubc
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: https://bugs.freedesktop.org/show_bug.cgi?id=98563
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: emerge --info mesa
backtrace of mkvtoolnix-gui
messages_161113_2246_g5n, the syslog of the event
messages_161217_2326_g0n_firefox_segfaults
emerge--info.txt

Description Christian Apeltauer 2016-10-30 19:04:40 UTC
Created attachment 451937 [details]
emerge --info mesa

After upgrading from mesa-12.0.3 to mesa-13.0.0_rc2 applications crash in the libGL library. The attached backtrace is for mkvtoolnix-gui (from media-video/mkvtoolnix-9.5.0), but happens for any application using libGL. It seems to happen always at src/loader/loader.c line 151 of mesa sources.
Comment 1 Christian Apeltauer 2016-10-30 19:05:11 UTC
Created attachment 451939 [details]
backtrace of mkvtoolnix-gui
Comment 2 Matt Turner gentoo-dev 2016-11-04 17:54:18 UTC
Thanks for the report. I think this is the same bug as the one I put in the URL field. Looks like the fix is already in libdrm, and pending testing and an additional fix upstream will release a new version.
Comment 3 miro.rovis 2016-11-07 15:29:24 UTC
(In reply to Matt Turner from comment #2)
> Thanks for the report. I think this is the same bug as the one I put in the
> URL field. Looks like the fix is already in libdrm, and pending testing and
> an additional fix upstream will release a new version.

It probably is that same bug. But if it has been fixed, it has not propagated to us.
It took me a while to figure out it was about mesa only, really:
Comment 4 miro.rovis 2016-11-07 15:38:32 UTC
(In reply to Matt Turner from comment #2)
> Thanks for the report. I think this is the same bug as the one I put in the
> URL field. Looks like the fix is already in libdrm, and pending testing and
> an additional fix upstream will release a new version.

It probably is that same bug. But if it has been fixed, it has not propagated to us.
It took me a while to figure out it was about mesa in the first place:

=www-client/firefox-49.0 segfaults with >=media-libs/mesa-13.0.0_rc1 on >=4.4.8-hardened-r1
https://bugs.gentoo.org/show_bug.cgi?id=598700#attach_452100

That is probably a duplicate bug.

In my machine, to get firefox to work fine, two things are necessary, at this time (of solution not yet propagated):

1) downgrade to mesa-12.0.3

and:

2) downgrade to firefox-45.4.0

Without 1), that is with mesa-13.0.0 and on hardened, segfault, no firefox.
Without 1), that is with mesa-13.0.0 on plain kernel, firefox works, but display pages very poorly (fonts completely illegible and pale, on lots of pages, toolbar in reverse and poorly illegible)

Without 2), that is with firefox-49.0 and plain kernel, all is fine.
Without 2), that is with firefox-49.0 and hardened kernel, firefox works, but display pages very poorly (fonts completely illegible and pale, on lots of pages, toolbar in reverse and poorly illegible).

Under hardened in this post of mine, grsecurity-hardened is intended.

Regards!
Comment 5 miro.rovis 2016-11-07 15:41:28 UTC
And just to add,

with 1) and 2) in effect

(that is both mesa and firefox downgraded),

there is no need to mess with paxctl-ng or PAX_<whatever> flags in /etc/grsec/policy.

Everything works fine, with no special care, just as usually with firefox.
Comment 6 miro.rovis 2016-11-13 22:51:59 UTC
(In reply to Matt Turner from comment #2)
> Thanks for the report. I think this is the same bug as the one I put in the
> URL field. Looks like the fix is already in libdrm, and pending testing and
> an additional fix upstream will release a new version.
It may be the same bug as the one in:
https://bugs.freedesktop.org/show_bug.cgi?id=98563
but we get different results with vanilla kernel, and with grsec-hardened kernel.

Also the developer there wants to keep the on-vanilla and on-hardened issues separated. Actually he declares those to be separate bugs:
https://bugs.freedesktop.org/show_bug.cgi?id=98563#c6

Emil Velikov wrote:
> ... Thus I'm inclined that this a separate bug. 
> ... Please keep all the information in a separate bug and add me
> in the cc-list.

But there is no link to the on-hardened bug in that bug you linked.

Is it this one? :
[SNA HSW] Corruption in OpenGL video output (DRI2 + TearFree)
https://bugs.freedesktop.org/show_bug.cgi?id=95414

It's the only one that has grsec kernel:
> kernel version: 4.5.4 (vanilla+grsec)

I see no other separate bug...

But the bug hasn't gone away. Will try and post how it fares with 4.8.7-hardened, next.
Comment 7 miro.rovis 2016-11-13 23:04:24 UTC
Created attachment 453264 [details]
messages_161113_2246_g5n, the syslog of the event

It's just issuing
$ firefox
in a terminal. No output on the terminal, just crashes with those lines in the syslog.
It's:
www-client/firefox-45.4.0
and it's:
media-libs/mesa-13.0.0
And all that just happened on:
$ uname -r
4.8.7-hardened-161113_14
$
that I installed today.

Do I have to say that reverting to:
media-libs/mesa-12.0.3

has the effect that firefox starts normally? Believe me, it does!

Too tired to try install (yet again) www-client/firefox-49.0 ... but I bet there would be again like I explained in:
https://bugs.gentoo.org/show_bug.cgi?id=598593#c4

Without 2), that is with firefox-49.0 and hardened kernel, firefox works, but display pages very poorly (fonts completely illegible and pale, on lots of pages, toolbar in reverse and poorly illegible).

(I just forgot to make it completely clear that that line intends mesa-12.0.3 Sorry! ...
It is all a little funny. Seems to be an issue with mesa, but I don't see a mention of mesa by the syslog, and it's the grsec exec_logging and all, really very good syslog by grsec...)
Comment 8 miro.rovis 2016-11-14 05:56:29 UTC
(In reply to miro.rovis from comment #6)
> Is it this one? :
> [SNA HSW] Corruption in OpenGL video output (DRI2 + TearFree)
> https://bugs.freedesktop.org/show_bug.cgi?id=95414
> 
There's a (currently) new bug there:
Incomplete frames in OpenGL video playback (DRI2 + Tearfree, SNA Haswell)
https://bugs.freedesktop.org/show_bug.cgi?id=98635
which may be grsec-related.

and I don't remember, but it was one or two levels of links that gets you (likely from there) to:
Sanitize all freed GPU memory
https://bugs.freedesktop.org/show_bug.cgi?id=74532
with a very interesting link:
https://github.com/mpv-player/mpv/issues/521
(just thought I'd share it, since it is at least partly related)

Regards!
Comment 9 miro.rovis 2016-11-14 06:04:29 UTC
*** Bug 598700 has been marked as a duplicate of this bug. ***
Comment 10 Christian Apeltauer 2016-12-04 12:24:33 UTC
mpv does not with mesa-13.0.1 and mesa-13.0.2 any more, but is too slow to play videos fluently. Similar with firefox, there is a notable drag when scrolling down webpages
Comment 11 miro.rovis 2016-12-17 23:17:13 UTC
Created attachment 456534 [details]
messages_161217_2326_g0n_firefox_segfaults

Currently:

www-client/firefox-50.0.2

and:

media-libs/mesa-12.0.5

But I had to downgrade from:

media-libs/mesa-13.0.2

because Firefox segfaults, still!

Pls. view attachment:

messages_161217_2326_g0n_firefox_segfault

Of course, knowing where the issue lies, I downgraded, and Firefox now
works...

emerge --info next (and maybe more)...
Comment 12 miro.rovis 2016-12-17 23:20:13 UTC
Created attachment 456536 [details]
emerge--info.txt

If anymore is needed, senior members, pls. do tell!
Comment 13 miro.rovis 2016-12-17 23:21:27 UTC
(In reply to miro.rovis from comment #11)

> Of course, knowing where the issue lies, I downgraded, and Firefox now
> works...

I mean, I downgraded mesa to 12.0 . Not the Firefox.
Comment 14 Matt Turner gentoo-dev 2017-01-24 19:01:06 UTC
(In reply to Christian Apeltauer from comment #0)
> Created attachment 451937 [details]
> emerge --info mesa
> 
> After upgrading from mesa-12.0.3 to mesa-13.0.0_rc2 applications crash in
> the libGL library. The attached backtrace is for mkvtoolnix-gui (from
> media-video/mkvtoolnix-9.5.0), but happens for any application using libGL.
> It seems to happen always at src/loader/loader.c line 151 of mesa sources.

Can you upgrade to >=x11-libs/libdrm-2.4.72 and >=media-libs/mesa-13.0.3 and tell me if the problem still exists?

The rest of the comments are confusing and it seems there are multiple bugs, so let's focus on the original one.
Comment 15 Christian Apeltauer 2017-01-27 06:42:34 UTC
(In reply to Matt Turner from comment #14)
> (In reply to Christian Apeltauer from comment #0)
> > Created attachment 451937 [details]
> > emerge --info mesa
> > 
> > After upgrading from mesa-12.0.3 to mesa-13.0.0_rc2 applications crash in
> > the libGL library. The attached backtrace is for mkvtoolnix-gui (from
> > media-video/mkvtoolnix-9.5.0), but happens for any application using libGL.
> > It seems to happen always at src/loader/loader.c line 151 of mesa sources.
> 
> Can you upgrade to >=x11-libs/libdrm-2.4.72 and >=media-libs/mesa-13.0.3 and
> tell me if the problem still exists?
> 
> The rest of the comments are confusing and it seems there are multiple bugs,
> so let's focus on the original one.

Using x11-libs/libdrm-2.4.74 and media-libs/mesa-13.0.3, mpv does not crash any more, but the video is played non fluently (and for the record: firefox is also slow to respond to scrolling or typing), but mplayer and vlc play videos just fine. When using mpv all I got as error messages are:
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
libEGL warning: DRI2: failed to create dri screen
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
libEGL warning: DRI2: failed to create dri screen
Comment 16 wbrana 2017-01-31 14:04:09 UTC
is CONFIG_GRKERNSEC_SYSFS_RESTRICT disabled?
Skylake GPU probably neeeds VIDEO_CARDS="intel i965"
Comment 17 Matt Turner gentoo-dev 2017-02-13 14:32:10 UTC
(In reply to Christian Apeltauer from comment #15)
> (In reply to Matt Turner from comment #14)
> > (In reply to Christian Apeltauer from comment #0)
> > > Created attachment 451937 [details]
> > > emerge --info mesa
> > > 
> > > After upgrading from mesa-12.0.3 to mesa-13.0.0_rc2 applications crash in
> > > the libGL library. The attached backtrace is for mkvtoolnix-gui (from
> > > media-video/mkvtoolnix-9.5.0), but happens for any application using libGL.
> > > It seems to happen always at src/loader/loader.c line 151 of mesa sources.
> > 
> > Can you upgrade to >=x11-libs/libdrm-2.4.72 and >=media-libs/mesa-13.0.3 and
> > tell me if the problem still exists?
> > 
> > The rest of the comments are confusing and it seems there are multiple bugs,
> > so let's focus on the original one.
> 
> Using x11-libs/libdrm-2.4.74 and media-libs/mesa-13.0.3, mpv does not crash
> any more, but the video is played non fluently (and for the record: firefox
> is also slow to respond to scrolling or typing), but mplayer and vlc play
> videos just fine. When using mpv all I got as error messages are:
> MESA-LOADER: failed to retrieve device information
> MESA-LOADER: failed to retrieve device information
> MESA-LOADER: failed to retrieve device information
> libEGL warning: DRI2: failed to create dri screen
> MESA-LOADER: failed to retrieve device information
> MESA-LOADER: failed to retrieve device information
> MESA-LOADER: failed to retrieve device information
> libEGL warning: DRI2: failed to create dri screen

Okay, so the original bug is resolved.

Let's please open a new one for this problem.