# Two modules w/ different instances of same lib causes crash

- Thread: https://externals.io/message/25723
- Original archive: https://news-web.php.net/php.internals/25723
- Started by Michael B Allen on 2006-09-15T15:43:56+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #25723 — Michael B Allen — 2006-09-15T15:43:56+00:00

URL: https://externals.io/message/25723#25723

My extension (plexsso.so) is dymanically linked with a library. That
library (libplexsso.so) is a statically linked collection of libs
including a custom version of Heimdal Kerberos (libkrb5.a). I have found
that if another module is linked with the stock Heimdal (e.g. pgsql.so
dynamically in this case) some symbol mixing occurs and the application
crashes.

Can two modules use different instances of the same library?

Before I go try to become an expert in linking and the Linux loader
can anyone give me advice as to how to I might workaround (for Linux
at least)?

Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/

---

## #25725 — Michael B Allen — 2006-09-15T19:23:16+00:00

URL: https://externals.io/message/25723#25725 · In reply to: #25723

RTLD_DEEPBIND fixes this problem using a test program and two minimalistic
DSOs to emulate the namespace clash problem. But I see PHP has support
for RTLD_DEEPBIND:

# if defined(RTLD_GROUP) && defined(RTLD_WORLD) && defined(RTLD_PARENT)
...
# elif defined(RTLD_DEEPBIND)
...
# else
...
# endif

On my Linux glibc 2.3 systems RTLD_DEEPBIND is chosen.

So now, I have to wonder why my customer had a problem in the first place.

Based on the above macros, is it possible that RTLD_DEEPBIND could NOT
be chosen?

Mike

On Fri, 15 Sep 2006 11:43:56 -0400
Michael B Allen <mba2000@ioplex.com> wrote:

> My extension (plexsso.so) is dymanically linked with a library. That
> library (libplexsso.so) is a statically linked collection of libs
> including a custom version of Heimdal Kerberos (libkrb5.a). I have found
> that if another module is linked with the stock Heimdal (e.g. pgsql.so
> dynamically in this case) some symbol mixing occurs and the application
> crashes.
> 
> Can two modules use different instances of the same library?
> 
> Before I go try to become an expert in linking and the Linux loader
> can anyone give me advice as to how to I might workaround (for Linux
> at least)?
> 
> Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/

---

## #25726 — Michael B Allen — 2006-09-15T20:06:45+00:00

URL: https://externals.io/message/25723#25726 · In reply to: #25725

On Fri, 15 Sep 2006 15:23:16 -0400
Michael B Allen <mba2000@ioplex.com> wrote:

> So now, I have to wonder why my customer had a problem in the first place.
> 
> Based on the above macros, is it possible that RTLD_DEEPBIND could NOT
> be chosen?

The customer is using 4.3.4 which did not have the RTLD_DEEPBIND patch
so that explains it. Problem solved. You guys are good :->

Does anyone happen to know what version the RTLD_DEEPBIND
patch was shipped in? Is there a way to tell from look at

  http://viewcvs.php.net/viewvc.cgi/

?

Mike

-- 
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/
