summaryrefslogtreecommitdiffhomepage
path: root/tools/checklocks/README.md
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2021-11-02 18:01:24 -0700
committergVisor bot <gvisor-bot@google.com>2021-11-02 18:04:26 -0700
commit7551b0590d87588deda562a959e09ada425bfea5 (patch)
treeebf5e58fd75233e06cbf7edbb26b1f8d1ae854a7 /tools/checklocks/README.md
parenta8eb1895bbc4e1d41cdd621b8eca3f3e4912a446 (diff)
Minor checklocks improvements.
* Support sync.Locker. * Prevent runaway recursion when locks are acquired in a loop. * Allowing ignoring of anonymous functions (inherited from parent function). * Add support for aliases. PiperOrigin-RevId: 407221521
Diffstat (limited to 'tools/checklocks/README.md')
-rw-r--r--tools/checklocks/README.md25
1 files changed, 1 insertions, 24 deletions
diff --git a/tools/checklocks/README.md b/tools/checklocks/README.md
index bd4beb649..eaad69399 100644
--- a/tools/checklocks/README.md
+++ b/tools/checklocks/README.md
@@ -1,6 +1,6 @@
# CheckLocks Analyzer
-<!--* freshness: { owner: 'gvisor-eng' reviewed: '2021-03-21' } *-->
+<!--* freshness: { owner: 'gvisor-eng' reviewed: '2021-10-15' } *-->
Checklocks is an analyzer for lock and atomic constraints. The analyzer relies
on explicit annotations to identify fields that should be checked for access.
@@ -100,29 +100,6 @@ func abc() {
### Explicitly Not Supported
-1. Checking for embedded mutexes as sync.Locker rather than directly as
- 'sync.Mutex'. In other words, the checker will not track mutex Lock and
- Unlock() methods where the mutex is behind an interface dispatch.
-
-An example that we won't handle is shown below (this in fact will fail to
-build):
-
-```go
-type A struct {
- mu sync.Locker
-
- // +checklocks:mu
- x int
-}
-
-func abc() {
- mu sync.Mutex
- a := A{mu: &mu}
- a.x = 1 // This won't be flagged by copylocks checker.
-}
-
-```
-
1. The checker will not support guards on anything other than the cases
described above. For example, global mutexes cannot be referred to by
checklocks. Only struct members can be used.