ClangBuiltLinux / thread-safety-analysis

A research project into applying Clang's Thread Safety Analysis to the Linux Kernel
Other
6 stars 0 forks source link

fs/exec.c: prepare_bprm_creds, free_bprm: conditional unlock function #8

Open bulwahn opened 5 years ago

bulwahn commented 5 years ago
fs/exec.c:1416:1: warning: mutex 'get_current().signal->cred_guard_mutex' is not held on every path through here [-Wthread-safety-analysis]
}
^
fs/exec.c:1407:6: note: mutex acquired here
        if (mutex_lock_interruptible(&current->signal->cred_guard_mutex))
            ^
fs/exec.c:1422:3: warning: releasing mutex 'get_current().signal->cred_guard_mutex' that was not held [-Wthread-safety-analysis]
                mutex_unlock(&current->signal->cred_guard_mutex);
                ^
bulwahn commented 5 years ago

We cannot annotate this function, but the whole locking and unlocking is spread rather complicated over the different function, so some refactoring might be worthwhile anyway. It needs a deeper look to even understand how the different functions, locking and unlocking the cred_guard_mutex can interact.