Re: AioCtl Shared Memory size fix

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: "Madhukar (dot)" <madhukarprasad(at)google(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Vaibhav Jain <jainva(at)google(dot)com>, Sangeetha Seshadri <sangsesh(at)google(dot)com>, Noah Misch <nmisch(at)google(dot)com>
Subject: Re: AioCtl Shared Memory size fix
Date: 2025-09-15 12:06:03
Message-ID: CAEze2WjYnqDQ+94z2zB7j_q7Ta+ySy65Jyo8fYfQTVQ0Oba3eA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 15 Sept 2025 at 13:33, Madhukar . <madhukarprasad(at)google(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-09-15 12:10:58 Re: Conflict detection for update_deleted in logical replication
Previous Message David Rowley 2025-09-15 11:23:06 Re: Fix missing EvalPlanQual recheck for TID scans