Re: [COMMITTERS] pgsql: Fix possible crash reading pg_stat_activity.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Fix possible crash reading pg_stat_activity.
Date: 2017-01-05 18:09:32
Message-ID: CA+TgmoZMaCNopg9Hn64WDMJfJwy_zs+Gy+z603JsZXqe=iqNNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Thu, Jan 5, 2017 at 1:02 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> Not that you mention it, I think I mis-stated the problem in the
>> commit message: the problem is not if the tranche is unregistered, but
>> rather if it is registered but the pointer references an address that
>> is no longer valid. Registering the tranche with a fixed string
>> rather than a pointer into a DSM segment that can go away fixes that.
>
> Got it. That's fine then, but perhaps the comment on
> LWLockRegisterTranche needs to be reconsidered. It's not good enough for
> the tranche name to be "backend lifetime", it has to be something valid in
> other backends as well. That probably means either (1) compile-time
> constant in the core backend (not loadable modules!) or (2) allocated in
> the main shared-memory segment.

No, I think backend-lifetime is right. The tranche registrations are
all backend-local state, so there's no problem with backend A
registering a string at one address and backend B registering a string
at a different address. It's just important that neither of those
strings goes away before the corresponding backend does.

To put that another way, registration is performed separately in every backend.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2017-01-05 18:15:39 Re: [COMMITTERS] pgsql: Fix possible crash reading pg_stat_activity.
Previous Message Tom Lane 2017-01-05 18:02:58 Re: [COMMITTERS] pgsql: Fix possible crash reading pg_stat_activity.

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2017-01-05 18:12:19 Re: ALTER SYSTEM for pg_hba.conf
Previous Message Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?= 2017-01-05 18:05:56 Re: [PATCH] Add GUCs for predicate lock promotion thresholds