From: Kruti Pendharkar Date: Fri, 17 Oct 2025 04:25:49 +0000 (-0700) Subject: Suppress missing_lock false positives reported by Coverity static analysis X-Git-Tag: stable-13.1.0~65 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5157f899aef66cb58ac2df8263cafc84345fb831;p=thirdparty%2Fopen-vm-tools.git Suppress missing_lock false positives reported by Coverity static analysis 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. --- diff --git a/open-vm-tools/libvmtools/signalSource.c b/open-vm-tools/libvmtools/signalSource.c index 6f590e8b0..4a485c5b7 100644 --- a/open-vm-tools/libvmtools/signalSource.c +++ b/open-vm-tools/libvmtools/signalSource.c @@ -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) {