Bug 1399878

Summary: [LLNL 7.4 Bug] babl library goes into a recursive loop causing gimp and other apps using babl to crash when exiting
Product: Red Hat Enterprise Linux 7 Reporter: Ben Woodard <woodard>
Component: bablAssignee: Josef Ridky <jridky>
Status: CLOSED ERRATA QA Contact: Desktop QE <desktop-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 7.3CC: foraker1, jkoten, nphilipp, tgummels, tpelka, watson30
Target Milestone: rc   
Target Release: 7.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: babl-0.1.10-10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 08:44:28 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:
Embargoed:
Bug Depends On:    
Bug Blocks: 1432486, 1522983    
Attachments:
Description Flags
reproducer none

Description Ben Woodard 2016-11-30 00:51:30 UTC
Created attachment 1226092 [details]
reproducer

Description of problem:
The babl library (babl-0.1.10-9.el7.x86_64) has a bug where it calls babl_fatal() when malloc() or free() have changed memory addresses. babl_fatal() ends up infinitely recursively calling a set of five functions.  Eventually, this exhausts all of the memory that the process is allowed to allocate and gimp gets a SIGSEGV or is killed by the OOM killer.

How reproducible:
This is reproducible in various ways. The simplest way is to load the nvidia drivers and then run gimp. However, this problem also affects local apps.

This problem has been fixed upstream. Could we apply the following three upstream patches to our babl package to fix the bug:

commit d9146bbdd48a9624380884afd55e1c5933844b73
Author: yvind Kols <pippin>
Date:   Wed Jul 2 06:20:13 2014 +0200

babl: make malloc implementation stability sanity check non-fatal

commit 1a1177bf7b43eb971ab4ff49b1e4f7913aa73e7e
Author: Mukund Sivaraman <muks>
Date:   Wed Sep 3 10:09:55 2014 +0530

   babl: Fix message printed when memory function pointers don't match

commit 804808f4e3d1fa1c8824932637a110f985b19187
Author: Mukund Sivaraman <muks>
Date:   Mon Apr 20 01:00:58 2015 +0530

   Don't repeat the malloc/free function pointer change messages


When I run the reproducer against a patched babl.  I get this output from running "make":

gcc -fPIC -shared -o libbabl_test_lib.so babl_test_lib.c -l babl-0.1
gcc -o babl_test_main babl_test_main.c -l GL -l babl-0.1 -Wl,-rpath=. -L . -l babl_test_lib
ulimit -c 0; \
   ulimit -v 100000; \
   ./babl_test_main
before_main: calling babl_free (malloc = 0x2aaaab4cbf70, free = 0x2aaaab4cc370)
before_main: called babl_free (malloc = 0x2aaaab4cbf70, free = 0x2aaaab4cc370)
main: calling babl_free
HMM....
Something strange is happening,
malloc and free function pointer changing between invocations in babl.
main: called babl_free
after_main: malloc = 0x2aaaab80f490, free = 0x2aaaab80f160

Note how the addresses of both malloc() and free() change.  It appears that somehow the GL library is causing relocations of these two functions.

Comment 2 Nils Philippsen 2016-12-08 13:17:10 UTC
The changes look sane to me and apply cleanly.

Comment 10 errata-xmlrpc 2018-04-10 08:44:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0670