From: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | David Zhang <david(dot)zhang(at)highgo(dot)ca>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths |
Date: | 2022-07-01 15:11:05 |
Message-ID: | CAEze2Wg2eOQjddyB=+Nh=Jk45iDjNqLoT2Xn_XQn6y0F08RioQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, 21 Jun 2022 at 03:45, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> + /*
> + * Ensure that xlogreader.c can read the record by ensuring that the
> + * data section of the WAL record can be allocated.
> + */
> + if (unlikely(!AllocSizeIsValid(total_len)))
> + XLogErrorDataLimitExceeded();
>
> By the way, while skimming through the patch, the WAL reader seems to
> be a bit more pessimistic than this estimation, calculating the amount
> to allocate as of DecodeXLogRecordRequiredSpace(), based on the
> xl_tot_len given by a record.
I see, thanks for notifying me about that.
PFA a correction for that issue. It does copy over the value for
MaxAllocSize from memutils.h into xlogreader.h, because we need that
value in FRONTEND builds too, and memutils.h can't be included in
FRONTEND builds. One file suffixed with .backpatch that doesn't
include the function signature changes, but it is not optimized for
any stable branch[15].
-Matthias
PS. I'm not amused by the double copy we do in the xlogreader, as I
had expected we'd just read the record and point into that single
xl_rec_len-sized buffer. Apparently that's not how it works...
[15] it should apply to stable branches all the way back to
REL_15_STABLE and still work as expected. Any older than that I
haven't tested, but probably only require some updates for
XLogRecMaxLength in xlogreader.h.
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Add-protections-in-xlog-record-APIs-against-large.patch | application/octet-stream | 9.3 KB |
v5-0001-Add-protections-in-xlog-record-APIs-against-large.patch.backpatch | application/octet-stream | 8.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2022-07-01 15:11:36 | Re: doc: Clarify what "excluded" represents for INSERT ON CONFLICT |
Previous Message | Jacob Champion | 2022-07-01 15:08:06 | [Commitfest 2022-07] Begins Now |