Re: Plugins redux (was Re: [PATCHES] PL instrumentation - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Plugins redux (was Re: [PATCHES] PL instrumentation
Date
Msg-id 1903.1155164746@sss.pgh.pa.us
Whole thread Raw
In response to Re: Plugins redux (was Re: [PATCHES] PL instrumentation  ("korryd@enterprisedb.com" <korryd@enterprisedb.com>)
List pgsql-hackers
"korryd@enterprisedb.com" <korryd@enterprisedb.com> writes:
>>> (there is no UNLOAD statement, is there?).
>> 
>> What we actually have at the moment is that you can LOAD a library
>> again, which causes an unload of the prior version and then loading the
>> new.

> Right, but you still end up with a plugin loaded afterwards so no crash
> (of course you could do something stupid like load a new plugin with the
> same name that isn't really a plugin).

That is only true given careful design and implementation of the
hooks.  Right now for instance I think it's possible to crash the
backend by doing "LOAD 'plpgsql'" multiple times, because it hooks
into CallXactCallbacks and doesn't unhook.  (Now that we have PG_fini
it should be possible to fix that...)  Doesn't seem to crash
on the HPUX machine I just tried it on, but maybe HPUX is weird and
doesn't actually remove the old library from the address space?

Anyway I disagree with your proposal to let unprivileged users re-LOAD
random libraries.  If they've not been modified to have clean unload
semantics this isn't safe.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Andrej Ricnik-Bay"
Date:
Subject: Re: new job
Next
From: "Joshua D. Drake"
Date:
Subject: Win32 max connections bug (causing crashes)