]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Suppress missing_lock false positives reported by Coverity static analysis
authorKruti Pendharkar <kp025370@broadcom.com>
Fri, 17 Oct 2025 04:25:49 +0000 (21:25 -0700)
committerKruti Pendharkar <kp025370@broadcom.com>
Fri, 17 Oct 2025 04:25:49 +0000 (21:25 -0700)
Issues:
- Accessing gHandler.wakeupFd.fd without holding lock
  g__gLock_lock. Elsewhere, _GPollFD.fd is written to with >g__gLock_lock
  held 1 out of 1 times.

  `ssize_t nbytes = read(gHandler.wakeupFd.fd, &info, sizeof info);`

  False positive: this is only called from the (single) polling thread.

- Accessing gHandler.wakeupPipe without holding lock
  g__gLock_lock. Elsewhere, SignalHandler.wakeupPipe is written >to with
  g__gLock_lock held 1 out of 1 times.

  `bytes = write(gHandler.wakeupPipe[1], info, sizeof *info);`

  False positive: Linux signals are delivered one at a time sequentially
  to an eligible thread in the process. While a signal handler is
  executing, other signals, including the one being handled, are blocked
  to prevent re-entrance issues.

open-vm-tools/libvmtools/signalSource.c

index 6f590e8b0c43585a7e24f6b0415af924d53e9f9d..4a485c5b708a3634c842ec0b9ca64db793ab64b7 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2008-2016,2019 VMware, Inc. All rights reserved.
+ * Copyright (c) 2008-2025 Broadcom. All Rights Reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -77,6 +78,10 @@ SignalSourceReadSigInfo(void)
 {
    if (gHandler.wakeupFd.revents & G_IO_IN) {
       siginfo_t info;
+      /*
+       * Called by the polling thread only. Refer to PR 3555868 Update #1
+       */
+      /* coverity[missing_lock] */
       ssize_t nbytes = read(gHandler.wakeupFd.fd, &info, sizeof info);
 
       if (nbytes == -1) {
@@ -130,6 +135,11 @@ SignalSourceSigHandler(int signum,
       dummy.si_signo = signum;
       info = &dummy;
    }
+   /*
+    * Linux signals are delivered sequentially, one at a time, to an eligible
+    * thread within a process. Refer to PR 3555868 Update #1
+    */
+   /* coverity[missing_lock] */
    bytes = write(gHandler.wakeupPipe[1], info, sizeof *info);
 
    if (bytes == -1) {