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

Calling mysql_library_init twice in same process SEGFAULTs

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 5.5.32
    • Fix Version/s: 5.5.33
    • Component/s: None
    • Labels:
      None
    • Environment:
      libmysqld on Linux linux-yxkl.site 3.7.10-1.16-desktop #1 SMP PREEMPT Fri May 31 20:21:23 UTC 2013 (97c14ba) x86_64 x86_64 x86_64 GNU/Linux

      Description

      Reason is that static variable init_settings struct is not reset in mysql_library_end. More detailed description below.

      Test to reproduce:

      mysql_library_init(...)
      mysql_library_end()
      mysql_library_init(...)

      In dbug.c there is a static varibale init_done. Once set to TRUE in code_state(), it remains TRUE. In code_state there is an important operations behind it, for example, setting the outfile for struct init_settings.

      if init_settings.outfile is NULL server will end up SEGFAULT due to null-pointer reference in dbug.c:_db_flush. Problem is that outfile is set to NULL when mysql_library_end is called in DBUGCloseFile. Thus, once mysql_library_end is called embedded server can't be used anymore because init_settings struct won't be reinitialized.

      The ability to use embedded server for several purposes is crucial for gateway, thus, I'd respect your insight on this.

        Attachments

          Activity

            People

            • Assignee:
              wlad Vladislav Vaintroub
              Reporter:
              vilho Vilho Raatikka
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: