| From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> | 
|---|---|
| To: | michael(at)paquier(dot)xyz | 
| Cc: | a(dot)kozhemyakin(at)postgrespro(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org | 
| Subject: | Re: BUG #17280: global-buffer-overflow on select from pg_stat_slru | 
| Date: | 2021-11-12 07:25:46 | 
| Message-ID: | 20211112.162546.804840249267031436.horikyota.ntt@gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
At Thu, 11 Nov 2021 17:08:34 +0900, Michael Paquier <michael(at)paquier(dot)xyz> wrote in 
> On Thu, Nov 11, 2021 at 12:19:09PM +0900, Kyotaro Horiguchi wrote:
> > I'm not sure which is easier to read, but it might be a bit hard since
> > the conditino term in not mention counter itself. I don't object to
> > that way.  And, yes SLRU_NUM_ELEMENTS cannot be used here:p
> > 
> > The attached is the first way in the choices.
>
> That looks fine.
> 
> Also, what do you think about adding a test in sysviews.sql? This
> could be as simple as that:
> SELECT count(*) > 0 AS ok FROM pg_stat_slru;
Rahter it is touching only pg_stat_wal and pg_stat_walreceiver among
42 pg_stat_* views. However I agree to it is good to add it for the
reason mentioned below.
> I am not sure if the buildfarm animals running valgrind would have
> caught this issue, but having something would be better than nothing
> for this case.
Valgrind didn't detect that for me (-O0).  The address area accessed
by the overun is allocated to other variables.  That being said.  I
agree that causing access to the full range of the variable should
help checker tools. And that ends in a time shorter than a blink.
Please find the attached.
regrds.
-- 
Kyotaro Horiguchi
NTT Open Source Software Center
| Attachment | Content-Type | Size | 
|---|---|---|
| v2-0001-Fix-memory-overrun-of-pg_stat_get_slru.patch | text/x-patch | 2.5 KB | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Alexander Kukushkin | 2021-11-12 07:47:01 | Re: BUG #17245: Index corruption involving deduplicated entries | 
| Previous Message | Peter Geoghegan | 2021-11-12 05:46:35 | Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum |