Commit 751e3e6b authored by Andrew Dunstan's avatar Andrew Dunstan

Force plperl and plperlu to run in separate interpreters. Create an error

on an attempt to create the second interpreter if this is not supported by
the perl installation. Per recent -hackers discussion.
parent dc10387e
<!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.58 2006/10/23 18:10:31 petere Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/plperl.sgml,v 2.59 2006/11/13 17:13:56 adunstan Exp $ -->
<chapter id="plperl"> <chapter id="plperl">
<title>PL/Perl - Perl Procedural Language</title> <title>PL/Perl - Perl Procedural Language</title>
...@@ -646,6 +646,25 @@ $$ LANGUAGE plperl; ...@@ -646,6 +646,25 @@ $$ LANGUAGE plperl;
If the above function was created by a superuser using the language If the above function was created by a superuser using the language
<literal>plperlu</>, execution would succeed. <literal>plperlu</>, execution would succeed.
</para> </para>
<note>
<para>
For security reasons, to stop a leak of privileged operations from
<application>PL/PerlU</> to <application>PL/Perl</>, these two languages
have to run in separate instances of the Perl interpreter. If your
Perl installation has been appropriately compiled, this is not a problem.
However, not all installations are compiled with the requisite flags.
If <productname>PostgreSQL</> detects that this is the case then it will
not start a second interpreter, but instead create an error. In
consequence, in such an installation, you cannot use both
<application>PL/PerlU</> and <application>PL/Perl</> in the same backend
process. The remedy for this is to obtain a Perl installation created
with the appropriate flags, namely either <literal>usemultiplicity</> or
both <literal>usethreads</> and <literal>useithreads</>.
For more details,see the <literal>perlembed</> manual page.
</para>
</note>
</sect1> </sect1>
<sect1 id="plperl-triggers"> <sect1 id="plperl-triggers">
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.482 2006/11/06 17:00:27 tgl Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.483 2006/11/13 17:13:56 adunstan Exp $ -->
<!-- <!--
Typical markup: Typical markup:
...@@ -407,6 +407,21 @@ links to the main documentation. ...@@ -407,6 +407,21 @@ links to the main documentation.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
Data can no longer be shared between a PL/Perl function and a
PL/PerlU function, and modules used by a /PerlU function are no
longer available to PL/Perl functions.
</para>
<para>
Some perl installations have not been compiled with the correct flags
to allow multiple interpreters to exist within a single process.
In this situation PL/Perl and PL/PerlU cannot both be used in a
single backend. The solution is to get a Perl installation which
supports multiple interpreters. (Andrew)
</para>
</listitem>
<listitem> <listitem>
<para> <para>
In <filename>contrib/xml2/</>, rename <function>xml_valid()</> to In <filename>contrib/xml2/</>, rename <function>xml_valid()</> to
...@@ -1743,8 +1758,21 @@ links to the main documentation. ...@@ -1743,8 +1758,21 @@ links to the main documentation.
<para> <para>
Previously, it was lexical, which caused unexpected sharing Previously, it was lexical, which caused unexpected sharing
violations. violations.
</para> </para>
</listitem> </listitem>
<listitem>
<para>
Run PL/Perl and PL/PerlU in separate interpreters, for security
reasons.
</para>
<para>
In consequence, they can no longer share data nor loaded modules.
Also, if Perl has not been compiled with the requisite flags to
allow multiple interpreters, only one of these lamguages can be used
in any given backend process. (Andrew)
</para>
</listitem>
</itemizedlist> </itemizedlist>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment