• Monty's avatar
    MENT-1707 Crash at reload_acl_and_cache · 9e424b62
    Monty authored
    The stack function trace for this bug is:
    
    libc
    my_free
    free_root
    acl_reload
    
    The crash happens because acl_memroot gets corrupted.
    
    The issue was that during FLUSH PRIVILEGES we discard the old
    privileges and create new ones. We have protection in place that no
    one can accesses the privileges during this time.
    
    However one short piece of code called during login of a new user, or
    change password, was not properly protected, which could in some very
    rare circumstances case a memory overwrite of a MEMROOT object if
    at the same time another thread calls FLUSH PRIVILEGES.
    
    This it issue is fixed by adding protection around set_user_salt().
    I also added asserts to other code that is using the acl_memroot to
    ensure that it is properly proteced everywhere.
    9e424b62
sql_acl.cc 444 KB