pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tv@fuzzy.cz>
To: pgsql-hackers@postgreSQL.org
Subject: why local_preload_libraries does require a separate directory ?
Date: Sat, 03 Dec 2011 15:56:46 +0100
Message-ID: <4EDA38AE.5030003@fuzzy.cz> (raw)

Hi,

why the libraries loaded using local_preload_libraries need to be placed
in a different subdirectory than libraries loaded using
shared_preload_libraries?

And why it does not use dynamic_library_path but a hardcoded path
'$libdir/plugins'?

I do understand that leaving the users to load whatever libraries they
want is a bad idea, but when the library is loaded from postgresql.conf
it should be safe.

Therefore I'd expect / propose this behaviour:

1) libs loaded from shared_preload_libraries/local_preload_libraries

   - any paths are allowed (relative and absolute)
   - relative paths are resolved using dynamic_library_path if
     specified, $libdir otherwise
   - absolute paths are allowed, may load libraries from other locations

2) libs loaded using LOAD

   - check that the library is loaded from dynamic_library_path (if
     specified), $libdir otherwise


AFAIK this prevents '..' type attacks and makes it easier to install
extensions (shared libs are installed to $libdir, so if you need to load
a library using local_preload_libraries, you have to copy it manually).

Tomas



view thread (8+ messages)  latest in thread

Message-ID: <4EDA38AE.5030003@fuzzy.cz>
Permalink:  ../4EDA38AE.5030003@fuzzy.cz/
Also on:    postgresql.org/message-id/4EDA38AE.5030003@fuzzy.cz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tv@fuzzy.cz
  Subject: Re: why local_preload_libraries does require a separate directory ?
  In-Reply-To: <4EDA38AE.5030003@fuzzy.cz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox