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

kernel/trace/trace_uprobe.c: probe_buffer_{get,put}: needs annotation with reference to return value #147

Open bulwahn opened 4 years ago

bulwahn commented 4 years ago
kernel/trace/trace_uprobe.c:772:1: warning: mutex 'ucb->mutex' is still held at the end of function [-Wthread-safety-analysis]
}
^
kernel/trace/trace_uprobe.c:769:2: note: mutex acquired here
        mutex_lock(&ucb->mutex);
        ^
kernel/trace/trace_uprobe.c:776:2: warning: releasing mutex 'ucb->mutex' that was not held [-Wthread-safety-analysis]
        mutex_unlock(&ucb->mutex);
        ^

The get function would need to annotate with reference to the return value, which clang does not support. The put function could be annotated, but we silence it because without proper annotation for get, the analysis will not work properly.