OpenGL applications may fail to run on foreign distributions

  • Done
  • quality assurance status badge
Details
3 participants
  • Thiago Jung Bauermann
  • Ludovic Courtès
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 3 Aug 2021 19:33
(name . bug-guix)(address . bug-guix@gnu.org)
87k0l25t7x.fsf@gmail.com
Hello Guix,

I recently discovered that on systems that used another implementation
of OpenGL than those provided by Mesa (such as systems using the
proprietary nvidia or AMD drivers), the OpenGL application would crash,
sometimes even requiring a reboot of the host system to recover!

While the issue could be dismissed due to the use of proprietary drivers
on these systems, I think in theory there might be issues also when mix
and matching Guix's Mesa libGL along the foreign distro kernel (which
may run Mesa but from a much older/or recent version).

I also think that it is quite surprising that graphical applications
distributed with Guix packs fail to be 'universal' in the way we've come
to know them for CLI applications.

It appears this issue may have a solution in enabling libglvnd [0]
support in our Mesa so that the GPU hardware vendor provided libGL.so
could be loaded from the system instead.

Thanks,

Maxim

T
T
Thiago Jung Bauermann wrote on 3 Aug 2021 23:13
(address . 49847@debbugs.gnu.org)(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
1948377.OP2kyRLfc7@popigai
Hi,

Em terça-feira, 3 de agosto de 2021, às 14:33:06 -03, Maxim Cournoyer
escreveu:
Toggle quote (4 lines)
> It appears this issue may have a solution in enabling libglvnd [0]
> support in our Mesa so that the GPU hardware vendor provided libGL.so
> could be loaded from the system instead.

As some additional information, the first version of the patch to update
Mesa provided in issue 49339 enabled libglvnd, and there’s some discussion
about it in the ensuing messages.

The Mesa updat patch that was committed doesn’t enable libglvnd, and it was
decided to address that change separately.

--
Thanks,
Thiago
L
L
Ludovic Courtès wrote on 4 Aug 2021 23:30
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 49847@debbugs.gnu.org)
87fsvonbir.fsf@gnu.org
Hi,

Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:

Toggle quote (5 lines)
> I recently discovered that on systems that used another implementation
> of OpenGL than those provided by Mesa (such as systems using the
> proprietary nvidia or AMD drivers), the OpenGL application would crash,
> sometimes even requiring a reboot of the host system to recover!

Ouch. Isn’t it similar to the problem with libc’s Name Service Switch
(info "(guix) Application Setup"):

If the nscd is not running, then [applications] perform the name
lookup by themselves, by loading the name lookup services into their
own address space and running it. These name lookup services—the
‘libnss_*.so’ files—are ‘dlopen’’d, but they may come from the host
system’s C library, rather than from the C library the application is
linked against (the C library coming from Guix).

And this is where the problem is: if your application is linked
against Guix’s C library (say, glibc 2.24) and tries to load NSS plugins
from another C library (say, ‘libnss_mdns.so’ for glibc 2.22), it will
likely crash or have its name lookups fail unexpectedly.

That is, Mesa can dlopen “drivers” (shared libs), and if these drivers
come from a foreign distro, the application is likely to crash sooner or
later.

If that’s what happens, we’d have to arrange so that our Mesa doesn’t
dlopen non-Guix shared libs.

Thanks,
Ludo’.
M
M
Maxim Cournoyer wrote on 5 Aug 2021 04:21
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 49847@debbugs.gnu.org)
87r1f8my1o.fsf@gmail.com
Hi Ludovic,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (28 lines)
> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
>> I recently discovered that on systems that used another implementation
>> of OpenGL than those provided by Mesa (such as systems using the
>> proprietary nvidia or AMD drivers), the OpenGL application would crash,
>> sometimes even requiring a reboot of the host system to recover!
>
> Ouch. Isn’t it similar to the problem with libc’s Name Service Switch
> (info "(guix) Application Setup"):
>
> If the nscd is not running, then [applications] perform the name
> lookup by themselves, by loading the name lookup services into their
> own address space and running it. These name lookup services—the
> ‘libnss_*.so’ files—are ‘dlopen’’d, but they may come from the host
> system’s C library, rather than from the C library the application is
> linked against (the C library coming from Guix).
>
> And this is where the problem is: if your application is linked
> against Guix’s C library (say, glibc 2.24) and tries to load NSS plugins
> from another C library (say, ‘libnss_mdns.so’ for glibc 2.22), it will
> likely crash or have its name lookups fail unexpectedly.
>
> That is, Mesa can dlopen “drivers” (shared libs), and if these drivers
> come from a foreign distro, the application is likely to crash sooner or
> later.

I'm no expert on the matter (yet :-)) , but I think it's more like the
other way around; the Guix applications are hard-coded to use Mesa's
libGL.so, which has its own expectations of what DRM drivers should be
available from the host system's kernel, or features they provides.
When someone uses another OpenGL implementation than Mesa's own,
apparently all hell may break loose.

Maxim
M
M
Maxim Cournoyer wrote on 8 Aug 2023 05:57
(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)(address . 49847-done@debbugs.gnu.org)
87y1imchkj.fsf@gmail.com
Hello,

With even nvidia going with free drivers (sadly not free firmware
blobs), I think we can put this issue to rest, at least for now.

--
Thanks,
Maxim
Closed
?