Bug #98130 libmysqlclient.so.18 breaks libz.so.1
Submitted: 6 Jan 2020 1:21 Modified: 10 Jan 2020 16:09
Reporter: Taku AMANO (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S2 (Serious)
Version:5.6.45 OS:CentOS
Assigned to: Terje Røsten CPU Architecture:Any

[6 Jan 2020 1:21] Taku AMANO
Description:
Loading a libmysqlclient.so.18 installed by mysql-community-libs-compat-5.7.28-1.el7.x86_64 dynamically in certain ways breaks zlib.

How to repeat:
We can reproduce with this code.
https://github.com/usualoma/break-zlib

For example, the following error occurs.
```
perl -MDBD::mysql -MCompress::Raw::Zlib -E 'say new Compress::Raw::Zlib::Inflate'
stream error
perl -MCompress::Raw::Zlib -MDBD::mysql -E 'say new Compress::Raw::Zlib::Inflate'
Compress::Raw::Zlib::inflateStream=SCALAR(0xcf3698)
```

There is also reproducing code by c.

Suggested fix:
Make symbols derived from zlib local. (Currently global)
[6 Jan 2020 11:38] Terje Røsten
Hi!

Thanks for your report!

This is a known problem and has been resolved in MySQL 5.7 and
libmysqlclient.so.20.

It was decided not to restrict symbol export in MySQL 5.5 and 5.6 (both shipping with libmysqlclient.so.18) due to usage in the wild.

Problem with mysql-community-libs-compat RPM will be resolved by using zlib from system.
[6 Jan 2020 23:13] Taku AMANO
Thank you for response!

Is the following status for mysql-community-libs-compat on CentOS 7?

* libmysqlclient.so.18 (installed by mysql-community-libs-compat-5.7.28-1.el7.x86_64 from MySQL Yum Repository) does not work correctly sometimes with DBD::mysql (installed by perl-DBD-MySQL-4.023-6.el7.x86_64 from CentOS 7 base repository).
* We have to rebuild DBD::mysql (after uninstalled perl-DBD-MySQL-4.023-6.el7.x86_64) with libmysqlclient.so.20 in order to work stably.
[7 Jan 2020 14:20] Terje Røsten
Yeah, that's current status.

MySQL 5.7.30 is likely to contain a build fix for the problem.
[10 Jan 2020 16:09] Paul DuBois
Posted by developer:
 
Fixed in 5.7.30, 8.0.20.

The -libs-compat RPM package is not built with system zlib to avoid
problems with unrestricted export of symbols in libmysqlclient.so.18.
[11 Jan 2020 11:41] Paul DuBois
Posted by developer:
 
Correction to changelog entry (not => now):

The -libs-compat RPM package is now built with system zlib to avoid
problems with unrestricted export of symbols in libmysqlclient.so.18.