https://github.com/aaronpuchert commented:

I've taken a brief look at the [Linux kernel 
changes](https://github.com/google/kernel-sanitizers/compare/2014c95afecee3e76ca4a56956a936e23283f05b...cap-analysis).
 I didn't check how many variables are affected by `__rcu_guarded`, but 
otherwise there seem to be maybe two dozen guarded variables. If you really 
didn't encounter any false positives that's not bad.

However, I'd still prefer if we could mark this as experimental, because it's a 
bit coarse:
* The address-of operation isn't interesting by itself, it merely happens to be 
required to do pass-by-reference in C.
* The equivalent of passing a `pt_guarded_by` variable by value doesn't seem to 
warn.
* The actual access itself is not checked, whether explicit or assumed behind a 
function call.

In the long term, a better approach might be:
* Extend alias tracking to pointers, perhaps restricted to those that don't 
change value.
* Warn when passing pointers to guarded variables into other functions.

https://github.com/llvm/llvm-project/pull/123063
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to