From: | Steven Niu <niushiji(at)gmail(dot)com> |
---|---|
To: | Mikhail Kot <mikhail(dot)kot(at)databricks(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Cc: | "to(at)myrrc(dot)dev" <to(at)myrrc(dot)dev> |
Subject: | 回复: Fix segfault while accessing half-initialized hash table in pgstat_shmem.c |
Date: | 2025-09-04 02:31:34 |
Message-ID: | MN2PR15MB30215EAE9A13895A53A856ACA700A@MN2PR15MB3021.namprd15.prod.outlook.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, Mikhail,
If pgstat_init_entry() errors on OOM, what would it returns to shheader, NULL?
That would bring trouble to dshash_delete_entry().
Thanks,
Steven
________________________________
发件人: Mikhail Kot <mikhail(dot)kot(at)databricks(dot)com>
已发送: 2025 年 9 月 04 日 星期四 05:39
收件人: pgsql-hackers(at)lists(dot)postgresql(dot)org <pgsql-hackers(at)lists(dot)postgresql(dot)org>
抄送: to(at)myrrc(dot)dev <to(at)myrrc(dot)dev>
主题: Re: Fix segfault while accessing half-initialized hash table in pgstat_shmem.c
Hi Michael, Steven, and Ranier,
> Anyway, couldn't we flip the order of the operations in
pgstat_init_entry() so as we do first an allocation and avoid any inconsistency
in the shared state?
The issue is not only in pgstat_init_entry(). Currently it errors on OOM but
this doesn't prevent us from calling pgstat_lock_entry() through
pgstat_get_entry_ref() which accesses a non-initialized lock.
Here's the second version of the patch. Now we remove inserted hash entry
on OOM which would prevent accessing the entry
From | Date | Subject | |
---|---|---|---|
Next Message | kasaharatt | 2025-09-04 02:31:43 | Re: Add log_autovacuum_{vacuum|analyze}_min_duration |
Previous Message | Peter Geoghegan | 2025-09-04 00:55:50 | Re: Orphan page in _bt_split |