Re: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, michael(at)paquier(dot)xyz, gurjeet(at)singh(dot)im, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS
Date: 2022-07-25 03:40:40
Message-ID: 20220725034040.GA4085281@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 23, 2022 at 01:23:24PM -0400, Tom Lane wrote:
> - /*
> - * process any libraries that should be preloaded at backend start (this
> - * likewise can't be done until GUC settings are complete)
> - */
> - process_session_preload_libraries();

This patch essentially moveѕ the call to
process_session_preload_libraries() to earlier in PostgresMain(). The
discussion upthread seems to indicate that this is okay. I did notice that
the log_disconnections handler won't be set up yet, so failures due to
session_preload_libraries won't be logged the same way as before. Also,
the call to pgstat_report_connect() won't happen. Neither of these strikes
me as particularly bad, but it seemed worth noting.

> + * load_session_libraries: TRUE to honor session_preload_libraries

nitpick: Should we call out local_preload_libraries here, too?

> + if (load_session_libraries)
> + process_session_preload_libraries();

I noticed that a couple of places check whether whereToSendOutput is set to
DestRemote to determine if this is an interactive session. Maybe something
like

if (whereToSendOutput == DestRemote && !am_walsender)

would be a reasonably future-proof way to avoid the need for a new
InitPostgres() argument.

Otherwise, the patch looks good to me.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-07-25 03:49:23 Re: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS
Previous Message Amit Kapila 2022-07-25 03:12:18 Re: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger