• Praveenkumar Hulakund's avatar
    Bug#11765252 - READ OF FREED MEMORY WHEN "USE DB" AND · 3b1e98d2
    Praveenkumar Hulakund authored
                   "SHOW PROCESSLIST"
    
    Analysis:
    ----------
    The problem here is, if one connection changes its
    default db and at the same time another connection executes
    "SHOW PROCESSLIST", when it wants to read db of the another
    connection then there is a chance of accessing the invalid
    memory. 
    
    The db name stored in THD is not guarded while changing user
    DB and while reading the user DB in "SHOW PROCESSLIST".
    So, if THD.db is freed by thd "owner" thread and if another
    thread executing "SHOW PROCESSLIST" statement tries to read
    and copy THD.db at the same time then we may endup in the issue
    reported here.
    
    Fix:
    ----------
    Used mutex "LOCK_thd_data" to guard THD.db while freeing it
    and while copying it to processlist.
    3b1e98d2
sql_show.cc 243 KB