| From: | Baji Shaik <baji(dot)pgdev(at)gmail(dot)com> |
|---|---|
| To: | shihao zhong <zhong950419(at)gmail(dot)com> |
| Cc: | Greg Burd <greg(at)burd(dot)me>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [PATCH] pageinspect: validate line pointers before using them |
| Date: | 2026-12-01 21:03:00 |
| Message-ID: | CA+fm-RNdTWHUzzYmVPz+nkOej9iWNwbQKAwosTMf+9eWiotsJQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Shihao,
On Sat, Nov 14, 2026 at 9:39 PM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
> If v4 still looks good to you, would you mind marking the CF entry
> Ready for Committer?
>
Thanks for working on this. I ran into this while looking at a
corrupted btree index: bt_page_stats() didn't report the bad page, it
just returned stats computed from it (and fails an assertion on an
assert-enabled build).
I tested v4 and it fixes the crashes for me, but bt_page_stats() and
bt_multi_page_stats() are not covered. They go through
GetBTPageStatistics(), which adds up the tuple sizes of every line
pointer without checking them. With a zeroed line pointer on a btree
leaf, bt_page_items() now gives an error, but bt_page_stats() on the
same page still fails Assert("ItemIdHasStorage(itemId)").
The attached 0003 adds the same check you use in bt_page_print_tuples()
to GetBTPageStatistics(). It applies on top of v4. I named it .nocfbot
so cfbot keeps testing your series; feel free to fold it into v5.
A few smaller things:
- 0002 needs a rebase.
- The new line pointer checks and verify_page_header() use
ERRCODE_INVALID_PARAMETER_VALUE, but the posting list and pivot tuple
checks use ERRCODE_DATA_CORRUPTED, which heapfuncs.c also uses for
this. I think they should all be DATA_CORRUPTED. (I kept
INVALID_PARAMETER_VALUE in 0003 to match the rest of v4.)
Thanks,
Baji Shaik
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0003-pageinspect-check-line-pointers-in-bt_page_stats-and.patch.nocfbot | application/octet-stream | 1.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | David Rowley | 2026-12-01 21:08:24 | Re: Should we add timing output to pg_upgrade? |
| Previous Message | Nathan Bossart | 2026-12-01 20:40:02 | Re: pg_restore --format= option(without any value) should report an error as pg_dump is reporting an error |