postgres.git / summary / log / commit / refs

commit    df0f4feef8de933be61ce3e73142c82c37b17fa4
Author:   David Rowley <drowley@postgresql.org>
Date:     Mon Aug 29 11:20:25 2022 +0000
First released in: master (reverted before release)
Reverted by: 5495796ad12a (in 16.0)

    Add missing padding from MemoryChunk struct
    
    Buildfarm animals skate, grison and mamba are Assert failing on the
    pointer being given to repalloc not being MAXALIGNED.  c6e0fe1f2a made
    changes in that area.
    
    All of these animals are 32-bit with a MAXIMUM_ALIGNOF of 8 and a
    SIZEOF_VOID_P of 4.  I suspect that the pointer is not properly aligned due
    to the lack of padding in the MemoryChunk struct.
    
    Here we add the same type of padding that was previously used in
    AllocChunkData and GenerationChunk that c6e0fe1f2a neglected to add.
    
    Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com


src/include/utils/memutils_memorychunk.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/include/utils/memutils_memorychunk.h b/src/include/utils/memutils_memorychunk.h index 685c177b681..1e27d084cd4 100644 --- a/src/include/utils/memutils_memorychunk.h +++ b/src/include/utils/memutils_memorychunk.h @@ -111,6 +111,14 @@ typedef struct MemoryChunk { #ifdef MEMORY_CONTEXT_CHECKING Size requested_size; +#define MEMORYCHUNK_RAWSIZE (SIZEOF_SIZE_T + 8) +#else +#define MEMORYCHUNK_RAWSIZE 8 +#endif /* MEMORY_CONTEXT_CHECKING */ + + /* ensure proper alignment by adding padding if needed */ +#if (MEMORYCHUNK_RAWSIZE % MAXIMUM_ALIGNOF) != 0 + char padding[MAXIMUM_ALIGNOF - MEMORYCHUNK_RAWSIZE % MAXIMUM_ALIGNOF]; #endif /* bitfield for storing details about the chunk */ [parent: c6a43c25a8ba]