Re: AioCtl Shared Memory size fix

Matthias van de Meent <boekewurm+postgres@gmail.com>

From: Matthias van de Meent <boekewurm+postgres@gmail.com>
To: "Madhukar ." <madhukarprasad@google.com>
Cc: pgsql-hackers@postgresql.org, Vaibhav Jain <jainva@google.com>, Sangeetha Seshadri <sangsesh@google.com>, Noah Misch <nmisch@google.com>
Date: 2025-09-15T12:06:03Z
Lists: pgsql-hackers
On Mon, 15 Sept 2025 at 13:33, Madhukar . <madhukarprasad@google.com> wrote:
>
> Hi Folks,
>
> While reviewing AIO code, we found an issue with AioCtlShmemSize function. The function was not accounting for io_handles which is used post shared memory alloc in AioShmemInit.

Good catch.

Presumably this was `PgAioHandle io_handles[]` at some point, but now
that it's a pointer it's a proper part of the struct's own size, and
should be treated as such for memory accounting.

> Please find a patch to account for io_handles member of PgAioCtl.
> The patch uses sizeof(PgAioCtl) instead of offsetof(PgAioCtl, io_handles) in AioCtlShmemSize.

LGTM.


Kind regards,

Matthias van de Meent
Databricks



Commits

  1. Fix shared memory calculation size of PgAioCtl