pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix relptr's encoding of the base address.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix relptr's encoding of the base address.
@ 2022-06-27 01:11 Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Thomas Munro @ 2022-06-27 01:11 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix relptr's encoding of the base address.

Previously, we encoded both NULL and the first byte at the base address
as 0.  That confusion led to the assertion in commit e07d4ddc, which
failed when min_dynamic_shared_memory was used.  Give them distinct
encodings, by switching to 1-based offsets for non-NULL pointers.  Also
improve macro hygiene in passing (missing/misplaced parentheses), and
remove open-coded access to the raw offset value from freepage.c/h.

Although e07d4ddc was back-patched to 10, the only code that actually
makes use of relptr at the base address arrived in 84b1c63a, so no need
to back-patch further than 14 for now.

Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/20220519193839.GT19626%40telsasoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7201cd18627afc64850537806da7f22150d1a83b

Modified Files
--------------
src/backend/utils/mmgr/freepage.c |  6 +++---
src/include/utils/freepage.h      |  4 ++--
src/include/utils/relptr.h        | 15 +++++++++------
3 files changed, 14 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix relptr's encoding of the base address.
@ 2022-06-27 01:11 Thomas Munro <tmunro@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Thomas Munro @ 2022-06-27 01:11 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix relptr's encoding of the base address.

Previously, we encoded both NULL and the first byte at the base address
as 0.  That confusion led to the assertion in commit e07d4ddc, which
failed when min_dynamic_shared_memory was used.  Give them distinct
encodings, by switching to 1-based offsets for non-NULL pointers.  Also
improve macro hygiene in passing (missing/misplaced parentheses), and
remove open-coded access to the raw offset value from freepage.c/h.

Although e07d4ddc was back-patched to 10, the only code that actually
makes use of relptr at the base address arrived in 84b1c63a, so no need
to back-patch further than 14 for now.

Reported-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/20220519193839.GT19626%40telsasoft.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/99504ff8265eac35da5af06f4ce99196bbdc0239

Modified Files
--------------
src/backend/utils/mmgr/freepage.c |  6 +++---
src/include/utils/freepage.h      |  4 ++--
src/include/utils/relptr.h        | 15 +++++++++------
3 files changed, 14 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-06-27 01:11 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-06-27 01:11 pgsql: Fix relptr's encoding of the base address. Thomas Munro <tmunro@postgresql.org>
2022-06-27 01:11 pgsql: Fix relptr's encoding of the base address. Thomas Munro <tmunro@postgresql.org>

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