Re: Add a permission check to pg_stat_get_backend_subxact() - Mailing list pgsql-hackers

From shihao zhong
Subject Re: Add a permission check to pg_stat_get_backend_subxact()
Date
Msg-id CAGRkXqSNCCO3Msnw3isDsshw-DO4a9gXYJTmDqaG2LofN1vo5Q@mail.gmail.com
Whole thread
In response to Re: Add a permission check to pg_stat_get_backend_subxact()  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
Hi Bertrand,

> I wonder if we should pass the copied PID to ProcNumberGetTransactionIds() and
> validate it under ProcArrayLock, following the same idea as
> pgstat_fetch_stat_backend_by_pid()?

Yes, done in v9-0002, a new patch. pgstat_read_current_status() passes the
PID it copied, and ProcNumberGetTransactionIds() reports nothing when the
PGPROC entry holds another PID. It changes an exported function, so I
would keep it for HEAD.

> I think it would make sense to add pid at the end in the backbranches (if we
> back patch it), as suggested in [1].

0001 fixes a misreport in 18, so I think it should go there too. v9 puts
the PID at the end of PgStat_Backend, and 0003 puts the user ID after it,
so the existing offsets do not change. 

0003 is v8-0002 with only that move.'

Thanks,
Shihao
Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [Patch] Fix pg_get_multixact_stats() over-reporting members on a hot standby
Next
From: shihao zhong
Date:
Subject: Re: Proposal: expose heavyweight lock wait start time in pg_stat_activity