Make LOAD of an already-loaded library into a no-op, instead of attempting
authorTom Lane <[email protected]>
Thu, 3 Sep 2009 22:11:22 +0000 (22:11 +0000)
committerTom Lane <[email protected]>
Thu, 3 Sep 2009 22:11:22 +0000 (22:11 +0000)
commit5927d9f642c4cf6233e5fedd3468087995c00523
treea2bbb0b7b67e64e9e708bac68107abd5f5e2968b
parentfe8170dcfa9dda7cb46735a17542955cae2acf79
Make LOAD of an already-loaded library into a no-op, instead of attempting
to unload and re-load the library.

The difficulty with unloading a library is that we haven't defined safe
protocols for doing so.  In particular, there's no safe mechanism for
getting out of a "hook" function pointer unless libraries are unloaded
in reverse order of loading.  And there's no mechanism at all for undefining
a custom GUC variable, so GUC would be left with a pointer to an old value
that might or might not still be valid, and very possibly wouldn't be in
the same place anymore.

While the unload and reload behavior had some usefulness in easing
development of new loadable libraries, it's of no use whatever to normal
users, so just disabling it isn't giving up that much.  Someday we might
care to expend the effort to develop safe unload protocols; but even if
we did, there'd be little certainty that every third-party loadable module
was following them, so some security restrictions would still be needed.

Back-patch to 8.2; before that, LOAD was superuser-only anyway.

Security: unprivileged users could crash backend.  CVE not assigned yet
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/ref/load.sgml
doc/src/sgml/xfunc.sgml
src/backend/utils/fmgr/dfmgr.c