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.c: trace_access_{lock,unlock}: expression resolution issue and conditional locking and unlocking #143

Open bulwahn opened 4 years ago

bulwahn commented 4 years ago
kernel/trace/trace.c:670:3: warning: cannot resolve lock expression [-Wthread-safety-analysis]
                mutex_lock(&per_cpu(cpu_access_lock, cpu));
                ^~~~~~~~~~
kernel/trace/trace.c:679:3: warning: cannot resolve lock expression [-Wthread-safety-analysis]
                mutex_unlock(&per_cpu(cpu_access_lock, cpu));
                ^~~~~~~~~~~~

clang thread safety analysis seems to have problems interpreting the per_cpu macro. As far as for the analysis relevant, this per_cpu(lock, cpu) could just be simplified to lock. Even if that would be addressed, traceaccess{lock,unlock} are further conditional locking & unlocking functions.