Re: [Pljava-dev] Re: Should creating a new base type require superuser status?

From: Kris Jurka <books(at)ejurka(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Thomas Hallgren <thomas(at)tada(dot)se>, pljava-dev(at)pgfoundry(dot)org, pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: [Pljava-dev] Re: Should creating a new base type require superuser status?
Date: 2009-02-18 05:43:38
Message-ID: Pine.BSO.4.64.0902180027280.24644@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pljava-dev

On Sat, 2 Aug 2008, Tom Lane wrote:

> So what exactly does happen when the user deliberately specifies wrong
> typlen/typbyval/typalign info when creating a type based on PL/Java
> functions?

I have reviewed pljava's handling of misrepresented alignment, length, and
by value parameters

1) Alignment: pljava reads and writes data a byte at a time, so all types
effectively have char alignment. Reading an integer will read
four bytes out of memory and then put those together. Therefore the
alignment cannot be misspecified.

2) Length: For fixed length types, pljava correctly detects trying to
read or write too much data and not supplying enough data on write.
Pljava does not correctly handle variable length types. It should be
setting and reading the length header itself rather than leaving that up
to the user, but it is not.

3) By value: pljava does not correctly handle passed by value types
correctly, allowing access to random memory.

So yes, pljava has a security problem, but I still object to the statement
that no PL can do this securely. I will work on fixing pljava, but I
request the change for superuser requirement for type creation be
reverted. The fact that no PL currently does it correctly is not a reason
to prohibit a PL from doing it correctly.

Kris Jurka

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Hallgren 2009-02-18 06:07:11 Re: [Pljava-dev] Re: Should creating a new base type require superuser status?
Previous Message Robert Haas 2009-02-18 05:23:37 Re: The science of optimization in practical terms?

Browse pljava-dev by date

  From Date Subject
Next Message Thomas Hallgren 2009-02-18 06:07:11 Re: [Pljava-dev] Re: Should creating a new base type require superuser status?
Previous Message Edwin Ramirez 2009-02-10 15:05:23 [Pljava-dev] Pl/Java Installation Help Needed