pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Dynamic shared memory areas
Date: Wed, 22 Oct 2025 12:27:54 -0400
Message-ID: <799984.1761150474@sss.pgh.pa.us> (raw )
In-Reply-To: <CA+TgmoZ5XfRREzBxkDbb3oyqp3vN97u-jpeFBivRBJrKQUumFw@mail.gmail.com >
References: <CAEepm=1z5WLuNoJ80PaCvz6EtG9dN0j-KuHcHtU6QEfcPP5-qA@mail.gmail.com >
<CAEepm=2nU3x3573kzW_pgyWvs3ZBuC-OqM=V_2edvk8maf4AOA@mail.gmail.com >
<CAFiTN-t9fmNRUsw2+go1rchR90eezcygq6LN-TjsiPiENZEUdQ@mail.gmail.com >
<CAEepm=024p-MeAsDmG=R3+tR4EGhuGJs_+rjFKF0eRoSTmMJnA@mail.gmail.com >
<CAEepm=2Uiyn7iLR6cc4xuoOwU5+oQ_JrK_VzqfEf2DbDpZD3Ow@mail.gmail.com >
<CAEepm=3TkRkdFRCb+2FCcqj2bXa3ZCjXtyW-Y6Qwdj-xHJ5cwQ@mail.gmail.com >
<CA+TgmoYkdKrAB8p+m_YkGRew2xXt5nHD-fRqOGVkn5k=kOyDPA@mail.gmail.com >
<CAEepm=0-pbokaQdCXhtYn=w64MmdJz4hYW7qcSU235ar276x7w@mail.gmail.com >
<CA+TgmoZpSA21XUykhYb8mpO5t97=vxHeaAEobFawHgnkMrJMXg@mail.gmail.com >
<CA+TgmoYFSbn9Xr+9PGiJ7hWPh2Krrsqw=tYcJGzX+kjYmM0NRA@mail.gmail.com >
<CAEepm=3U7+Ro7=ECeQuAZoeFXs8iDVX56NXGCV7z3=+H+Wd0Sw@mail.gmail.com >
<CA+TgmoZ5XfRREzBxkDbb3oyqp3vN97u-jpeFBivRBJrKQUumFw@mail.gmail.com >
[ blast-from-the-past department ]
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Dec 1, 2016 at 6:33 AM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> Please find attached dsa-v8.patch, and also a small test module for
>> running random allocate/free exercises and dumping the internal
>> allocator state.
> OK, I've committed the main patch.
Our shiny new version of Coverity kvetches about
FreePageBtreeInsertInternal:
*** CID 1667414: (OVERRUN)
/srv/coverity/git/pgsql-git/postgresql/src/backend/utils/mmgr/freepage.c: 908 in FreePageBtreeInsertInternal()
902 {
903 Assert(btp->hdr.magic == FREE_PAGE_INTERNAL_MAGIC);
904 Assert(btp->hdr.nused <= FPM_ITEMS_PER_INTERNAL_PAGE);
905 Assert(index <= btp->hdr.nused);
906 memmove(&btp->u.internal_key[index + 1], &btp->u.internal_key[index],
907 sizeof(FreePageBtreeInternalKey) * (btp->hdr.nused - index));
>>> CID 1667414: (OVERRUN)
>>> Overrunning array "btp->u.internal_key" of 254 16-byte elements at element index 254 (byte offset 4079) using index "index" (which evaluates to 254).
908 btp->u.internal_key[index].first_page = first_page;
909 relptr_store(base, btp->u.internal_key[index].child, child);
910 ++btp->hdr.nused;
911 }
I believe the reason is that the second Assert is wrong, and it
should instead be
904 Assert(btp->hdr.nused < FPM_ITEMS_PER_INTERNAL_PAGE);
to assert that there is room for the item we are about to insert.
The same thinko exists in FreePageBtreeInsertLeaf, although
for some reason Coverity isn't whining about that.
Thoughts?
regards, tom lane
view thread (22+ messages) latest in thread
Message-ID: <799984.1761150474@sss.pgh.pa.us>
Permalink: ../799984.1761150474@sss.pgh.pa.us/
Also on: postgresql.org/message-id/799984.1761150474@sss.pgh.pa.us
copy link · copy postgr.es
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, thomas.munro@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Dynamic shared memory areas
In-Reply-To: <799984.1761150474@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox