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

fil_space_t::fil_space_t() is potentially unsafe with GCC -flifetime-dse

Details

    Description

      Starting with MDEV-8139, fil_space_t is no longer trivially constructible. In fil_space_t::create(), the object is being constructed using the following antipattern:

      	/* FIXME: if calloc() is defined as an inline function that calls
      	memset() or bzero(), then GCC 6 -flifetime-dse can optimize it away */
      	*after = space = new (ut_zalloc_nokey(sizeof(*space))) fil_space_t;
       
      	space->id = id;
       
      	UT_LIST_INIT(space->chain, &fil_node_t::chain);
       
      	space->purpose = purpose;
      	space->flags = flags;
      

      This needs to be refactored to an explicit fil_space_t::fil_space_t(), which will initialize all data fields, something like the following:

      *after = space = new (ut_malloc_nokey(*space)) fil_space_t(id, flags, purpose, crypt_data, mode);
      

      The fil_space_t::latch member will need some special care, because outside SUX_LOCK_GENERIC the implementation expects that the object be zero-initialized.

      Attachments

        Issue Links

          Activity

            marko Marko Mäkelä created issue -
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Debarun Banerjee [ JIRAUSER54513 ]
            Status In Progress [ 3 ] In Review [ 10002 ]

            The initialization of fil_space_t and other refactoring looks good to me. I have some minor comments/suggestion on the patch.

            debarun Debarun Banerjee added a comment - The initialization of fil_space_t and other refactoring looks good to me. I have some minor comments/suggestion on the patch.
            debarun Debarun Banerjee made changes -
            Assignee Debarun Banerjee [ JIRAUSER54513 ] Marko Mäkelä [ marko ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Debarun Banerjee [ JIRAUSER54513 ]
            Status Stalled [ 10000 ] In Review [ 10002 ]

            The changes look good to me. Added one comment.

            debarun Debarun Banerjee added a comment - The changes look good to me. Added one comment.
            debarun Debarun Banerjee made changes -
            Assignee Debarun Banerjee [ JIRAUSER54513 ] Marko Mäkelä [ marko ]
            Status In Review [ 10002 ] Stalled [ 10000 ]
            marko Marko Mäkelä made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Matthias Leich [ mleich ]

            I filed MDEV-35618 for an unrelated finding.

            marko Marko Mäkelä added a comment - I filed MDEV-35618 for an unrelated finding.
            marko Marko Mäkelä made changes -

            origin/10.6-MDEV-35494 1a4b97f1b4dc4ad4b71f15f98ae3a4c83cf9e300 2024-12-03T10:12:15+02:00
            performed well in RQG testing. No new problems.

            mleich Matthias Leich added a comment - origin/10.6- MDEV-35494 1a4b97f1b4dc4ad4b71f15f98ae3a4c83cf9e300 2024-12-03T10:12:15+02:00 performed well in RQG testing. No new problems.
            marko Marko Mäkelä made changes -
            issue.field.resolutiondate 2024-12-11 13:19:11.0 2024-12-11 13:19:10.588
            marko Marko Mäkelä made changes -
            Fix Version/s 10.6.21 [ 29953 ]
            Fix Version/s 10.11.11 [ 29954 ]
            Fix Version/s 11.4.5 [ 29956 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.4 [ 29301 ]
            Assignee Matthias Leich [ mleich ] Marko Mäkelä [ marko ]
            Resolution Fixed [ 1 ]
            Status In Testing [ 10301 ] Closed [ 6 ]

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.