Oliver Kurth [Tue, 21 Apr 2020 21:43:45 +0000 (14:43 -0700)]
Add option to vmware-vgauth-cmd to support remove alias by [username]
and subject
a. subject is mandatory
b. if user only provide subject, will only remove subject matched mapped aliases
c. if user provide username and subject, remove matched aliases
Oliver Kurth [Wed, 1 Apr 2020 18:34:06 +0000 (11:34 -0700)]
Add a retry loop to VSockChannelStart() to recover on start failure.
On failure, a vsock RPC channel will eventually fallback to the
backdoor channel. Services that require or are limited to the
priviledge RPC channel will fail.
Adding a simple, limited loop in VSockChannelStart to retry the vsock
channel start before ultimately switching to the backdoor channel.
Retries are not done for "send once" operations.
Oliver Kurth [Wed, 1 Apr 2020 18:34:06 +0000 (11:34 -0700)]
Fixing some log messages
1. PublishScriptOutputToNamespaceDB can fail for various reasons,
caller can't know exact reason from return values, so just printing
that the function failed in case return value is FALSE. Exact cause
must be inferred from the function's logs itself.
2. Printing log for chunkCount only if we successfully wrote it in NDB
Oliver Kurth [Wed, 1 Apr 2020 18:34:05 +0000 (11:34 -0700)]
vmtools: fix compiler errors in posix service discovery core plugin
As we build the vmtools for arm (unfortunately not on main), we hit
a compiler warnings "ISO C90 forbids mixed declarations and code"
in this new code.
Oliver Kurth [Wed, 1 Apr 2020 18:34:05 +0000 (11:34 -0700)]
Annotate a Coverity false positive.
The open-vm-tools Coverity scan reports a NULL pointer dereference
for the variable untrustedCerts. However, untrustedCerts is NULL
only if no untrusted certs are found, in which case the code that
dereferences untrustedCerts isn't executed.
Oliver Kurth [Wed, 1 Apr 2020 18:31:37 +0000 (11:31 -0700)]
Add a retry loop to VSockChannelStart() to recover on start failure.
On failure, a vsock RPC channel will eventually fallback to the
backdoor channel. Services that require or are limited to the
priviledge RPC channel will fail.
Adding a simple, limited loop in VSockChannelStart to retry the vsock
channel start before ultimately switching to the backdoor channel.
Retries are not done for "send once" operations.
Oliver Kurth [Wed, 1 Apr 2020 18:31:37 +0000 (11:31 -0700)]
Fixing some log messages
1. PublishScriptOutputToNamespaceDB can fail for various reasons,
caller can't know exact reason from return values, so just printing
that the function failed in case return value is FALSE. Exact cause
must be inferred from the function's logs itself.
2. Printing log for chunkCount only if we successfully wrote it in NDB
Oliver Kurth [Wed, 1 Apr 2020 18:31:36 +0000 (11:31 -0700)]
Add a Coverity annotation.
The Coverity scan of open-vm-tools reports an out-of-bounds access
issue in Util_BacktraceWithFunc. This is intentional, to compute
the base pointer for a stack trace.
Oliver Kurth [Wed, 1 Apr 2020 18:31:36 +0000 (11:31 -0700)]
lib/unicode/unicodeSimpleTypes.c: fix leak on exit
The hashtable used for encoding name -> IANA table index
lookups was not getting freed.
Also, HashTable_AllocOnce() incorrectly instructs
the hashtable to clear its clientData, which contains
an integer index and not a pointer, using "free".
Oliver Kurth [Wed, 1 Apr 2020 18:31:36 +0000 (11:31 -0700)]
Annotate a Coverity false positive.
The open-vm-tools Coverity scan reports a NULL pointer dereference
for the variable untrustedCerts. However, untrustedCerts is NULL
only if no untrusted certs are found, in which case the code that
dereferences untrustedCerts isn't executed.
Oliver Kurth [Wed, 1 Apr 2020 18:31:36 +0000 (11:31 -0700)]
vmtools: fix compiler errors in posix service discovery core plugin
As we build the vmtools for arm (unfortunately not on main), we hit
a compiler warnings "ISO C90 forbids mixed declarations and code"
in this new code.
Oliver Kurth [Wed, 1 Apr 2020 18:31:35 +0000 (11:31 -0700)]
Fix localization issue of vmware-vgauth-cmd
1. default msg catalog folder is wrong, add correct msgCatalog in
vgauth.conf
2. rename vmsg file name to "VGAuthCli" since file name used in main
is "VGAuthCli"
3. Move I18n init up to fix variable localization issue
Oliver Kurth [Tue, 17 Mar 2020 21:36:57 +0000 (14:36 -0700)]
bora/lib/unicode: fix leak on exit
The hashtable used for encoding name -> IANA table index
lookups was not getting freed.
Also, HashTable_AllocOnce() incorrectly instructs
the hashtable to clear its clientData, which contains
an integer index and not a pointer, using "free".
Oliver Kurth [Tue, 17 Mar 2020 21:36:57 +0000 (14:36 -0700)]
Fix a Coverity-reported overrun.
A Coverity scan of open-vm-tools reports a buffer overrun in
Escape_Unescape. The problem is that Escape_Unescape uses
sizeof('\0') to specify the size of a buffer that consists of
a single character in the variable nulByte (previously named
nullbyte). However, character literals in C are ints, so
sizeof('\0') is equivalent to sizeof int rather than sizeof char.
Use "sizeof nulByte" instead.
Oliver Kurth [Tue, 17 Mar 2020 21:36:56 +0000 (14:36 -0700)]
LOG variadic: remove LOGLEVEL_VARIADIC [1 of 2]
Mass conversion is complete. It's time to remove the intermediate state.
[1/2]: remove LOGLEVEL_VARIADIC from loglevel_defs.h. This removes the
backwards-compat path.
Oliver Kurth [Wed, 4 Mar 2020 20:07:13 +0000 (12:07 -0800)]
Mapping the deployPkg log error level to g_log warning level.
g_error() is always fatal, resulting in terminating the application. In
this case the guest customization will fail. So mapping the deployPkg log
error level to g_log warning level to avoid application termination.
Oliver Kurth [Wed, 4 Mar 2020 20:07:13 +0000 (12:07 -0800)]
Send GUESTRPCPKT_FIELD_FAST_CLOSE when doing one-off RPC via vsock
To work around a vsock/vmci/VMX issue with vsock cleanup, send a special
command that tells the VXM to immediately close a vsock after completing
an RPC. This minimizes delays/timeouts when sending one-off RPCs rapdily.
Can still run out of vsockets, but they clean up pretty quickly,
so add logic to sleep a bit and retry if ENOBUFS is returned
by connect().
Oliver Kurth [Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)]
Misc. Appinfo plugin cleanup.
- Used 'g' prefix for the global variables.
- Added '%s' at the beginning of each log message.
- Renamed a non-static function with the proper naming convention.
- Fixed documentation for few functions.
- Added '.' at the end of each log message to maintain consistency.
- Used proper '// IN' comments for each function argument.
Oliver Kurth [Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)]
Replace VixTools_ConfigGetBoolean with VMTools_ConfigGetBoolean
Initially came up with a utility function named VixTools_ConfigGetBoolean
to retrieve the boolean value from the config dictionary. This function
was designed as local/specific to VIX plugin. Later, VMTools_ConfigGetBoolean
function was designed with the same functionality and is being used everywhere
in the Tools repository.
This changeset gets rid of VixTools_ConfigGetBoolean and replaces
all those occurrences with VMTools_ConfigGetBoolean.
Oliver Kurth [Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)]
Common source file changes not directly applicable to open-vm-tools.
Fix procMgr library for Windows.
- For windows, to retrieve the command line for a target process,
the procMgr library creates a remote thread in the target process
and executes GetCommandLine function. This approach is OK. But for
few applications that are not built with proper flags, creating a
remote thread may crash the application. In order to avoid any
issues, it was decided not use the 'remote thread' approach by DEFAULT.
- Refactored the procMgr APIs to take an input argument from the
user if the 'remote thread' approach needs to be used.
- Refactored the procMgr APIs to conditionally use the WMI for
retrieving the command line for a target process.
- New options are provided to the user if the 'remote thread'
and 'WMI' approaches need to be forced. Modified the VIX tools plugin
to read and honor the new flags from tools.conf
The following are the new flags under guestoperations group.
useRemoteThreadForProcessCommandLine
useWMIForProcessCommandLine
The default value for the above new flags is false. User can set them
to true if needed.
- Re-factored some code in appInfo plugin that calls procMgr library.
The appinfo plugin doesn't really use the commandline. So, modified the
appinfo plugin to just use the API that doesn't use the complicated
approaches for the listing down the processes.
Oliver Kurth [Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)]
Arm64 backdoor: Disable USE_HYPERCALL for Arm64 tools build.
Undefine USE_HYPERCALL on ESXi-Arm to force the backdoor interface type
to BACKDOOR_INTERFACE_IO. This is necessary to fix the Arm64 tools build.
This change does not affect x86 (open-vm-tools).
Oliver Kurth [Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)]
FreeBSD has removed some vnops flags that have never been used.
Two flags that were being tested in the nullfs vnops.c source have
never actually been used by any filesystem layer on top of the nullfs.
FreeBSD is doing a little house cleaning and the VDESC_NOMAP_VPP and
VDESC_VPP_WILLRELE defines are being removed from the source base.
FreeBSD has provided source code changes for the FreeBSD vmblock
driver as they have made in identical nullfs code in the FreeBSD
base code.
Oliver Kurth [Wed, 4 Mar 2020 20:07:12 +0000 (12:07 -0800)]
Add hypercall to bora/lib/backdoor.
Use vmcall or vmmcall when they are available.
Removed #include <string.h>, it was added in an earlier version
but is not needed in the current code.
Limit HostinfoBackdoorGetInterface to x86 architecture.
Fix some indents.
Oliver Kurth [Wed, 4 Mar 2020 20:07:11 +0000 (12:07 -0800)]
Handle LSI Logic Parallel and BusLogic SCSI on PCI bus 0.
When a LSI Logic Parallel or BusLogic SCSI controller appears on PCI
bus 0, the disk device controller name is not present; the "label" file
is missing. Adding logic to check if disk device is attached to a
SCSI controller on bus 0 (0000:00:10.0) if a "label" file cannot be
found. If that is the case, setting the device name to "scsi0.n"
where "n" is the device unit number previously determined.
Oliver Kurth [Wed, 4 Mar 2020 20:07:11 +0000 (12:07 -0800)]
Fix broken PowerCLI Invoke-VMScript cmdtlet by an earlier change.
Also fixed a handle leak in VixToolsGetTokenHandleFromTicketID.
Note: Credential type VIX_USER_CREDENTIAL_TICKETED_SESSION, started by
VIX_COMMAND_ACQUIRE_CREDENTIALS, is not built upon VGAuth lib
VGAuth_GenerateSSPIChallenge/VGAuth_ValidateSSPIResponse, impersonation is
done via lib/impersonate/impersonate.c::Impersonate_Do, the loaded user
profile is designed to be unloaded after 5 minutes, but because vix.dll is
linked with stub lib poll whose Poll_CB_RTime() does not do anything, the
profile is never unloaded.
Oliver Kurth [Wed, 4 Mar 2020 20:07:11 +0000 (12:07 -0800)]
Handle Photon's "/dev/root" mount point when doing disk device mapping
Photon EFI boot VMs have the root disc mounted long before the various
PCI controllers are initialized and the attached devices enumerated.
When looking through the /proc/mounts, the root filesystem mounted
at '/' is displayed as if on device /dev/root/ But there is no "root"
device in /dev, nor in the PCI device tree at /sys/class/block. Later
Photon builds fabricate a block device at "/dev/root" but again nothing
in the /sys/class/block PCI tree.
For this situation, it is necessary to use the pseudo device's major and
minor number to access the PCI device tree through /sys/dev/block.
The major and minor device number can be extracted from the contents of
/proc/self/mountinfo.
Oliver Kurth [Wed, 4 Mar 2020 20:07:11 +0000 (12:07 -0800)]
Rectify a log spew in vmsvc logging (vmware-vmsvc-root.log)
When a LSI Logic Parallel SCSI controller sits in PCI bus 0
(SCSI controller 0), the Linux disk device enumeration does not provide
a "label" file with the controller name. This results in messages like
'GuestInfoGetDiskDevice: Missing disk device name; VMDK mapping
unavailable for "/var/log", fsName: "/dev/sda2"'
repeatedly appearing in the vmsvc logging. The patch converts what
previously was a warning message to a debug message and thus avoids
the log spew.
This patch has been made available for open-vm-tools 11.0.x on the
open-vm-tools github repo.