Skip to content
  • Tatiana Azundris Nuernberg's avatar
    69b75d3d
    Bug#30569003: 5.7 REPLICATION BREAKAGE WITH SYNTAX ERROR WITH GRANT MANAGEMENT · 69b75d3d
    Tatiana Azundris Nuernberg authored
    The server creates a rewritten query with sensitive information
    such as passwords obfuscated. Various functions in sql_user.cc
    and sql_authorization.cc caused a second rewrite to happen (this
    time to include hashed passwords for use in the binlog). This
    freed and reassigned the rewritten_query on the THD. This could
    lead to problems when SHOW PROCESSLIST in another thread had
    already obtained a pointer to the old value. Vice versa,
    re-allocation could also happen in SHOW PROCESSLIST's c_ptr_safe()
    while the user/auth code was assembling a rewritten query. This
    was possible because of the aforementioned functions, only
    SHOW PROCESSLIST obtained a lock.
    
    This patch fixes the immediate problem by making rewritten_query
    on the THD private and adding a (const) getter and a setter (that
    acquire LOCK_thd_query) to make the interface clearer and safer
    to prevent similar issues in the future. This also means that
    while a rewritten query may be assembled in several steps, it
    is now only updated on the THD once complete.
    
    Approved by: Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com>
    69b75d3d
    Bug#30569003: 5.7 REPLICATION BREAKAGE WITH SYNTAX ERROR WITH GRANT MANAGEMENT
    Tatiana Azundris Nuernberg authored
    The server creates a rewritten query with sensitive information
    such as passwords obfuscated. Various functions in sql_user.cc
    and sql_authorization.cc caused a second rewrite to happen (this
    time to include hashed passwords for use in the binlog). This
    freed and reassigned the rewritten_query on the THD. This could
    lead to problems when SHOW PROCESSLIST in another thread had
    already obtained a pointer to the old value. Vice versa,
    re-allocation could also happen in SHOW PROCESSLIST's c_ptr_safe()
    while the user/auth code was assembling a rewritten query. This
    was possible because of the aforementioned functions, only
    SHOW PROCESSLIST obtained a lock.
    
    This patch fixes the immediate problem by making rewritten_query
    on the THD private and adding a (const) getter and a setter (that
    acquire LOCK_thd_query) to make the interface clearer and safer
    to prevent similar issues in the future. This also means that
    while a rewritten query may be assembled in several steps, it
    is now only updated on the THD once complete.
    
    Approved by: Praveenkumar Hulakund <praveenkumar.hulakund@oracle.com>
Loading