Crash in libegl-mesa0 due to out of bound array access

Bug #1776499 reported by Yogish Kulkarni
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mesa (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
Fix Released
Undecided
Timo Aaltonen

Bug Description

Crash in libegl-mesa0 due to out of bound array access. Crash is fixed on Mesa master branch with change: https://cgit.freedesktop.org/mesa/mesa/commit/?id=41642bdbca007035772fbfdc311f14daa5510d5d .This bug is to request to include this change in Mesa upgrades in bionic.

Please let me know if this change needs to be back ported to other branch so that libegl-mesa0 upgrade in Bionic could pick this change.

lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic

apt-cache policy libegl-mesa0
libegl-mesa0:
  Installed: 18.0.0~rc5-1ubuntu1
  Candidate: 18.0.0~rc5-1ubuntu1
  Version table:
 *** 18.0.0~rc5-1ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 Packages
        100 /var/lib/dpkg/status

affects: libglvnd (Ubuntu) → mesa (Ubuntu)
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

18.0.x series is done, this would need to be added as a distro patch

Revision history for this message
Yogish Kulkarni (yogishk) wrote :

Sorry, I couldn't understand what do you mean by distro patch. Do you mean it needs to be applied as patch over the current version of libegl-mesa0 in Bionic and libegl-mesa0 generated with this patch needs to come as upgrade in Bionic (i.e when I do apt-get upgrade) ? thanks!

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

Yes. Problem is that bionic-proposed already has 18.0.5 staged for the 18.04.1 update, so adding more would delay getting that update.

Is there a way to reproduce this bug? How common is it? I'm wondering if it should be skipped for now and provided via backport from cosmic after 18.10 is released..

Revision history for this message
Yogish Kulkarni (yogishk) wrote :

Crash can be reproduced by simple test application which does e.g. :
main()
{
   eglGetProcAddress("egl148546488546404");
}

The problem is in the search algorithm used in mesa to look for the name passed to eglGetProcAddress. So crash can reproduce with other names as well. Please note that this bug will affect even though mesa driver is actually not getting used. GLVD tries to load drivers from all vendors listed in "/usr/share/glvnd/egl_vendor.d/". As a work around "/usr/share/glvnd/egl_vendor.d/50_mesa.json" needs to be removed for using EGL driver from other vendors e.g. nvidia.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 18.1.1-1ubuntu1

---------------
mesa (18.1.1-1ubuntu1) cosmic; urgency=medium

  * Merge from Debian.
  * glvnd-fix-a-segfault-in-eglgetprocaddess.diff: Backport a commit to
    fix a segfault. (LP: #1776499)

 -- Timo Aaltonen <email address hidden> Wed, 13 Jun 2018 12:10:21 +0300

Changed in mesa (Ubuntu):
status: New → Fix Released
Iain Lane (laney)
Changed in mesa (Ubuntu Bionic):
assignee: nobody → Timo Aaltonen (tjaalton)
Revision history for this message
Yogish Kulkarni (yogishk) wrote :

Hi Timo,
Is the fix for this issue likely to backported to Bionic ?

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

yes, but not before the current version in -proposed has migrated to -updates

Revision history for this message
Yogish Kulkarni (yogishk) wrote :

Hi Timo,
It seems -proposed "18.0.5-0ubuntu0~18.04.1" is migrated to -updates. So, is it possible to fix this in next version getting finalized for -updates ?

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

The next one will be based on mesa 18.2.x from 18.10

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

please test 18.2.2 from bionic-proposed

Changed in mesa (Ubuntu Bionic):
status: New → Fix Committed
Revision history for this message
Yogish Kulkarni (yogishk) wrote :

Before using libegl-mesa0 from bionic-proposed:
$ apt-cache policy libegl-mesa0
libegl-mesa0:
  Installed: 18.0.5-0ubuntu0~18.04.1
  Candidate: 18.0.5-0ubuntu0~18.04.1
  Version table:
 *** 18.0.5-0ubuntu0~18.04.1 100
        100 /var/lib/dpkg/status
$ cat main.c
main()
{
   eglGetProcAddress("egl148546488546404");
}
$ gcc main.c -lEGL
$ ./a.out
Segmentation fault (core dumped)

After upgrading libegl-mesa0 to bionic-proposed:
$ apt-cache policy libegl-mesa0
libegl-mesa0:
  Installed: 18.2.2-0ubuntu1~18.04.1
  Candidate: 18.2.2-0ubuntu1~18.04.1
  Version table:
 *** 18.2.2-0ubuntu1~18.04.1 500
        500 http://ports.ubuntu.com/ubuntu-ports bionic-proposed/main arm64 Packages
        100 /var/lib/dpkg/status
     18.0.5-0ubuntu0~18.04.1 500
        500 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main arm64 Packages
     18.0.0~rc5-1ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports bionic/main arm64 Packages
$ ./a.out
No crash

So I can confirm that the issues is fixed in bionic-proposed.

Revision history for this message
Yogish Kulkarni (yogishk) wrote :

When it is expected libegl-mesa0 to move from bionic-proposed to bionic-updates ? thanks!

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

before 18.04.2 is released, which means before feb 7th unless it's delayed

thanks for verifying!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mesa - 18.2.2-0ubuntu1~18.04.1

---------------
mesa (18.2.2-0ubuntu1~18.04.1) bionic; urgency=medium

  * Backport for 18.04.2 HWE stack update. (LP: #1798597)
  * intel-whl-aml-cfl-ids.diff: Add missing i965 pci-id's (LP: #1789924)

 -- Timo Aaltonen <email address hidden> Thu, 29 Nov 2018 00:09:03 +0200

Changed in mesa (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Penny Chiu (pchiu) wrote :

This issue is still happened using focal-update.

I checked below changelog for libegl-mesa0 package:

- https://packages.ubuntu.com/focal/libegl-mesa0
- https://packages.ubuntu.com/focal-updates/libegl-mesa0

And found the change is only existed in focal, but not in focal-update:

mesa (18.1.1-1ubuntu1) cosmic; urgency=medium

  * Merge from Debian.
  * glvnd-fix-a-segfault-in-eglgetprocaddess.diff: Backport a commit to
    fix a segfault. (LP: #1776499)

 -- Timo Aaltonen <email address hidden> Wed, 13 Jun 2018 12:10:21 +0300

Timo, can we also have this fix landed in focal-update?

Revision history for this message
Timo Aaltonen (tjaalton) wrote :

huh, focal-updates has a much newer mesa which has that commit..

Revision history for this message
Maniraj D (manirajd) wrote :

Hi Timo,

A similar crash is observed in mesa-egl and it is resolved in Mesa master branch. Please refer the bug: https://bugs.launchpad.net/mesa/+bug/1946621

Can you help backporting the fix to "Focal" series.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.