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

Unaligned pointers in perconaFT

Details

    • Bug
    • Status: Done
    • Medium
    • Resolution: Fixed
    • 5.6.38-83.0, 5.7.20-18
    • 5.6.39-83.1, 5.7.21-20
    • TokuDB
    • 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
      • ?

       

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Smart Checklist