Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  2. ZBXNEXT-2895

Dynamically adjust alignment in shared memory allocators


      Correction for ZBX-5289 and ZBX-5382 introduced manual padding in some structures to avoid crashes on Sparc (Solaris) and Itanium (HP-UX) when agent was compiled with GCC and optimization turned on.

      This solution is not satisfactory as programmers have to readjust the padding for each modification of the top level or encapsulated structures and check it's correctness on all supported platforms.

      Instead we can readjust the size of the allocated structures in the custom memory allocators that we have (SysV shared memory ones) according to the platform's alignment requirements.

      Additionally we must check whether GCC violates Sparc ABI in regards to structure member access as starting from version 3 it has -mfaster-structs command line argument which breaks Sparc ABI. The symptoms for ZBX-5289 (crash upon structure access with std instruction) matches the description of this argument. It could be that GCC turns this argument on for optimization. If this is indeed true then we should somehow warn our customers about such compiler behaviour.


      With -mfaster-structs, the compiler assumes that structures should have 8 byte alignment. This enables the use of pairs of ldd and std instructions for copies in structure assignment, in place of twice as many ld and st pairs. However, the use of this changed alignment directly violates the SPARC ABI. Thus, it's intended only for use on targets where the developer acknowledges that their resulting code will not be directly in line with the rules of the ABI.

            Unassigned Unassigned
            sandis.neilands Sandis Neilands (Inactive)
            0 Vote for this issue
            2 Start watching this issue