From: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Ants Aasma *EXTERN*" <ants(at)cybertec(dot)at>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Using RTLD_DEEPBIND to handle symbol conflicts in loaded libraries |
Date: | 2014-11-26 12:34:12 |
Message-ID: | A737B7A37273E048B164557ADEF4A58B17DA5677@ntex2010a.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Ants Aasma wrote:
> I had to make oracle_fdw work with PostgreSQL compiled using
> --with-ldap. The issue there is that Oracle's client library has the
> delightful property of linking against a ldap library they bundle that
> has symbol conflicts with OpenLDAP. At PostgreSQL startup libldap is
> loaded, so when libclntsh.so (the Oracle client) is loaded it gets
> bound to OpenLDAP symbols, and unsurprisingly crashes with a segfault
> when those functions get used.
>
> glibc-2.3.4+ has a flag called RTLD_DEEPBIND for dlopen that prefers
> symbols loaded by the library to those provided by the caller. Using
> this flag fixes my issue, PostgreSQL gets the ldap functions from
> libldap, Oracle client gets them from whatever it links to. Both work
> fine.
I am aware of the problem, but this solution is new to me.
My workaround so far has been to load OpenLDAP with the LD_PRELOAD
environment variable on PostgreSQL start.
But then you get a crash when Oracle uses LDAP functionality (directory naming).
> Attached is a patch that enables this flag on Linux when available.
> This specific case could also be fixed by rewriting oracle_fdw to use
> dlopen for libclntsh.so and pass this flag, but I think it would be
> better to enable it for all PostgreSQL loaded extension modules.
I'll consider changing oracle_fdw in that fashion, even if that will
only remedy the problem on Linux.
I think that this patch is a good idea though.
Yours,
Laurenz Albe
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2014-11-26 12:37:38 | Re: Role Attribute Bitmask Catalog Representation |
Previous Message | Marko Tiikkaja | 2014-11-26 12:31:37 | Re: proposal: plpgsql - Assert statement |