Oliver Kurth [Tue, 27 Aug 2019 19:55:38 +0000 (12:55 -0700)]
More Coverity annotations for open-vm-tools.
Add Coverity annotations for four additional issues so that Coverity
scans of open-vm-tools will automatically classify these issues as
"intentional." Such annotations are useful both for internal use as
well as for partners who run Coverity scans of open-vm-tools.
Oliver Kurth [Tue, 27 Aug 2019 19:55:37 +0000 (12:55 -0700)]
Add more Coverity annotations to open-vm-tools source.
Add Coverity annotations for three issues so that Coverity scans of
open-vm-tools will automatically classify these issues as
"Intentional." These annotations are useful both for internal
use as well as for partners who run Coverity scans on open-vm-tools.
Oliver Kurth [Tue, 27 Aug 2019 19:55:37 +0000 (12:55 -0700)]
Get rid of PhysMem's thread registration calls for most threads.
A previous change eliminated the need to register threads before doing
a PPN to BPN conversion on them. This change removes some of the
remaining infrastructure.
Oliver Kurth [Tue, 27 Aug 2019 19:55:37 +0000 (12:55 -0700)]
Address Coverity issues reported in bora/lib/file/file.c.
Fix a minor memory leak in the function File_ExpandAndCheckDir.
Also add annotations for unchecked return values in functions
GetOldMachineID and File_MoveTree, so that Coverity scans of
open-vm-tools will automatically classify these issues as
"Intentional". These annotations are useful both for internal
use as well as for partners who run Coverity scans on open-vm-tools.
Oliver Kurth [Tue, 27 Aug 2019 19:55:36 +0000 (12:55 -0700)]
Bool type may not be a char (1 bytes).
Change structures exposed to the guest to not use Bool -
- while currently Bool is defined as char, we might use C's
_Bool or C++'s bool for booleans - and neither standard
mandates _Bool/bool to be 1 byte.
Oliver Kurth [Tue, 27 Aug 2019 19:55:35 +0000 (12:55 -0700)]
Add Coverity annotations.
Add source code annotations so that Coverity scans will automatically
classify certain issues as "intentional." These annotations serve to
memorialize these classifications in open-vm-tools source, both for
internal reference as well as for partners like Red Hat who run their
own Coverity scans on open-vm-tools.
Oliver Kurth [Fri, 2 Aug 2019 18:07:21 +0000 (11:07 -0700)]
Bumping HGFS_LARGE_IO_MAX_PAGES to 127 and defining the legacy values
This change bumps up HGFS_LARGE_IO_MAX_PAGES to 127 and define the
legacy values of HGFS_LARGE_IO_MAX_PAGES, HGFS_LARGE_IO_MAX and
HGFS_LARGE_PACKET_MAX. A switch is also added to make sure we still
use the legacy value unless "hgfs.packetSize.large" is set to "TRUE" in vmx.
Oliver Kurth [Fri, 2 Aug 2019 18:07:21 +0000 (11:07 -0700)]
Avoid freezing mount points for same device.
Loopback device setup could cause a cyclic dependency
between 2 mount points. In order to break the cycle,
avoid freezing the mount points to the same device.
This change also skips some system mount points for 'tmpfs'
and 'cgroup' etc as those share the same device/FS name.
This is fine because we can't quiese those mount points
anyway (system mount points don't support quiescing).
Oliver Kurth [Fri, 2 Aug 2019 18:07:20 +0000 (11:07 -0700)]
Remove residual data when the DNS nameserver configuration changes.
If the list of DNS nameservers available should shorten or both IPv4 and
IPv6 entries are present, residual data can still be available for display.
This change to nicInfoPosix.c corrects the problem.
Oliver Kurth [Sun, 21 Jul 2019 00:15:19 +0000 (17:15 -0700)]
Make DEBUG_ONLY work with toplevel commas (Change part 3)
Now that all the C pre-processors in use support variadic macros, make
DEBUG_ONLY work with toplevel commas (i.e. commas which are outside of
any parentheses pair). This is useful in at least 2 ways:
In C code, to easily pass debug arguments to functions in debug builds
without any overhead in non-debug builds.
void
foo(DEBUG_ONLY(int debugArg,) // IN
int nonDebugArg) // IN
{
ASSERT(DebugFunc(debugArg));
NonDebugFunc(nonDebugArg);
}
Oliver Kurth [Sun, 21 Jul 2019 00:15:19 +0000 (17:15 -0700)]
Use two new inline functions to replace most of the uses of
HGFS_LARGE_IO_MAX and HGFS_LARGE_PACKET_MAX macros.
In preparation to bump up HGFS_LARGE_IO_MAX and HGFS_LARGE_PACKET_MAX,
replace most uses of the two macro constants with inline functions that
can return either the new limits or the older defaults based on the
configuration.
Oliver Kurth [Sun, 21 Jul 2019 00:15:18 +0000 (17:15 -0700)]
Avoid emitting a trailing comma in the GuestInfoSendDiskInfoV1 JSON RPC
Although currently accepted by the JSMN library that we are using
in VMX, that superfluous comma is strictly invalid according to the
JSON standard - ECMA-404.
Oliver Kurth [Wed, 3 Jul 2019 21:28:56 +0000 (14:28 -0700)]
Fix process command name for special linux processes.
While listing down the processes in a linux guest, the existing
procMgr library reads /proc/<PID>/cmdline file and parses the
content. While reading this, an assumption is made that there is
a null terminating character at the end of the file content.
This holds true for most of the processes. But for few special processes,
the cmdline file doesn't have the terminating null character.
Oliver Kurth [Wed, 3 Jul 2019 21:28:56 +0000 (14:28 -0700)]
Fix the command name for few linux processes.
ProcMgr library publishes the 'command name' attribute for
each process while listing down all the processes. For doing this,
the commandline is first parsed from /proc/<PID>/cmdline file
and the part starting from the right-most '/' is considered as the
command name. This is OK only if we have an absolute path for the
command binary. Other wise, this may result in incorrect results.
For example:
sshd: root@pts/1
gdm-session-worker [pam/gdm-autologin]
Fixed the code to ignore the parsing if we do not have an absolute
path.
Note: There are two ways how the command name is retrieved for each
process.
1. /proc/<PID>/cmdline is parsed.
If (1) fails for some reason, then
2. /proc/<PID>/status is parsed.
There is no issue with (2). This changeset fixes the parsing issue only
with (1) approach mentioned above.
Oliver Kurth [Wed, 3 Jul 2019 21:28:56 +0000 (14:28 -0700)]
Add support for NVMe disks; IDE and SATA disk devices in 3.x Linux kernels
Support has been added for virtual disks attached to an NVMe
controller. The device "label" will provide the "nvme<n>" for the
controller. The disk unit is provided in the device "nsid" file.
An earlier implementation (Linux 2.6 kernels) provided the unit
number as the final digit group in the device node name.
The Linux 3.x kernel has some differences in the layout of IDE and
SATA disk devices in the sysfs filesystem. The differences from the
sysfs in a 2.6 Linux kernel are:
- The IDE "class" file and SATA "class" and "label" files are in a
different directory.
- IDE controller and SATA device nodes begin with "ata" where "host"
was used in earlier kernel sysfs filesystems.
GuestInfoGetDevClass() has been modfied to check in two possible
locations for the "class" file. The directory located will also
contain the "label" file for SCSI, SAS, and SATA disk devices.
GuestInfoGetIdeSataDev() has been modified to search for either
ata<n> or host<n> directories in the sysfs tree for the disk device.
Oliver Kurth [Wed, 3 Jul 2019 21:26:55 +0000 (14:26 -0700)]
Truncate oversize partition names
Truncate disk partition names if they are too large, rather than just
skipping all the disk information for the guest. Closes
https://github.com/vmware/open-vm-tools/issues/346 .