Uploaded image for project: 'Percona Server'
  1. Percona Server
  2. PS-4284

Unaligned pointers in perconaFT

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 5.7.20-18, 5.6.38-83.0
    • Fix Version/s: 5.7.21-20, 5.6.39-83.1
    • Component/s: TokuDB
    • Labels:
      None

      Description

      In omt.cc, we take an address of a data member in a templated function:

      https://github.com/percona/PerconaFT/blob/416a28e514ddd8918465d186c44b408f426f621c/util/omt.cc#L762?

      This function is instantiated with an instance of omt_node_templated:

      https://github.com/percona/PerconaFT/blob/91273dbcebaa682c72b48bd0917ad2e4efc291d8/util/omt.h#L195

      Where the omtdata_t member is a referenced_xid_tuple, which is an 8 byte aligned type currently.

      Because of the packing/alignment of omt_node_templated, the value member is potentially unaligned, and taking the address of an unaligned data member is undefined behavior and a potential crash source on some platforms. Clang reports a warning about this.

      We have several possible solutions:

      • Silence the warning, as this shouldn't cause any issues on x86
      • Remove the packing/alignment attributes from omt_node_templated
      • Relax the alignment requirements of referenced_xid_tuple
      • ?

       

        Smart Checklist

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  zsolt.parragi Zsolt Parragi
                  Reporter:
                  zsolt.parragi Zsolt Parragi
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: