Re: Schema variables - new implementation for Postgres 15

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, dean(dot)a(dot)rasheed(at)gmail(dot)com, er(at)xs4all(dot)nl, joel(at)compiler(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Schema variables - new implementation for Postgres 15
Date: 2022-11-15 20:22:12
Message-ID: CAFj8pRAyDB1ADDhPhMOzF1+CVVzXCfU3HxTMFZA4mxd1BwPYXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

po 14. 11. 2022 v 8:00 odesílatel Sergey Shinderuk <
s(dot)shinderuk(at)postgrespro(dot)ru> napsal:

> On 13.11.2022 20:59, Pavel Stehule wrote:
> > fresh rebase
>
> Hello,
>
> Sorry, I haven't been following this thread, but I'd like to report a
> memory management bug. I couldn't apply the latest patches, so I tested
> with v20221104-1-* patches applied atop of commit b0284bfb1db.
>
>
> postgres=# create variable s text default 'abc';
>
> create function f() returns text as $$
> begin
> return g(s);
> end;
> $$ language plpgsql;
>
> create function g(t text) returns text as $$
> begin
> let s = 'BOOM!';
> return t;
> end;
> $$ language plpgsql;
>
> select f();
> CREATE VARIABLE
> CREATE FUNCTION
> CREATE FUNCTION
> server closed the connection unexpectedly
> This probably means the server terminated abnormally
> before or while processing the request.
>
> LOG: server process (PID 55307) was terminated by signal 11:
> Segmentation fault
> DETAIL: Failed process was running: select f();
>

should be fixed now

Thank you for check

Regards

Pavel

>
>
> I believe it's a use-after-free error, triggered by assigning a new
> value to s in g(), thus making t a dangling pointer.
>
> After reconnecting I get a scary error:
>
> postgres=# select f();
> ERROR: compressed pglz data is corrupt
>
>
> Best regards,
>
> --
> Sergey Shinderuk https://postgrespro.com/
>
>

Attachment Content-Type Size
v20221115-1-0010-documentation.patch text/x-patch 43.7 KB
v20221115-1-0008-regress-tests-for-session-variables.patch text/x-patch 60.4 KB
v20221115-1-0006-enhancing-psql-for-session-variables.patch text/x-patch 15.2 KB
v20221115-1-0007-possibility-to-dump-session-variables-by-pg_dump.patch text/x-patch 19.5 KB
v20221115-1-0009-this-patch-changes-error-message-column-doesn-t-exis.patch text/x-patch 24.2 KB
v20221115-1-0005-DISCARD-VARIABLES-command.patch text/x-patch 3.2 KB
v20221115-1-0004-support-of-LET-command-in-PLpgSQL.patch text/x-patch 11.9 KB
v20221115-1-0003-LET-command.patch text/x-patch 44.9 KB
v20221115-1-0002-session-variables.patch text/x-patch 110.6 KB
v20221115-1-0001-catalog-support-for-session-variables.patch text/x-patch 89.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-11-15 20:28:44 Re: HOT chain validation in verify_heapam()
Previous Message Andres Freund 2022-11-15 20:18:11 Re: Report checkpoint progress with pg_stat_progress_checkpoint (was: Report checkpoint progress in server logs)