Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24196

WITH_UBSAN runtime error: member call on null pointer of type 'struct log_phys_t'

    XMLWordPrintable

Details

    Description

      MDEV-12353 deliberately tries to avoid memory alignment overhead in log_phys_t, storing the stream of log records bytes straight after a header object. But, the code triggers WITH_UBSAN errors:

      10.5 e9b3d44c6eef3d7b4944d724ba597035798324ad

      storage/innobase/log/log0recv.cc:118:71: runtime error: member call on null pointer of type 'struct log_phys_t'
      storage/innobase/log/log0recv.cc:103:50: runtime error: member access within null pointer of type 'struct log_phys_t'
      

      It turns out that we can move the uint16_t len data member to be part of the byte stream that immediately follows the object, and use memcpy to access that. Even on systems whose ABI does not allow unaligned memory access (such as ARM or POWER) there should be no additional overhead (no actual call to memcpy()) if we use my_assume_aligned to explicitly declare the alignment.

      The motivation of this tight packing is related to MDEV-19176 and MDEV-21351, and we definitely do not want to waste 6 bytes per redo log snippet due to uint16_t len being padded to 8 bytes.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.