Re: Potential security risk associated with function call

From: Mark Woodward <woodwardm(at)google(dot)com>
To: Nico Williams <nico(at)cryptonector(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Jet <zhangchenxi(at)halodbtech(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Potential security risk associated with function call
Date: 2026-03-10 17:42:58
Message-ID: CAE0x3Mm5wFsW0OBaAx0Nj2-kufZrUAk=wO1vGtN6j-gSBHA+JA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 10, 2026 at 12:19 PM Nico Williams <nico(at)cryptonector(dot)com>
wrote:

> On Tue, Mar 10, 2026 at 09:23:50AM -0400, Robert Haas wrote:
> > [...]. The example that started this thread is
> > essentially unpreventable, because we need CREATE FUNCTION to be
> > possible and we need the superuser to tell us what the C code is
> > expecting, but the number of people who go tinkering with catalog
> > contents manually without fully understanding the consequences seems
> > to be much larger than I would have thought, even if the tinkering is
> > usually less dramatic than this example.
>
> If DWARF is available you could always get the C function's
> prototype from that, and sanity-check it. But DWARF really bloats
> shared objects, and it's not universal, so it's not a good solution.
>
> C is just a crappy language. You play with fire, you best know what
> you're doing -- that's a reasonable policy. And since PG is written in
> C, and users do have C-coded extensions here and there, playing with
> fire has to be supported.
>

I'm really tired of "C" bashing. The C programming language is a tool.
Effective and powerful tools can be dangerous, but the productivity is
worth it. The problem isn't the "C" language, it is with people who try to
program in C but do not know C.

>
> It'd be clever if there was at least a standard for a subset of DWARF
> that provides just the types information (but not, e.g., stack
> unwinding) so that we could have some sort of standard reflection
> support in C. That would be for the C standards committee.
>

Why do we need that?

> Nico
> --
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2026-03-10 17:53:46 MERGE PARTITIONS and DEPENDS ON EXTENSION.
Previous Message Laurenz Albe 2026-03-10 17:42:06 Re: Change initdb default to the builtin collation provider