summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO90
-rw-r--r--Makefile24
-rw-r--r--PKGBUILD445
-rw-r--r--bootstrap11
-rw-r--r--config26
-rw-r--r--config.xml885
-rwxr-xr-xconfigure-initscript.sh97
-rw-r--r--datastores.xml15
-rw-r--r--dkms.conf.in30
-rw-r--r--environments.xml34
-rw-r--r--pam.d-vmware-authd5
-rw-r--r--proxy.xml50
-rw-r--r--unlocker.py429
-rw-r--r--vmmon.patch1318
-rw-r--r--vmnet.patch122
-rw-r--r--vmware-environment.sh5
-rw-r--r--vmware-hostd-certificates.service11
-rw-r--r--vmware-hostd.service11
-rw-r--r--vmware-networks-configuration.service14
-rw-r--r--vmware-networks.service14
-rw-r--r--vmware-usbarbitrator.service8
-rw-r--r--vmware-vix-bootstrap2
-rw-r--r--vmware-workstation.install19
23 files changed, 3665 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fb6e79817c70
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,90 @@
+pkgbase = vmware-workstation11
+ pkgdesc = The industry standard for running multiple operating systems as virtual machines on a single Linux PC.
+ pkgver = 11.1.4
+ pkgrel = 1
+ url = https://www.vmware.com/products/workstation-for-linux.html
+ install = vmware-workstation.install
+ arch = x86_64
+ license = custom
+ makedepends = sqlite
+ makedepends = python2
+ makedepends = python2-six
+ makedepends = unzip
+ depends = dkms
+ depends = ncurses5-compat-libs
+ depends = fuse2
+ depends = gksu
+ depends = gtkmm
+ depends = libcanberra
+ depends = hicolor-icon-theme
+ depends = fontconfig
+ depends = freetype2
+ optdepends = linux-headers: build modules against Arch kernel
+ provides = vmware-workstation=11.1.4
+ provides = vmware-ovftool
+ conflicts = vmware-workstation
+ conflicts = vmware-modules-dkms
+ conflicts = vmware-ovftool
+ conflicts = vmware-patch
+ conflicts = vmware-systemd-services
+ options = !strip
+ options = staticlibs
+ options = emptydirs
+ backup = etc/vmware/config
+ backup = etc/vmware/hostd/authorization.xml
+ backup = etc/vmware/hostd/config.xml
+ backup = etc/vmware/hostd/datastores.xml
+ backup = etc/vmware/hostd/dispatcher.xml
+ backup = etc/vmware/hostd/proxy.xml
+ backup = etc/vmware/hostd/tagExtractor.xml
+ backup = etc/vmware/netmap.conf
+ backup = etc/vmware/ssl/hostd.ssl.config
+ backup = etc/pam.d/vmware-authd
+ backup = etc/conf.d/vmware
+ source = https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-11.1.4-3848939.x86_64.bundle
+ source = bootstrap
+ source = vmware-vix-bootstrap
+ source = config
+ source = pam.d-vmware-authd
+ source = configure-initscript.sh
+ source = vmware-environment.sh
+ source = config.xml
+ source = datastores.xml
+ source = environments.xml
+ source = proxy.xml
+ source = vmware-hostd-certificates.service
+ source = vmware-hostd.service
+ source = vmware-networks-configuration.service
+ source = vmware-networks.service
+ source = vmware-usbarbitrator.service
+ source = dkms.conf.in
+ source = Makefile
+ source = vmmon.patch
+ source = vmnet.patch
+ source = https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/7.1.3/3204469/packages/com.vmware.fusion.tools.darwin.zip.tar
+ source = unlocker.py
+ sha256sums = d6b158a03d94db2d274dbf695337c564987f373c1ff5896665f3d1590617bc04
+ sha256sums = 12e7b16abf8d7e858532edabb8868919c678063c566a6535855b194aac72d55e
+ sha256sums = da1698bf4e73ae466c1c7fc93891eba4b9c4581856649635e6532275dbfea141
+ sha256sums = a148a3e40f12929707cda38f775a1ad4d4203f6ed0494437c3a072da9efa5d5c
+ sha256sums = d50aa0a3fe94025178965d988e18d41eb60aa1ce2b28ee6e3ca15edeabfa2ca7
+ sha256sums = 8e4d08668a66be79a900521792b39c16a026cc90659241edee80b64e701bfbcd
+ sha256sums = 0c5f33796271ec8c6f26cf5c736117e87e9789c18326494c2bc789d4318a4b9a
+ sha256sums = ee65ba48bbf1b133e8ef36c3133261488a5f0db44c21a46427976baca39e39b4
+ sha256sums = 04375658fed0cad4a18d5da1589d4dc1e5171753891ecaadd05f3c3e50c8156f
+ sha256sums = f8ab8cb8314e2b82e69ea3c571be04540ce613630808d949c20cc2edef27f77d
+ sha256sums = 3c802523606184a5e8ebbe931d9c6c70d83ff8c6833b9f48aa264f0bd5a18a88
+ sha256sums = f9440479f3ae5ad0a39bba3150276627878bf83d6879444fb327c53a1dbb5a4d
+ sha256sums = 70301aa4eff4f42d7d39b276445dc7d8f44b8a0e184775e8a9e3055bb9d8590a
+ sha256sums = e3812b78158672c7d96b6a58877681462f3fbdfe99a948b32c80c755c8682450
+ sha256sums = a651de50e91f386057d69d11e2cdf6e020229aae0631f25073ca09fbb878d1db
+ sha256sums = d7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d
+ sha256sums = 05e26d8b21d190ebabb7f693998114d9d5991d9dfb71acb4d990293a65b6b487
+ sha256sums = 6ce902b1dab8fc69be253abd8e79017011985eca850ff7acc7282f9ab668e35d
+ sha256sums = d1aae68a0864d4483039302931b8a571b2c660706d1c7a7572bd9d6fdc099c37
+ sha256sums = 7523a9ddd5f6dd00202a8928610a41d135a04497c64ddd2b88fbb155d7a37543
+ sha256sums = 09711e59f708576d2fb09c464ebbb52806cb7f850cb3d5bbeea634fa58fb6c86
+ sha256sums = b739b0c99fb20dc44838ce137e254773b7be051f327eb67fd8cb1342a3ecf344
+
+pkgname = vmware-workstation11
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..4b589921549f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+#!/usr/bin/make -f
+
+MODULES = \
+ vmmon \
+ vmnet \
+ #vmblock \
+ #vmci \
+ #vsock
+
+all: $(foreach m, $(MODULES), $m.ko)
+
+%.ko: %
+ $(MAKE) KVERSION=$(KVERSION) VM_KBUILD=yes -C $*-only
+
+$(MODULES): %:
+ cp -r $(SRCDIR)/$*-only $*-only
+
+vsock.ko: vmci.ko
+
+clean:
+ rm -rf $(MODULES)
+ rm -rf $(foreach m, $(MODULES), $m-only)
+ rm -f $(foreach m, $(MODULES), $m.ko)
+ rm -f $(foreach m, $(MODULES), $m.o)
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..d03cd703dae3
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,445 @@
+# Maintainer: Jean-Marc Lenoir <archlinux "at" jihemel "dot" com>
+
+############################################################################
+# Patch VMware Workstation to enable macOS guests support
+# Uncomment the line below to enable it
+
+#_enable_macOS_guests=y
+
+# CAUTION: Run macOS on a non Apple computer may be forbidden in your country.
+# Source of the patch: https://github.com/DrDonk/unlocker
+# Forum: http://www.insanelymac.com/forum/topic/303311-workstation-1112-player-712-fusion-78-and-esxi-6-mac-os-x-unlocker-2
+############################################################################
+
+#PKGEXT=.pkg.tar
+pkgname=vmware-workstation11
+pkgver=11.1.4
+_buildver=3848939
+_pkgver=${pkgver}_${_buildver}
+pkgrel=1
+pkgdesc='The industry standard for running multiple operating systems as virtual machines on a single Linux PC.'
+arch=(x86_64)
+url='https://www.vmware.com/products/workstation-for-linux.html'
+license=(custom)
+install="vmware-workstation.install"
+conflicts=(
+ vmware-workstation
+ vmware-modules-dkms
+ vmware-ovftool
+ vmware-patch
+ vmware-systemd-services
+)
+provides=(
+ vmware-workstation=$pkgver
+ vmware-ovftool
+)
+depends=(
+ dkms
+ ncurses5-compat-libs
+ fuse2
+ gksu
+ gtkmm
+ libcanberra
+ hicolor-icon-theme
+ # needed to replace internal libs:
+ fontconfig
+ freetype2
+ #zlib
+)
+optdepends=(
+ 'linux-headers: build modules against Arch kernel'
+)
+makedepends=(
+ sqlite
+)
+backup=(
+ 'etc/vmware/config'
+ 'etc/vmware/hostd/authorization.xml'
+ 'etc/vmware/hostd/config.xml'
+ 'etc/vmware/hostd/datastores.xml'
+ 'etc/vmware/hostd/dispatcher.xml'
+ 'etc/vmware/hostd/proxy.xml'
+ 'etc/vmware/hostd/tagExtractor.xml'
+ 'etc/vmware/netmap.conf'
+ 'etc/vmware/ssl/hostd.ssl.config'
+ 'etc/pam.d/vmware-authd'
+ 'etc/conf.d/vmware'
+)
+source=(
+ "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-${_pkgver/_/-}.${CARCH}.bundle"
+
+ 'bootstrap'
+ 'vmware-vix-bootstrap'
+ 'config'
+ 'pam.d-vmware-authd'
+ 'configure-initscript.sh'
+ 'vmware-environment.sh'
+
+ 'config.xml'
+ 'datastores.xml'
+ 'environments.xml'
+ 'proxy.xml'
+
+ 'vmware-hostd-certificates.service'
+ 'vmware-hostd.service'
+ 'vmware-networks-configuration.service'
+ 'vmware-networks.service'
+ 'vmware-usbarbitrator.service'
+
+ 'dkms.conf.in'
+ 'Makefile'
+ 'vmmon.patch'
+ 'vmnet.patch'
+)
+sha256sums=(
+ 'd6b158a03d94db2d274dbf695337c564987f373c1ff5896665f3d1590617bc04'
+
+ '12e7b16abf8d7e858532edabb8868919c678063c566a6535855b194aac72d55e'
+ 'da1698bf4e73ae466c1c7fc93891eba4b9c4581856649635e6532275dbfea141'
+ 'a148a3e40f12929707cda38f775a1ad4d4203f6ed0494437c3a072da9efa5d5c'
+ 'd50aa0a3fe94025178965d988e18d41eb60aa1ce2b28ee6e3ca15edeabfa2ca7'
+ '8e4d08668a66be79a900521792b39c16a026cc90659241edee80b64e701bfbcd'
+ '0c5f33796271ec8c6f26cf5c736117e87e9789c18326494c2bc789d4318a4b9a'
+
+ 'ee65ba48bbf1b133e8ef36c3133261488a5f0db44c21a46427976baca39e39b4'
+ '04375658fed0cad4a18d5da1589d4dc1e5171753891ecaadd05f3c3e50c8156f'
+ 'f8ab8cb8314e2b82e69ea3c571be04540ce613630808d949c20cc2edef27f77d'
+ '3c802523606184a5e8ebbe931d9c6c70d83ff8c6833b9f48aa264f0bd5a18a88'
+
+ 'f9440479f3ae5ad0a39bba3150276627878bf83d6879444fb327c53a1dbb5a4d'
+ '70301aa4eff4f42d7d39b276445dc7d8f44b8a0e184775e8a9e3055bb9d8590a'
+ 'e3812b78158672c7d96b6a58877681462f3fbdfe99a948b32c80c755c8682450'
+ 'a651de50e91f386057d69d11e2cdf6e020229aae0631f25073ca09fbb878d1db'
+ 'd7a9fbf39a0345ae2f14f7f389f30b1110f605d187e0c241e99bbb18993c250d'
+
+ '05e26d8b21d190ebabb7f693998114d9d5991d9dfb71acb4d990293a65b6b487'
+ '6ce902b1dab8fc69be253abd8e79017011985eca850ff7acc7282f9ab668e35d'
+ 'd1aae68a0864d4483039302931b8a571b2c660706d1c7a7572bd9d6fdc099c37'
+ '7523a9ddd5f6dd00202a8928610a41d135a04497c64ddd2b88fbb155d7a37543'
+)
+options=(!strip staticlibs emptydirs)
+
+
+_isoimages=(freebsd linux netware solaris windows winPre2k)
+
+if [ -n "$_enable_macOS_guests" ]; then
+
+_vmware_fusion_ver=7.1.3_3204469
+# List of VMware Fusion versions: https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/
+
+makedepends+=(
+ python2
+ python2-six
+ unzip
+)
+
+source+=(
+ "https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/${_vmware_fusion_ver/_//}/packages/com.vmware.fusion.tools.darwin.zip.tar"
+ 'unlocker.py'
+)
+sha256sums+=(
+ '09711e59f708576d2fb09c464ebbb52806cb7f850cb3d5bbeea634fa58fb6c86'
+ 'b739b0c99fb20dc44838ce137e254773b7be051f327eb67fd8cb1342a3ecf344'
+)
+
+_fusion_isoimages=(darwin)
+fi
+
+
+_create_database_file() {
+ # Create a database which contains the list of guest tools (necessary to avoid that vmware try to download them)
+ local database_filename="$pkgdir/etc/vmware-installer/database"
+ echo -n "" > "$database_filename"
+
+ sqlite3 "$database_filename" "CREATE TABLE settings(key VARCHAR PRIMARY KEY, value VARCHAR NOT NULL, component_name VARCHAR NOT NULL);"
+ sqlite3 "$database_filename" "INSERT INTO settings(key,value,component_name) VALUES('db.schemaVersion','2','vmware-installer');"
+ sqlite3 "$database_filename" "CREATE TABLE components(id INTEGER PRIMARY KEY, name VARCHAR NOT NULL, version VARCHAR NOT NULL, buildNumber INTEGER NOT NULL, component_core_id INTEGER NOT NULL, longName VARCHAR NOT NULL, description VARCHAR, type INTEGER NOT NULL);"
+
+ for isoimage in ${_isoimages[@]}
+ do
+ local version=$(cat "$srcdir/extracted/vmware-tools-$isoimage/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+")
+ sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"vmware-tools-$isoimage\",\"$version\",\"${_pkgver#*_}\",1,\"$isoimage\",\"$isoimage\",1);"
+ done
+
+if [ -n "$_enable_macOS_guests" ]; then
+ for isoimage in ${_fusion_isoimages[@]}
+ do
+ sqlite3 "$database_filename" "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"vmware-tools-$isoimage\",\"1\",\"${_vmware_fusion_ver#*_}\",1,\"$isoimage\",\"$isoimage\",1);"
+ done
+fi
+}
+
+prepare() {
+ extracted_dir="$srcdir/extracted"
+ [[ -d "$extracted_dir" ]] && rm -r "$extracted_dir"
+
+ bash \
+ "$(readlink -f "$srcdir/VMware-Workstation-Full-${_pkgver/_/-}.${CARCH}.bundle")" \
+ --extract "$extracted_dir"
+
+if [ -n "$_enable_macOS_guests" ]; then
+ for isoimage in ${_fusion_isoimages[@]}
+ do
+ unzip -q com.vmware.fusion.tools.$isoimage.zip
+ rm manifest.plist
+ done
+
+ sed -i -e "s|/usr/lib/vmware/|${pkgdir}/usr/lib/vmware/|" "$srcdir/unlocker.py"
+fi
+}
+
+package() {
+ local vmware_installer_version=$(cat "$srcdir/extracted/vmware-installer/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+")
+
+ # Make directories and copy files.
+
+ mkdir -p \
+ "$pkgdir/etc"/{cups,pam.d,modprobe.d,profile.d,thnuclnt,vmware} \
+ "$pkgdir/usr"/{share,bin} \
+ "$pkgdir/usr/include/vmware-vix" \
+ "$pkgdir/usr/lib"/{vmware/setup,vmware-vix,vmware-ovftool,vmware-installer/"$vmware_installer_version",cups/filter,modules-load.d} \
+ "$pkgdir/usr/share"/{doc/vmware-vix,licenses/"$pkgname"} \
+ "$pkgdir/var/lib/vmware/Shared VMs"
+
+ cd "$srcdir/extracted"
+
+ cp -r \
+ vmware-workstation/share/* \
+ vmware-workstation/man \
+ vmware-network-editor-ui/share/* \
+ vmware-player-app/share/* \
+ "$pkgdir/usr/share"
+
+ cp -r \
+ vmware-workstation/bin/* \
+ vmware-vmx/{,s}bin/* \
+ vmware-vix-core/bin/* \
+ vmware-vprobe/bin/* \
+ vmware-workstation-server/{vmware-hostd,vmware-vim-cmd,vmware-wssc-adminTool} \
+ vmware-network-editor-ui/bin/* \
+ vmware-player-app/bin/* \
+ "$pkgdir/usr/bin"
+
+ cp -r \
+ vmware-workstation/lib/* \
+ vmware-player-app/lib/* \
+ vmware-vmx/lib/* \
+ vmware-vprobe/lib/* \
+ vmware-workstation-server/{bin,lib,hostd} \
+ vmware-usbarbitrator/bin \
+ vmware-network-editor/lib \
+ "$pkgdir/usr/lib/vmware"
+
+ cp -r \
+ vmware-player-setup/vmware-config \
+ "$pkgdir/usr/lib/vmware/setup"
+
+ cp -rL \
+ vmware-workstation-server/config/etc/vmware/* \
+ vmware-workstation-server/etc/vmware/* \
+ "$srcdir"/{bootstrap,config} \
+ "$pkgdir/etc/vmware"
+
+ cp -r \
+ vmware-vix-lib-Workstation1100andvSphere600/lib/Workstation-11.0.0-and-vSphere-6.0.0 \
+ vmware-vix-core/lib/* \
+ "$pkgdir/usr/lib/vmware-vix"
+ #cp vmware-vix-core/vix-perl.tar.nogz "$pkgdir/usr/lib/vmware-vix/vix-perl.tar.gz"
+
+ cp -r \
+ vmware-vix-core/doc/* \
+ "$pkgdir/usr/share/doc/vmware-vix"
+
+ cp -r \
+ vmware-ovftool/* \
+ "$pkgdir/usr/lib/vmware-ovftool"
+
+ cp -r \
+ vmware-installer/{python,sopython,vmis,vmis-launcher,vmware-installer,vmware-installer.py} \
+ "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version"
+
+ cp -r \
+ vmware-player-app/etc/cups/* \
+ "$pkgdir/etc/cups"
+
+ cp -r \
+ vmware-player-app/extras/thnucups \
+ "$pkgdir/usr/lib/cups/filter"
+
+ cp -r \
+ vmware-vix-core/include/* \
+ "$pkgdir/usr/include/vmware-vix"
+
+ for isoimage in ${_isoimages[@]}
+ do
+ install -Dm 644 "vmware-tools-$isoimage/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso"
+ install -Dm 644 "vmware-tools-$isoimage/$isoimage.iso.sig" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso.sig"
+ done
+
+ install -Dm 644 "vmware-player-app/doc/LearnMore.txt" "$pkgdir/usr/share/licenses/$pkgname/Privacy.txt"
+ install -Dm 644 "vmware-workstation/doc/EULA" "$pkgdir/usr/share/licenses/$pkgname/VMware Workstation - EULA.txt"
+ install -Dm 644 "vmware-workstation/doc"/*open_source_licenses.txt "$pkgdir/usr/share/licenses/$pkgname"
+ mv "$pkgdir/usr/lib/vmware-ovftool/vmware.eula" "$pkgdir/usr/share/licenses/$pkgname/VMware OVF Tool component for Linux - EULA.txt"
+ rm "$pkgdir/usr/lib/vmware-ovftool"/{vmware-eula.rtf,open_source_licenses.txt,manifest.xml}
+
+ install -Dm 755 "$srcdir/configure-initscript.sh" "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version/bin/configure-initscript.sh"
+
+ install -Dm 644 "vmware-vmx/etc/modprobe.d/modprobe-vmware-fuse.conf" "$pkgdir/etc/modprobe.d/vmware-fuse.conf"
+
+ install -Dm 644 vmware-player-app/lib/isoimages/tools-key.pub "$pkgdir/usr/lib/vmware/isoimages/tools-key.pub"
+
+ install -Dm 644 vmware-vmx/extra/modules.xml "$pkgdir/usr/lib/vmware/modules/modules.xml"
+ install -Dm 644 vmware-installer/bootstrap "$pkgdir/etc/vmware-installer/bootstrap"
+ install -Dm 644 "$srcdir/vmware-vix-bootstrap" "$pkgdir/etc/vmware-vix/bootstrap"
+
+ for hostd_file in config datastores environments proxy; do
+ install -Dm 644 "$srcdir/$hostd_file.xml" "$pkgdir/etc/vmware/hostd/$hostd_file.xml"
+ done
+
+ install -Dm 644 "$srcdir/pam.d-vmware-authd" "$pkgdir/etc/pam.d/vmware-authd"
+
+ echo -e "vmw_vmci\nvmmon" > "$pkgdir/usr/lib/modules-load.d/vmware.conf"
+
+ for service_file in \
+ vmware-hostd-certificates.service \
+ vmware-hostd.service \
+ vmware-networks-configuration.service \
+ vmware-networks.service \
+ vmware-usbarbitrator.service
+ do
+ install -Dm 644 \
+ "$srcdir/$service_file" \
+ "$pkgdir/usr/lib/systemd/system/$service_file"
+ done
+
+
+ # Apply permissions where necessary.
+
+ chmod +x \
+ "$pkgdir/usr/bin"/* \
+ "$pkgdir/usr/lib/vmware/bin"/* \
+ "$pkgdir/usr/lib/vmware/setup"/* \
+ "$pkgdir/usr/lib/vmware/lib"/{wrapper-gtk24.sh,libgksu2.so.0/gksu-run-helper} \
+ "$pkgdir/usr/lib/vmware-ovftool"/{ovftool,ovftool.bin} \
+ "$pkgdir/usr/lib/vmware-installer/$vmware_installer_version"/{vmware-installer,vmis-launcher} \
+ "$pkgdir/usr/lib/cups/filter"/* \
+ "$pkgdir/usr/lib/vmware-vix/setup"/*
+
+ chmod -R 600 "$pkgdir/etc/vmware/ssl"
+ chmod +s \
+ "$pkgdir/usr/bin"/{vmware-authd,vmware-mount} \
+ "$pkgdir/usr/lib/vmware/bin"/{vmware-vmx,vmware-vmx-debug,vmware-vmx-stats}
+
+
+ # Add symlinks the installer would create.
+
+ for link in \
+ licenseTool \
+ thnuclnt \
+ vmplayer \
+ vmware \
+ vmware-app-control \
+ vmware-enter-serial \
+ vmware-fuseUI \
+ vmware-gksu \
+ vmware-modconfig \
+ vmware-modconfig-console \
+ vmware-netcfg \
+ vmware-tray \
+ vmware-unity-helper \
+ vmware-vmblock-fuse \
+ vmware-zenity
+ do
+ ln -s /usr/lib/vmware/bin/appLoader "$pkgdir/usr/lib/vmware/bin/$link"
+ done
+
+ for floppy in \
+ pvscsi-Windows2003 \
+ pvscsi-Windows2008 \
+ pvscsi-WindowsXP \
+ vmscsi
+ do
+ ln -s /usr/lib/vmware/floppies/${floppy}.flp "$pkgdir/usr/lib/vmware/resources/${floppy}.flp"
+ done
+
+ ln -s /usr/lib/vmware/icu "$pkgdir/etc/vmware/icu"
+ ln -s /usr/lib/vmware/bin/vmware-usbarbitrator "$pkgdir/usr/bin/vmware-usbarbitrator"
+ ln -s /usr/lib/vmware/bin/vmware-hostd "$pkgdir/usr/lib/vmware/bin/vmware-vim-cmd"
+ ln -s /usr/lib/vmware/bin/appLoader "$pkgdir/etc/thnuclnt/.thnumod"
+ ln -s /usr/lib/vmware/lib/diskLibWrapper.so/diskLibWrapper.so "$pkgdir/usr/lib/diskLibWrapper.so"
+ ln -s /usr/lib/vmware-vix/libvixAllProducts.so "$pkgdir/usr/lib/libvixAllProducts.so"
+ ln -s /usr/lib/vmware-ovftool/ovftool "$pkgdir/usr/bin/ovftool"
+
+
+ # Replace placeholder "variables" with real paths.
+
+ for file in \
+ pango/pangorc \
+ pango/pango.modules \
+ pango/pangox.aliases \
+ gtk-2.0/gdk-pixbuf.loaders \
+ gtk-2.0/gtk.immodules
+ do
+ sed -i 's,@@LIBCONF_DIR@@,/usr/lib/vmware/libconf,g' "$pkgdir/usr/lib/vmware/libconf/etc/$file"
+ done
+
+ sed -i 's,@@BINARY@@,/usr/bin/vmware,' "$pkgdir/usr/share/applications/vmware-workstation.desktop"
+ sed -i 's,@@BINARY@@,/usr/bin/vmplayer,' "$pkgdir/usr/share/applications/vmware-player.desktop"
+ sed -i 's,@@BINARY@@,/usr/bin/vmware-netcfg,' "$pkgdir/usr/share/applications/vmware-netcfg.desktop"
+
+ sed -i 's,@@AUTHD_PORT@@,902,' "$pkgdir/usr/lib/vmware/hostd/docroot/client/clients.xml"
+
+ sed \
+ -e "s/@@VERSION@@/$vmware_installer_version/" \
+ -e "s,@@VMWARE_INSTALLER@@,/usr/lib/vmware-installer/$vmware_installer_version," \
+ -i "$pkgdir/etc/vmware-installer/bootstrap"
+
+
+ # Patch up the VMware kernel sources and configure DKMS.
+
+ dkms_dir="$pkgdir/usr/src/$pkgname-$_pkgver"
+
+ install -Dm 644 "$srcdir/Makefile" "$dkms_dir/Makefile"
+ install -Dm 644 "$srcdir/dkms.conf.in" "$dkms_dir/dkms.conf"
+
+ sed \
+ -e "s/@PKGNAME@/$pkgname/g" \
+ -e "s/@PKGVER@/$_pkgver/g" \
+ -i "$dkms_dir/dkms.conf"
+
+ for module in vmmon vmnet; do # vmblock vmci vsock
+ tar -xf "vmware-vmx/lib/modules/source/$module.tar" -C "$dkms_dir"
+ msg "Patching $module module for DKMS"
+ patch -p2 --read-only=ignore --directory="$dkms_dir/$module-only" < "$srcdir/$module.patch"
+ done
+
+ rm -r "$pkgdir/usr/lib/vmware/modules/source"
+
+if [ -n "$_enable_macOS_guests" ]; then
+ msg "Patching VMware for macOS guest support"
+ python2 "$srcdir/unlocker.py" > /dev/null
+
+ for isoimage in ${_fusion_isoimages[@]}
+ do
+ install -Dm 644 "$srcdir/payload/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso"
+ install -Dm 644 "$srcdir/payload/$isoimage.iso.sig" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso.sig"
+ done
+fi
+
+ _create_database_file
+
+ # Define some environment variables for VMware and remove the tests about kernel modules
+ install -Dm 644 "$srcdir/vmware-environment.sh" "$pkgdir/etc/conf.d/vmware"
+ for program in vmware vmplayer vmware-netcfg vmware-tray; do
+ sed -e '/export PRODUCT_NAME/asource /etc/conf.d/vmware' \
+ -e 's/if "$BINDIR"\/vmware-modconfig --appname=.*/if true ||/' \
+ -i "$pkgdir/usr/bin/$program"
+ done
+
+ # use system font rendering
+ ln -sf /usr/lib/libfreetype.so.6 "$pkgdir/usr/lib/vmware/lib/libfreetype.so.6/"
+ ln -sf /usr/lib/libfontconfig.so.1 "$pkgdir/usr/lib/vmware/lib/libfontconfig.so.1/" # avoid a conflict with fontconfig when VMWARE_USE_SHIPPED_LIBS is defined
+
+ # to solve bugs with incompatibles library versions:
+ #ln -sf /usr/lib/libz.so.1 "$pkgdir/usr/lib/vmware/lib/libz.so.1/"
+}
diff --git a/bootstrap b/bootstrap
new file mode 100644
index 000000000000..981b82191cca
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,11 @@
+PREFIX="/usr"
+BINDIR="/usr/bin"
+SBINDIR="/usr/sbin"
+LIBDIR="/usr/lib"
+DATADIR="/usr/share"
+SYSCONFDIR="/etc"
+DOCDIR="/usr/share/doc"
+MANDIR="/usr/share/man"
+INCLUDEDIR="/usr/include"
+INITDIR=""
+INITSCRIPTDIR="/usr/lib/systemd/scripts"
diff --git a/config b/config
new file mode 100644
index 000000000000..4411a773d6f1
--- /dev/null
+++ b/config
@@ -0,0 +1,26 @@
+.encoding = "UTF-8"
+NETWORKING = "yes"
+VMBLOCK_CONFED = "yes"
+gksu.rootMethod = "su"
+libdir = "/usr/lib/vmware"
+VMCI_CONFED = "yes"
+VSOCK_CONFED = "yes"
+initscriptdir = "/usr/lib/systemd/scripts"
+authd.fullpath = "/usr/bin/vmware-authd"
+bindir = "/usr/bin"
+vmware.fullpath = "/usr/bin/vmware"
+vix.libdir = "/usr/lib/vmware-vix"
+installerDefaults.componentDownloadEnabled = "no"
+installerDefaults.autoSoftwareUpdateEnabled.epoch = "6443199724"
+vix.config.version = "1"
+player.product.version = "7.1.4"
+installerDefaults.dataCollectionEnabled.epoch = "4316353219"
+installerDefaults.dataCollectionEnabled = "no"
+installerDefaults.transferVersion = "1"
+installerDefaults.autoSoftwareUpdateEnabled = "no"
+product.buildNumber = "3848939"
+authd.client.port = "902"
+authd.proxy.nfc = "vmware-hostd:ha-nfc"
+product.version = "11.1.4"
+workstation.product.version = "11.1.4"
+product.name = "VMware Workstation"
diff --git a/config.xml b/config.xml
new file mode 100644
index 000000000000..27a16b62791b
--- /dev/null
+++ b/config.xml
@@ -0,0 +1,885 @@
+<!-- VMware Host Agent configuration file -->
+
+<config>
+ <!-- current working directory -->
+ <workingDir>./</workingDir>
+
+ <!-- location to examine for configuration files that are needed -->
+ <defaultConfigPath> /etc/vmware/ </defaultConfigPath>
+
+ <!-- location for docroot, plugins, libraries, etc. -->
+ <defaultInstallPath> /usr/lib/vmware </defaultInstallPath>
+
+ <!-- stdout for hostd process -->
+ <!-- <stdoutFile>/var/log/vmware/hostd-stdout.txt</stdoutFile> -->
+
+ <!-- stderr for hostd process -->
+ <!-- <stderrFile>/var/log/vmware/hostd-stderr.txt</stderrFile> -->
+
+ <!-- Memory death point for hostd -->
+ <!-- <hostdStopMemInMB> 250 </hostdStopMemInMB> -->
+ <!-- <hostdStopMemInPercent> 80 </hostdStopMemInPercent> -->
+
+ <!-- Memory watermark for hostd -->
+ <!-- <hostdWarnMemInMB> 180 </hostdWarnMemInMB> -->
+ <!-- <hostdWarnMemInPercent> 60 </hostdWarnMemInPercent> -->
+
+ <!-- hostd min num of fds -->
+ <!-- Override by vmacore/threadPool/MaxFdsPerThread -->
+ <!-- hostdMinFds> 2048 </hostdMinFds -->
+
+ <!-- hostd absolute max num of fds -->
+ <!-- hostdMaxFds> 4096 </hostdMaxFds -->
+
+ <!-- hostd mmap threshold in kilo bytes -->
+ <hostdMmapThreshold> 32 </hostdMmapThreshold>
+
+ <!-- Mode in which hostd runs: defines product type -->
+ <hostdMode> ws </hostdMode>
+
+ <!-- True if hostd is running in simulator mode -->
+ <mockup>
+ <enabled> false </enabled>
+ <!-- Bump the count if hostd runs out of memory in simulator mode when
+ you create more VMs -->
+ <supportedVMs> 128 </supportedVMs>
+ </mockup>
+
+ <!-- Procoproxy update forwarding configuration settings
+ <updateForwarding>
+ <enabled>false</enabled>
+ <hostName>localhost</hostName>
+ <port>5002</port>
+ <useSsl>false</useSsl>
+ </updateForwarding>
+ -->
+
+ <!-- Frequency of memory checker -->
+ <!-- <memoryCheckerTimeInSecs> 30 </memoryCheckerTimeInSecs> -->
+
+ <log>
+ <!-- controls where rolling log files are stored
+ If directory is changed from default, may also want to
+ pass '-l some-dir' to hostd program at startup.
+ -->
+
+ <directory>/var/log/vmware/</directory>
+
+ <!-- name of log file -->
+ <name>hostd</name>
+
+ <!-- If true, redirect stderr to stdout. stdout inherits from
+ parent process. Log() (limited to default log level (see below))
+ will then be written to stdout. If false, stderr and stdout
+ are redirected to /dev/null on linux. On win32 this option is
+ not used.
+ At runtime, see vimsh internalsvc/redirect_stdout|err
+ -->
+ <outputToConsole>true</outputToConsole>
+
+ <!-- If true, logs to syslog -->
+ <outputToSyslog>false</outputToSyslog>
+
+ <!-- If true, log to files on disk -->
+ <!-- <outputToFiles>true</outputToFiles> -->
+
+ <!-- syslog configuration. Only used if outputToSyslog is true. -->
+ <syslog>
+ <!-- syslog identifier to use when logging -->
+ <ident>Hostd</ident>
+
+ <!-- syslog facility to use when logging -->
+ <facility>local4</facility>
+
+ <!-- The section header contents are placed in this file at startup.
+ When vmsyslogd rotates the hostd log file, it logs the content of this
+ file to syslog. This is being done so that we don't lose context on log
+ rotations.
+ IMPORTANT: Value needs to match that in onrotate entry in
+ vmsyslog.d/hostd.conf
+ -->
+ <logHeaderFile>/var/run/vmware/hostdLogHeader.txt</logHeaderFile>
+
+ </syslog>
+
+ <!-- default size(in bytes) of each log file before rolling over to next -->
+ <!-- <maxFileSize>10485760</maxFileSize> -->
+
+ <!-- default number of log files to rotate amongst -->
+ <!-- <maxFileNum>10</maxFileNum> -->
+
+ <!-- default log level -->
+ <level>verbose</level>
+
+ <!-- if false disable logging to memory buffer -->
+ <!-- <outputToMemory>true</outputToMemory> -->
+
+ <!-- default memory log level -->
+ <!-- <memoryLevel>verbose</memoryLevel> -->
+
+ <!-- memory log buffer size in KB -->
+ <!-- <memoryLogSizeK>64</memoryLogSizeK> -->
+ </log>
+
+ <!-- The root password will expire if this value is set to true -->
+ <rootPasswdExpiration>false</rootPasswdExpiration>
+
+ <!-- Log level configuration (Rules are applied in order)
+ <level id = "0">
+ <logName> App </logName>
+ <logLevel> info </logLevel>
+ <memoryLevel>verbose</memoryLevel>
+ <prefix> true </prefix>
+ </level>
+ <level id = "1">
+ <logName> BaseLibs </logName>
+ <logLevel> quiet </logLevel>
+ <memoryLevel>verbose</memoryLevel>
+ <prefix> false </prefix>
+ </level>
+ <level id = "2">
+ <logName> Vmsvc </logName>
+ <logLevel> info </logLevel>
+ <memoryLevel>verbose</memoryLevel>
+ <prefix> true </prefix>
+ </level>
+ <level id = "3">
+ <logName> /vmfs/volumes/foo/foo.vmx </logName>
+ <logLevel> trivia </logLevel>
+ <memoryLevel>verbose</memoryLevel>
+ <prefix> false </prefix>
+ </level>
+ <level id = "Vigor">
+ <logName> Vigor </logName>
+ <logLevel> info </logLevel>
+ <memoryLevel>verbose</memoryLevel>
+ <prefix> true </prefix>
+ </level>
+ -->
+ <level id = "4">
+ <logName> SoapAdapter.HTTPService </logName>
+ <logLevel> info </logLevel>
+ <prefix> false </prefix>
+ </level>
+
+ <level id="TCP">
+ <logName>TCP</logName>
+ <logLevel>error</logLevel>
+ <prefix>false</prefix>
+ </level>
+
+ <!--
+ <level id="IO">
+ <logName>IO</logName>
+ <logLevel>error</logLevel>
+ <prefix>false</prefix>
+ </level>
+ -->
+
+ <!--
+ Logger for the data passed through the proxy
+ Uncomment the following block to enable it.
+
+ WARNING: this data may contain sensitive informatino, such as
+ passwords, session IDs, etc.
+ -->
+ <!--
+ <level id="ProxyReqData">
+ <logName>Proxy Req Data</logName>
+ <logLevel>trivia</logLevel>
+ <prefix>true</prefix>
+ </level>
+ -->
+
+ <!-- Remove the following node to disable SSL -->
+ <ssl>
+ <!-- The server private key file -->
+ <privateKey>/etc/vmware/ssl/rui.key</privateKey>
+
+ <!-- The server side certificate file -->
+ <certificate>/etc/vmware/ssl/rui.crt</certificate>
+
+ <!-- The SSL version to use -->
+ <!-- <sslVersion>all</sslVersion> -->
+ </ssl>
+
+ <!-- Directory on the Console OS accessible to the DatastoreBrowser -->
+ <browsableConsoleDir>/vmimages</browsableConsoleDir>
+
+ <!-- Location of vm inventory file on legacy host -->
+ <!-- <legacyVmInventory>/etc/vmware/vm-list</legacyVmInventory> -->
+
+ <!-- VMOMI configuration -->
+ <vmomi>
+ <!-- MOB configuration -->
+ <mob>
+ <!-- Max size of POST requests in KB -->
+ <!-- <maxPostRequestSizeKB>1024</maxPostRequestSizeKB> -->
+ </mob>
+ <!-- VMOMI validator configuration -->
+ <validation>
+ <!-- The validation is enabled by default -->
+ <!-- <enabled>true</enabled> -->
+ </validation>
+ </vmomi>
+
+ <vmacore>
+ <pluginBaseDir>./</pluginBaseDir>
+ <!-- default thread pool configuration for Posix impl -->
+ <threadPool>
+ <IoMin>2</IoMin>
+ <IoMax>32</IoMax>
+ <TaskMin>2</TaskMin>
+ <TaskMax>12</TaskMax>
+ <MaxFdsPerThread> 2048 </MaxFdsPerThread>
+ <NumKeepAlive>8</NumKeepAlive>
+ <ThreadCheckTimeSecs>600</ThreadCheckTimeSecs>
+ <ThreadStackSizeKb>256</ThreadStackSizeKb>
+ <threadNamePrefix>hostd</threadNamePrefix>
+ <!-- <threadCountWarningThreshold>2</threadCountWarningThreshold> -->
+
+ <!-- Use fair work queues thread pool. -->
+ <!-- <fairThreadPool>false</fairThreadPool> -->
+
+ <!-- defaults to 200, Max number of threads used for FWQ items -->
+ <!-- <maxThreads>200</maxThreads> -->
+
+ <!-- defaults to 4, Initial number of threads used for FWQ items -->
+ <!-- <minThreads>4</minThreads> -->
+
+ <!-- defaults to 3, Ratio between the number of concurrent items in a
+ priority and threads reserved for higher priority queues.
+ One thread is reserver for every N concurrent items. -->
+ <!-- <reservationRatio>3</reservationRatio> -->
+
+ </threadPool>
+ <ssl>
+ <doVersionCheck> false </doVersionCheck>
+ <libraryPath>/usr/lib/vmware</libraryPath>
+ <useCompression> true </useCompression>
+
+ <!-- timeouts for the SSL handshake. the default is 20 sec. -->
+ <!-- <handshakeTimeoutMs>60000</handshakeTimeoutMs> -->
+ </ssl>
+
+ <http>
+ <!-- timeouts for HTTP connections. the defaults are infinite. -->
+ <!-- <readTimeoutMs>60000</readTimeoutMs> -->
+ <!-- <writeTimeoutMs>60000</writeTimeoutMs> -->
+
+ <!-- Num of max proxy connections -->
+ <!-- PR 604415: Temporary lower the connections limit to 128 -->
+ <maxConnections> 128 </maxConnections>
+ </http>
+
+ <vmdb>
+ <!-- maximum number of VMDB connections allowed -->
+ <!-- <maxConnectionCount>100</maxConnectionCount> -->
+
+ <!-- timeouts for VMDB connections. the defaults are infinite. -->
+ <!-- <readTimeoutMs>60000</readTimeoutMs> -->
+ <!-- <writeTimeoutMs>60000</writeTimeoutMs> -->
+ </vmdb>
+
+ <!-- enable plugin loading -->
+ <loadPlugins> true </loadPlugins>
+
+ <!-- enable/disable the dynamic loading of plugins -->
+ <loadDynamicPlugins> false </loadDynamicPlugins>
+
+ <!-- Enable/disable the stack tracer -->
+ <!-- <useStackTracer>false</useStackTracer> -->
+
+ <xml>
+ <doc>
+ <!-- maximum size of each XML message. -->
+ <maxChars>104857600</maxChars>
+ <!-- maximum nodes in of each XML message. -->
+ <maxNodes>524288</maxNodes>
+ <!-- maximum node depth of each XML message. -->
+ <maxDepth>1000</maxDepth>
+ </doc>
+ </xml>
+ </vmacore>
+
+ <dispatcher>
+ <!-- turns dispatcher on/off -->
+ <!-- <enabled>true</enabled> -->
+
+ <!-- Enables debugging output -->
+ <!-- <debug>false</debug> -->
+
+ <!-- Debug flags -->
+ <!-- <flags>0</flags> -->
+
+ <!-- The file containing dispatcher policies -->
+ <dispatcherConfig>/etc/vmware/hostd/dispatcher.xml</dispatcherConfig>
+
+ <!-- The file containing tag extraction rules -->
+ <tagExtractorConfig>/etc/vmware/hostd/tagExtractor.xml</tagExtractorConfig>
+ </dispatcher>
+
+ <plugins>
+ <vimsvc>
+ <path>libvimsvc.so</path>
+
+ <!-- default administrator principal -->
+ <!-- <defaultPrincipal>root</defaultPrincipal> -->
+
+ <!-- default file used to persist ACL data -->
+ <!-- <authorization>/etc/vmware/hostd/authorization.xml</authorization> -->
+
+ <!-- default file used to supply required privileges for dynamic methods -->
+ <!-- <dynMethodPrivConfig>/etc/vmware/hostd/dynMethodPriv.xml</dynMethodPrivConfig> -->
+
+ <!-- default setting for performing authorization checks -->
+ <enableAuthCheck>true</enableAuthCheck>
+
+ <!-- default setting for where vmware-hostd-ticket directory is created -->
+ <!-- <localTicketParentDir>/var/run</localTicketParentDir> -->
+
+ <!-- default setting for life time of a local ticket -->
+ <!-- <localTicketLifeSecs>10</localTicketLifeSecs> -->
+
+ <!-- default setting for maximum number of times a ticket can be used -->
+ <!-- <localTicketMaxUse>1</localTicketMaxUse> -->
+
+ <!-- time to retain tasks after they complete -->
+ <!-- <taskRetentionInMins> 10 </taskRetentionInMins> -->
+
+ <!-- cleanup interval time between task reaping -->
+ <!-- <taskCleanupIntervalInMins> 1 </taskCleanupIntervalInMins> -->
+
+ <!-- maximum number of events to store -->
+ <!-- <maxEvents>1000</maxEvents> -->
+
+ <!-- development build default setting for license mockup -->
+ <licenseMockup>false</licenseMockup>
+
+ <!-- Disable i18nFilter -->
+ <!-- <i18nFilterDisabled> false </i18nFilterDisabled> -->
+ <!-- cloning of objects by i18nFilter -->
+ <!-- <i18nCloneDisabled> true </i18nCloneDisabled> -->
+ <license>
+ <!-- location of the read-write flexlm configuration file -->
+ <!-- <config> /etc/vmware/license.cfg </config> -->
+ </license>
+ <userManager>
+ <!-- Max time in seconds to wait for a subcommand to complete -->
+ <!-- <subcommandWait> 10 </subcommandWait> -->
+ </userManager>
+
+ <!-- VC API lockdown mode (MN) - true to enable handling it -->
+ <apiLockdown>true</apiLockdown>
+
+ <requires>hostsvc solo</requires>
+
+ </vimsvc>
+ <hostsvc>
+ <path>libhostsvc.so</path>
+
+ <vflash>
+ <defaultVFlashModule>vfc</defaultVFlashModule>
+ <vffsUuid>0</vffsUuid>
+ <refreshVffsInterval>30</refreshVffsInterval>
+ </vflash>
+
+ <datastore>
+ <!-- default datastore inventory-->
+ <!-- <inventory>/etc/vmware/hostd/datastores.xml</inventory> -->
+
+ <!-- default datastore refresh interval in minutes -->
+ <!-- use 0 to disable the auto refresh -->
+ <!-- <refreshInterval>0</refreshInterval> -->
+
+ <!-- default refresh interval for datastore-freespace when provisioning virtual disks -->
+ <!-- <refreshVdiskInterval>30</refreshVdiskInterval> -->
+ </datastore>
+
+ <mockup>
+ <!-- turns mockup impl on/off -->
+ <enabled>false</enabled>
+
+ <!-- default filepath for host info -->
+ <filepath>/etc/vmware/hostd/mockup-host-config.xml</filepath>
+ </mockup>
+ <vmResources>/etc/vmware/hostd/vmResources.xml</vmResources>
+
+ <!-- default location of the hostsvc config file -->
+ <!-- <config>/etc/vmware/hostd/hostsvc.xml</config> -->
+
+ <!-- default location of the resource pool config file -->
+ <!-- <pools>/etc/vmware/hostd/pools.xml</pools> -->
+
+ <!-- default location of the host service list -->
+ <services>/etc/vmware/service/</services>
+
+ <storage>
+ <!-- storage data synchronization policy-->
+
+ <!-- policy: invalidate on configuration change (default) -->
+ <!-- <syncpolicy>invalid_change</syncpolicy> -->
+
+ <!-- policy: always fetch data when queried -->
+ <!-- <syncpolicy>fetch_always</syncpolicy> -->
+
+ <!-- policy: fetch data on configuration change -->
+ <!-- <syncpolicy>fetch_change</syncpolicy> -->
+
+ <!-- default storage inventory refetch interval, after getting multiple Path-state change events, in seconds -->
+ <refetchStorageInterval>120</refetchStorageInterval>
+ </storage>
+
+ <rsrc>
+ <!-- Refresh interval (in seconds) for root resource pool capacity -->
+ <!-- <refreshInterval>60</refreshInterval> -->
+ </rsrc>
+ <vmfs2upgrade>
+ <!-- <undoattempts>15</undoattempts> -->
+ <!-- <timeoutmsec>2000</timeoutmsec> -->
+ </vmfs2upgrade>
+
+ <!-- Controls to enable/disable expressions in the datastore filter -->
+ <!-- <datastoresystem> -->
+ <!-- <diskfilter> -->
+ <!-- <NoUsbDisks>true</NoUsbDisks> -->
+ <!-- <UsedAsVmRdm>true</UsedAsVmRdm> -->
+ <!-- </diskfilter> -->
+ <!-- </datastoresystem> -->
+
+ <!-- Controls to enable/disable expressions in the SCSI LUN filter -->
+ <!-- <scsilunfilter> -->
+ <!-- <NoUsbDisks>true</NoUsbDisks> -->
+ <!-- </scsilunfilter> -->
+
+ <!-- Controls to enable/disable expressions in the RDM filter -->
+ <!-- <rdmfilter> -->
+ <!-- <RdmCapable>true</RdmCapable> -->
+ <!-- </rdmfilter> -->
+ <!-- <maxVms> 512 </maxVms> -->
+ <NetmapFile> /etc/vmware/netmap.conf </NetmapFile>
+
+
+ <!-- Storage I/O Resource Manager settings -->
+ <storageiorm>
+ <enabled>false</enabled>
+ <congestionThreshold.min>5</congestionThreshold.min>
+ <congestionThreshold.max>100</congestionThreshold.max>
+ <congestionThreshold.default>30</congestionThreshold.default>
+ </storageiorm>
+ </hostsvc>
+ <vmsvc>
+ <path>libvmsvc.so</path>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+ <enableMockup>false</enableMockup>
+
+ <!--
+ Check for version mismatches against the vmkernel.
+ This is disabled by default for developers but for all other
+ users, they must keep their vmkernels upto date.
+ -->
+ <checkVersionMismatch> false </checkVersionMismatch>
+ <!-- <vmDirectory> /home/vmware </vmDirectory> -->
+ <!-- <maxSnapshotDepth> 32 </maxSnapshotDepth> -->
+
+ <!-- Configuration options for quiesced snapshots -->
+ <quiescedSnap>
+ <!-- Seconds that quiesce requests will queue before continuing. -->
+ <!-- <serializeTimeout> 120 </serializeTimeout> -->
+ </quiescedSnap>
+
+ <!-- The maximum number of virtual disks allowed on this host -->
+ <!-- <maxDisksPerVirtualMachine> 120 </maxDisksPerVirtualMachine> -->
+
+ <!-- The timer interval for task updates in microseconds -->
+ <!-- <taskTimerInterval> 1000000 </taskTimerInterval> -->
+
+ <!-- Default user context to use to perform VM operations -->
+ <!-- <datastorePrincipal>root</datastorePrincipal> -->
+
+ <!-- Virtual machine VMotion parameters -->
+ <vmotion>
+ <!-- Timeout for VMotion prepare operation (milliseconds) -->
+ <!-- <prepareTimeout> 30000 </prepareTimeout> -->
+
+ <!-- Timeout for VMotion source initiate operation (milliseconds) -->
+ <!-- <srcInitiateTimeout> 30000 </srcInitiateTimeout> -->
+
+ <!-- Timeout for VMotion destination ID population (milliseconds) -->
+ <!-- <dstIdTimeout> 120000 </dstIdTimeout> -->
+ </vmotion>
+ <!-- <defaultPowerOffType> soft </defaultPowerOffType> -->
+ <!-- <defaultSuspendType> hard </defaultSuspendType> -->
+ <!-- <defaultResetType> hard </defaultResetType> -->
+ <!-- <validateVMId> false </validateVMId> -->
+ <!-- <heartbeatCheckTimeInSecs> 30 </heartbeatCheckTimeInSecs> -->
+ <!-- <heartbeatRedAlert> 0.40 </heartbeatRedAlert> -->
+ <!-- <heartbeatYellowAlert> 0.80 </heartbeatYellowAlert> -->
+
+ <!-- Setting to enable/disable activation of change tracking -->
+ <!-- when upgrading a virtual machine's HW version to HW7 or newer -->
+ <!-- or when adding a new disk to a HW7 or newer VM. -->
+ <!-- <useChangeTracking> true </useChangeTracking> -->
+
+ <!-- Setting to enable/disable the use of vigorVim to read the -->
+ <!-- vm configuration information -->
+ <useVigorVim> true </useVigorVim>
+
+ <requires>vimsvc</requires>
+
+ </vmsvc>
+ <vcsvc>
+ <path>libvcsvc.so</path>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+ <!-- VMotion parameters -->
+ <vmotion>
+ <!-- Location of the VMotion journal; either an absolute -->
+ <!-- path or relative to the default log path -->
+ <!-- <journalDir> journal </journalDir> -->
+
+ <!-- Source-side VMotion timeout (milliseconds) -->
+ <!-- <srcBeginTimeout> 240000 </srcBeginTimeout> -->
+
+ <!-- Destination-side VMotion timeout (milliseconds) -->
+ <!-- <dstBeginTimeout> 60000 </dstBeginTimeout> -->
+ </vmotion>
+
+ <!-- AgentManager parameters -->
+ <agentMgr>
+ <!-- Timeout (in seconds) for the upgrade command -->
+ <!-- <timeout> 360 </timeout> -->
+
+ <!-- Name of the upgrade directory (relative to a provided tmpdir) -->
+ <!-- <upgradeDir> ha-agentmgr </upgradeDir> -->
+
+ <!-- upgradeKey is a path to a file containing an public key -->
+ <!-- <upgradeKey>/etc/vmware/hostd/key.pub</upgradeKey> -->
+
+ <!-- Path to shell -->
+ <!-- <shellPath>/bin/sh</shellPath> -->
+
+ </agentMgr>
+
+ <requires>hostsvc</requires>
+
+ </vcsvc>
+ <solo>
+ <path>libsolo.so</path>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+
+ <!-- The file containing the list of environment description files -->
+ <environments>/etc/vmware/hostd/environments.xml</environments>
+
+ <!-- The file containing the virtual machine inventory -->
+ <vmInventory>/etc/vmware/hostd/vmInventory.xml</vmInventory>
+
+ <!-- The file containing the AutoStart settings -->
+ <!-- <vmAutoStart>/etc/vmware/hostd/vmAutoStart.xml</vmAutoStart> -->
+
+ <!-- The file containing the resource pool and VM resource settings -->
+ <!-- <resources>/etc/vmware/hostd/resources.xml</resources> -->
+
+ <!-- The file containing the provisoning policies -->
+ <provisioningPolicy>/etc/vmware/hostd/env/provisioningPolicy.xml</provisioningPolicy>
+
+ <!-- The file containing the hardware info mockup -->
+ <hwInfo>/etc/vmware/hostd/hwInfo.xml</hwInfo>
+
+ <!-- Whether to use the real network list or just use mockups -->
+ <!-- <loadRealNetworks> true </loadRealNetworks> -->
+
+ <!-- Whether to use the real pciPassthru list or just use mockups -->
+ <!-- <loadRealPciPassthru> true </loadRealPciPassthru> -->
+
+ <!-- Whether to use the real datastore list or just use mockups -->
+ <!-- <loadRealDatastores> true </loadRealDatastores> -->
+
+ <!-- Whether to use the real rdm list or the mockup list. -->
+ <!-- <loadRealRdmInfo> true </loadRealRdmInfo> -->
+
+ <!-- Whether to use the real device (cd,flp,serial,||,sound) -->
+ <!-- list or the mockup. -->
+ <!-- <loadRealHwInfo> true </loadRealHwInfo> -->
+
+ <!-- Controls to enable/disable expressions in the RDM filter -->
+ <!-- <rdmfilter> -->
+ <!-- Only show disks that are attached to shared storage. -->
+ <!-- <HbaIsShared>true</HbaIsShared> -->
+
+ <!-- Only show disks that are not an extent of a VMFS volume. -->
+ <!-- <UsedByVmfs>true</UsedByVmfs> -->
+
+ <!-- Only show disks that are not already used as an RDM target. -->
+ <!-- <UsedAsVmRdm>true</UsedAsVmRdm> -->
+ <!-- </rdmfilter> -->
+
+ <!-- Whether to use the real rdm list or the mockup list. -->
+ <!-- <loadRealPassthroughInfo> true </loadRealPassthroughInfo> -->
+
+ <!-- Whether to populate usb info from the mockup list. -->
+ <!-- <loadRealUsbInfo> true </loadRealUsbInfo> -->
+
+ <!-- Disable Resource Pool Initialization -->
+ <!-- <disableResourcePoolInit> false </disableResourcePoolInit> -->
+
+ <!-- Soap port. Also turns on proxy forwarding to a TCP port -->
+ <soapPort> 8307 </soapPort>
+
+ <!-- Secure Soap port for accecpting SSL tunneling from proxy -->
+ <!-- If disabled, SSL tunneling is done over a named pipe. -->
+ <!-- <secureSoapPort> 8306 </secureSoapPort> -->
+
+ <!-- Whether to enable secure Soap adapter -->
+ <enableSecureSoap> false </enableSecureSoap>
+
+ <!-- 64 bit support -->
+ <!-- <support64bit> true </support64bit> -->
+
+ <!-- Enable Vmomi tracing -->
+ <!-- <traceVmomi> true </traceVmomi> -->
+
+ <!-- The log level at which to output vmomi tracing -->
+ <traceAt> verbose </traceAt>
+
+ <!-- Whether to only trace faults in the return -->
+ <!-- <traceFaultsOnly> true </traceFaultsOnly> -->
+
+ <!-- Cause segv -->
+ <!-- <causeSegv> false </causeSegv> -->
+
+ <!-- Cause exception -->
+ <!-- <causeException> false </causeException> -->
+
+ <loglevels>
+ <module>
+ <name> disklib </name>
+ <level> 0 </level>
+ </module>
+ <!-- <module> -->
+ <!-- <name> baz </name> -->
+ <!-- <level> 2 </level> -->
+ <!-- <extension> bar </extension> -->
+ <!-- </module> -->
+ </loglevels>
+
+ <!-- web server settings -->
+ <webServer>
+
+ <docRoot> /usr/lib/vmware/hostd/docroot/</docRoot>
+ <cgiBinPath> /usr/lib/vmware/hostd/cgi-bin/</cgiBinPath>
+ </webServer>
+
+ <!-- Enable managed object browser -->
+ <!-- <enableMob>true</enableMob> -->
+
+ <!-- periodic keep alive logging -->
+ <!-- <runTimerTest> false </runTimerTest> -->
+ <!-- <runTimerIntervalInSecs> 3 </runTimerIntervalInSecs> -->
+
+ <dynamo>
+ <enabled> false </enabled>
+
+ <manager id="0">
+ <enabled> true </enabled>
+ <moId>ha-dynamic-type-manager-python</moId>
+ <type>soap-stdio</type>
+ <soap-stdio>
+ <command>/usr/bin/sh</command>
+ <arg id="0">-l</arg>
+ <arg id="1">-c</arg>
+ <arg id="2">/usr/bin/python -m PyVmomiServer -g --loglevel info -s PyVmomiServer</arg>
+ </soap-stdio>
+ </manager>
+
+ <manager id="1">
+ <enabled> false </enabled>
+ <moId>ha-dynamic-type-manager-vapi</moId>
+ <type>soap-http</type>
+ <soap-http>
+ <port>8088</port>
+ <command>/usr/bin/sh</command>
+ <arg id="0">-l</arg>
+ <arg id="1">-c</arg>
+ <arg id="2">/sbin/vapid -s vapid</arg>
+ </soap-http>
+ </manager>
+
+ <manager id="2">
+ <enabled> true </enabled>
+ <moId>ha-dynamic-type-manager-local-cli</moId>
+ <type>vmware-cli</type>
+ <vmware-cli>
+ <path>/usr/lib/vmware/esxcli</path>
+ </vmware-cli>
+ </manager>
+ </dynamo>
+
+ <!-- Managed method executer -->
+ <!-- <mme> -->
+ <!-- <enabled> true </enabled> -->
+ <!-- </mme> -->
+
+ <requires>hostsvc</requires>
+ </solo>
+
+ <!-- Reverse HTTP Proxy service -->
+ <proxysvc>
+ <path>libproxysvc.so</path>
+
+ <!-- default location of the proxy config file for hosted products-->
+ <config>/etc/vmware/hostd/proxy.xml</config>
+ <!-- default location of proxy config file for ESX-->
+ <endpoints>/etc/vmware/rhttpproxy/endpoints.conf</endpoints>
+ <requires>hostsvc</requires>
+
+ </proxysvc>
+
+ <statssvc>
+ <path>libstatssvc.so</path>
+ <enabled>false</enabled>
+ <mockup>
+ <!-- turns mockup impl on/off -->
+ <enabled>false</enabled>
+ </mockup>
+
+ <!-- Directory to store stats related files in -->
+ <!-- <depotDir> /var/lib/vmware/hostd/stats/ </depotDir> -->
+
+ <!-- Name of the StatsDepot -->
+ <!-- <depotName> hostAgentStats </depotName> -->
+
+ <!-- Max number of stats to purge in one shot -->
+ <!-- <maxStatsPurged> 1000 </maxStatsPurged> -->
+
+ <!-- Real time stats collection interval -->
+ <!-- <collectionInterval> 20 </collectionInterval> -->
+
+ <!-- Enable historical stats collection -->
+ <!-- <historicalStatsEnabled> true </historicalStatsEnabled> -->
+ <!-- Enable collection of virtual disk stats -->
+ <!-- <collectVdiskStats> true </collectVdiskStats> -->
+ <!-- Enable collection of Host Datastore stats -->
+ <!-- <collectHostDsStats> true </collectHostDsStats> -->
+ <!-- Enable collection of Storage Path and Adapter stats -->
+ <!-- <collectPathAdapterStats> true </collectPathAdapterStats> -->
+ <!-- Enable collection of VM Datastore stats -->
+ <!-- <collectVmDsStats>true </collectVmDsStats> -->
+ <!-- Enable collection of VFlash Module stats -->
+ <!-- <collectVFlashModuleStats> true </collectVFlashModuleStats> -->
+ <!-- Enable collection of VSAN DOM stats -->
+ <!-- <collectVSanDomStats> false </collectVSanDomStats> -->
+
+ </statssvc>
+
+ <partitionsvc>
+ <path>libpartitionsvc.so</path>
+ <enabled>false</enabled>
+ </partitionsvc>
+
+ <internalsvc>
+ <path>libinternalsvc.so</path>
+ <requires>hostsvc</requires>
+ </internalsvc>
+
+ <!-- The nfc service -->
+ <nfcsvc>
+ <path>libnfcsvc.so</path>
+ <enabled>true</enabled>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+ </nfcsvc>
+
+ <snmpsvc>
+ <enabled>false</enabled>
+ <path>libsnmpsvc.so</path>
+ </snmpsvc>
+
+ <blklistsvc>
+ <path>libblklistsvc.so</path>
+ <enabled>false</enabled>
+ <!-- <leaseTimeoutSecs> 150 </leaseTimeoutSecs> -->
+ <!-- <wblEnabled> true </wblEnabled> -->
+ </blklistsvc>
+
+ <cimsvc>
+ <path>libcimsvc.so</path>
+ <enabled>false</enabled>
+ </cimsvc>
+
+ <directorysvc>
+ <path>libdirectorysvc.so</path>
+ <enabled>false</enabled>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+ </directorysvc>
+
+ <vdisksvc>
+ <path>libvdisksvc.so</path>
+ <enabled>false</enabled>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+ </vdisksvc>
+
+ <httpnfcsvc>
+ <path>libhttpnfcsvc.so</path>
+ <enabled>false</enabled>
+ <mockup>
+ <enabled>false</enabled>
+ </mockup>
+ <requires>proxysvc</requires>
+ </httpnfcsvc>
+
+ <ovfmgrsvc>
+ <path>libovfmgrsvc.so</path>
+ <enabled>true</enabled>
+ </ovfmgrsvc>
+
+ <dynsvc>
+ <path>libdynsvc.so</path>
+ <enabled>false</enabled>
+ <dynamic>true</dynamic>
+ </dynsvc>
+
+ <guestsvc>
+ <path>libguestsvc.so</path>
+ <enabled>false</enabled>
+ </guestsvc>
+
+ <hbrsvc>
+ <path>libhbrsvc.so</path>
+ <enabled>false</enabled>
+ <mockup>
+ <!-- Mock HBR is on if running in the the simulator -->
+ <enabled>false</enabled>
+ </mockup>
+ <requires>vmsvc</requires>
+ </hbrsvc>
+
+ <cbrcsvc>
+ <path>libcbrcsvc.so</path>
+ <enabled>false</enabled>
+ </cbrcsvc>
+
+
+ </plugins>
+
+ <!--Locale preferences-->
+ <!--DefaultLocale - this is the preferred default locale -->
+ <!--InstallPath - this is the location of the locale files-->
+ <!--
+ <locale>
+ <DefaultLocale>en_US</DefaultLocale>
+ <InstallPath>./locale/</InstallPath>
+ </locale>
+ -->
+
+</config>
diff --git a/configure-initscript.sh b/configure-initscript.sh
new file mode 100755
index 000000000000..95d9e9cc5bb8
--- /dev/null
+++ b/configure-initscript.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+action="$1" # add, remove, or status
+serviceName="$2"
+startLevel="$3"
+stopLevel="$4"
+
+# Notes:
+# This package does not need a vmware service to make VMware usable, so this script says that vmware service is always started.
+# vmware-workstation-server service is named vmware-hostd in this package.
+
+case "$serviceName" in
+ vmware-workstation-server)
+ serviceName="vmware-hostd"
+ ;;
+esac
+
+#echo $serviceName && exit # DEBUG
+
+addService() {
+ if [ "$serviceName" != "vmware" ]; then
+ systemctl start $serviceName.service
+ systemctl enable $serviceName.service
+ fi
+}
+
+removeService() {
+ if [ "$serviceName" != "vmware" ]; then
+ systemctl stop $serviceName.service
+ systemctl disable $serviceName.service
+ fi
+}
+
+# Check to see whether a program is set to start on boot.
+checkService() {
+ if [ "$serviceName" = "vmware" ]; then
+ retval=0
+ else
+ systemctl is-active $serviceName.service > /dev/null
+ retval=$?
+ fi
+
+ if [ "$retval" = "0" ]; then
+ echo 'on'
+ exit 5
+ else
+ echo 'off'
+ exit 6
+ fi
+}
+
+usage() {
+ echo "Syntax for this script is as follows:"
+ echo ""
+ echo " $0 <action> <serviceName>"
+ echo ""
+ echo " action - add or remove"
+ echo " serviceName - The name of the service"
+ echo ""
+ echo ""
+ echo " $0 status <serviceName>"
+ echo " serviceName - The name of the service"
+ echo ""
+}
+
+
+
+case $action in
+ add)
+ # Don't allow any empty arguments for add
+ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ]; then
+ usage
+ exit 1
+ fi
+ addService
+ ;;
+ remove)
+ # Don't allow any empty arguments for remove
+ if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ] || [ "$4" = "" ]; then
+ usage
+ exit 1
+ fi
+ removeService
+ ;;
+ status)
+ # We only need the serviceName to check status
+ if [ "$1" = "" ] || [ "$2" = "" ]; then
+ usage
+ exit 1
+ fi
+ checkService
+ ;;
+ *)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/datastores.xml b/datastores.xml
new file mode 100644
index 000000000000..452bbe43dba8
--- /dev/null
+++ b/datastores.xml
@@ -0,0 +1,15 @@
+<ConfigRoot>
+ <LocalDatastores>
+ <_length>1</_length>
+ <_type>hostd.host.LocalDatastoreEntry[]</_type>
+ <e id="0">
+ <_type>hostd.host.LocalDatastoreEntry</_type>
+ <dynamicProperty>
+ <_length>0</_length>
+ <_type>vmodl.DynamicProperty[]</_type>
+ </dynamicProperty>
+ <name>standard</name>
+ <path>/var/lib/vmware/Shared VMs</path>
+ </e>
+ </LocalDatastores>
+</ConfigRoot>
diff --git a/dkms.conf.in b/dkms.conf.in
new file mode 100644
index 000000000000..64c93aa0c18c
--- /dev/null
+++ b/dkms.conf.in
@@ -0,0 +1,30 @@
+# Linux DKMS config script for the VMware guest kernel modules
+
+PACKAGE_NAME="@PKGNAME@"
+PACKAGE_VERSION="@PKGVER@"
+MAKE="make KVERSION=$kernelver SRCDIR=/usr/src/$PACKAGE_NAME-$PACKAGE_VERSION"
+CLEAN="make clean"
+AUTOINSTALL="YES"
+
+BUILT_MODULE_NAME[0]="vmmon"
+BUILT_MODULE_LOCATION[0]='vmmon-only'
+DEST_MODULE_LOCATION[0]="/kernel/drivers/misc"
+
+BUILT_MODULE_NAME[1]="vmnet"
+BUILT_MODULE_LOCATION[1]='vmnet-only'
+DEST_MODULE_LOCATION[1]="/kernel/drivers/net"
+
+# seems that this module is never used
+#BUILT_MODULE_NAME[2]="vmblock"
+#BUILT_MODULE_LOCATION[2]='vmblock-only'
+#DEST_MODULE_LOCATION[2]="/kernel/fs/vmblock"
+
+# vmci is already provided by the kernel with vmw_vmci
+#BUILT_MODULE_NAME[3]="vmci"
+#BUILT_MODULE_LOCATION[3]='vmci-only'
+#DEST_MODULE_LOCATION[3]="/kernel/drivers/misc"
+
+# vsock is already provided by the kernel
+#BUILT_MODULE_NAME[4]="vsock"
+#BUILT_MODULE_LOCATION[4]='vsock-only'
+#DEST_MODULE_LOCATION[4]="/kernel/net/vmw_vsock"
diff --git a/environments.xml b/environments.xml
new file mode 100644
index 000000000000..58bde49fb333
--- /dev/null
+++ b/environments.xml
@@ -0,0 +1,34 @@
+<Environment>
+ <Cfg id = "1">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw3.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw3.xml</Options>
+ </Cfg>
+ <Cfg id = "2">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw4.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw4.xml</Options>
+ </Cfg>
+ <Cfg id = "3">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw6.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw6.xml</Options>
+ </Cfg>
+ <Cfg id = "4">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw7.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw7.xml</Options>
+ </Cfg>
+ <Cfg id = "5">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw8.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw8.xml</Options>
+ </Cfg>
+ <Cfg id = "6">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw9.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw9.xml</Options>
+ </Cfg>
+ <Cfg id = "7">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw10.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw10.xml</Options>
+ </Cfg>
+ <Cfg id = "8">
+ <Descriptor> /etc/vmware/hostd/env/ws-hw11.xml </Descriptor>
+ <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw11.xml</Options>
+ </Cfg>
+</Environment>
diff --git a/pam.d-vmware-authd b/pam.d-vmware-authd
new file mode 100644
index 000000000000..44391264ebf9
--- /dev/null
+++ b/pam.d-vmware-authd
@@ -0,0 +1,5 @@
+#%PAM-1.0
+auth required pam_unix.so
+account required pam_unix.so
+password required pam_permit.so
+session required pam_unix.so
diff --git a/proxy.xml b/proxy.xml
new file mode 100644
index 000000000000..d9ab5039838c
--- /dev/null
+++ b/proxy.xml
@@ -0,0 +1,50 @@
+<ConfigRoot>
+ <httpPort>-1</httpPort>
+ <httpsPort>443</httpsPort>
+ <EndpointList>
+ <_length>7</_length>
+ <_type>vim.ProxyService.EndpointSpec[]</_type>
+ <e id="0">
+ <_type>vim.ProxyService.NamedPipeServiceSpec</_type>
+ <accessMode>httpAndHttps</accessMode>
+ <pipeName>/var/run/vmware/proxy-webserver</pipeName>
+ <serverNamespace>/</serverNamespace>
+ </e>
+ <e id="1">
+ <_type>vim.ProxyService.LocalServiceSpec</_type>
+ <accessMode>httpsWithRedirect</accessMode>
+ <port>8307</port>
+ <serverNamespace>/sdk</serverNamespace>
+ </e>
+ <e id="2">
+ <_type>vim.ProxyService.LocalServiceSpec</_type>
+ <accessMode>httpsWithRedirect</accessMode>
+ <port>8308</port>
+ <serverNamespace>/ui</serverNamespace>
+ </e>
+ <e id="3">
+ <_type>vim.ProxyService.NamedPipeServiceSpec</_type>
+ <accessMode>httpsOnly</accessMode>
+ <pipeName>/var/run/vmware/proxy-vpxa</pipeName>
+ <serverNamespace>/vpxa</serverNamespace>
+ </e>
+ <e id="4">
+ <_type>vim.ProxyService.NamedPipeServiceSpec</_type>
+ <accessMode>httpsWithRedirect</accessMode>
+ <pipeName>/var/run/vmware/proxy-mob</pipeName>
+ <serverNamespace>/mob</serverNamespace>
+ </e>
+ <e id="5">
+ <_type>vim.ProxyService.LocalServiceSpec</_type>
+ <accessMode>httpAndHttps</accessMode>
+ <port>12001</port>
+ <serverNamespace>/ha-nfc</serverNamespace>
+ </e>
+ <e id="6">
+ <_type>vim.ProxyService.LocalServiceSpec</_type>
+ <accessMode>httpAndHttps</accessMode>
+ <port>12000</port>
+ <serverNamespace>/nfc</serverNamespace>
+ </e>
+ </EndpointList>
+</ConfigRoot>
diff --git a/unlocker.py b/unlocker.py
new file mode 100644
index 000000000000..94d29e0964d3
--- /dev/null
+++ b/unlocker.py
@@ -0,0 +1,429 @@
+#!/usr/bin/env python
+"""
+The MIT License (MIT)
+
+Copyright (c) 2014-2016 Dave Parsons & Sam Bingner
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the 'Software'), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+vSMC Header Structure
+Offset Length Struct Type Description
+----------------------------------------
+0x00/00 0x08/08 Q ptr Offset to key table
+0x08/08 0x04/4 I int Number of private keys
+0x0C/12 0x04/4 I int Number of public keys
+
+vSMC Key Data Structure
+Offset Length Struct Type Description
+----------------------------------------
+0x00/00 0x04/04 4s int Key name (byte reversed e.g. #KEY is YEK#)
+0x04/04 0x01/01 B byte Length of returned data
+0x05/05 0x04/04 4s int Data type (byte reversed e.g. ui32 is 23iu)
+0x09/09 0x01/01 B byte Flag R/W
+0x0A/10 0x06/06 6x byte Padding
+0x10/16 0x08/08 Q ptr Internal VMware routine
+0x18/24 0x30/48 48B byte Data
+"""
+
+from __future__ import print_function
+import codecs
+import os
+import six
+import struct
+import subprocess
+import sys
+
+if sys.version_info < (2, 7):
+ sys.stderr.write('You need Python 2.7 or later\n')
+ sys.exit(1)
+
+# Setup imports depending on whether IronPython or CPython
+if sys.platform == 'win32' \
+ or sys.platform == 'cli':
+ from _winreg import *
+
+
+def bytetohex(data):
+ if sys.version_info > (3, 0):
+ # Python 3 code in this block
+ return "".join("{:02X} ".format(c) for c in data)
+ else:
+ # Python 2 code in this block
+ return "".join("{:02X} ".format(ord(c)) for c in data)
+
+
+def joinpath(folder, filename):
+ return os.path.join(folder, filename)
+
+
+def printkey(i, offset, smc_key, smc_data):
+ print(str(i + 1).zfill(3)
+ + ' ' + hex(offset)
+ + ' ' + smc_key[0][::-1].decode('UTF-8')
+ + ' ' + str(smc_key[1]).zfill(2)
+ + ' ' + smc_key[2][::-1].replace(b'\x00', b' ').decode('UTF-8')
+ + ' ' + '{0:#0{1}x}'.format(smc_key[3], 4)
+ + ' ' + hex(smc_key[4])
+ + ' ' + bytetohex(smc_data))
+
+
+def set_bit(value, bit):
+ return value | (1 << bit)
+
+
+def clear_bit(value, bit):
+ return value & ~(1 << bit)
+
+
+def test_bit(value, bit):
+ return value & bit
+
+
+E_CLASS64 = 2
+E_SHT_RELA = 4
+
+
+def patchelf(f, oldoffset, newoffset):
+ f.seek(0)
+ magic = f.read(4)
+ if not magic == b'\x7fELF':
+ raise Exception('Magic number does not match')
+
+ ei_class = struct.unpack('=B', f.read(1))[0]
+ if ei_class != E_CLASS64:
+ raise Exception('Not 64bit elf header: ' + ei_class)
+
+ f.seek(40)
+ e_shoff = struct.unpack('=Q', f.read(8))[0]
+ f.seek(58)
+ e_shentsize = struct.unpack('=H', f.read(2))[0]
+ e_shnum = struct.unpack('=H', f.read(2))[0]
+ e_shstrndx = struct.unpack('=H', f.read(2))[0]
+
+ print('e_shoff: 0x{:x} e_shentsize: 0x{:x} e_shnum:0x{:x} e_shstrndx:0x{:x}'.format(e_shoff, e_shentsize,
+ e_shnum, e_shstrndx))
+
+ for i in range(0, e_shnum):
+ f.seek(e_shoff + i * e_shentsize)
+ e_sh = struct.unpack('=LLQQQQLLQQ', f.read(e_shentsize))
+ # e_sh_name = e_sh[0]
+ e_sh_type = e_sh[1]
+ e_sh_offset = e_sh[4]
+ e_sh_size = e_sh[5]
+ e_sh_entsize = e_sh[9]
+ if e_sh_type == E_SHT_RELA:
+ e_sh_nument = int(e_sh_size / e_sh_entsize)
+ # print 'RELA at 0x{:x} with {:d} entries'.format(e_sh_offset, e_sh_nument)
+ for j in range(0, e_sh_nument):
+ f.seek(e_sh_offset + e_sh_entsize * j)
+ rela = struct.unpack('=QQq', f.read(e_sh_entsize))
+ r_offset = rela[0]
+ r_info = rela[1]
+ r_addend = rela[2]
+ if r_addend == oldoffset:
+ r_addend = newoffset
+ f.seek(e_sh_offset + e_sh_entsize * j)
+ f.write(struct.pack('=QQq', r_offset, r_info, r_addend))
+ print('Relocation modified at: ' + hex(e_sh_offset + e_sh_entsize * j))
+
+
+def patchkeys(f, key):
+ # Setup struct pack string
+ key_pack = '=4sB4sB6xQ'
+ # smc_old_memptr = 0
+ smc_new_memptr = 0
+
+ # Do Until OSK1 read
+ i = 0
+ while True:
+
+ # Read key into struct str and data byte str
+ offset = key + (i * 72)
+ f.seek(offset)
+ smc_key = struct.unpack(key_pack, f.read(24))
+ smc_data = f.read(smc_key[1])
+
+ # Reset pointer to beginning of key entry
+ f.seek(offset)
+
+ if smc_key[0] == b'SKL+':
+ # Use the +LKS data routine for OSK0/1
+ smc_new_memptr = smc_key[4]
+ print('+LKS Key: ')
+ printkey(i, offset, smc_key, smc_data)
+
+ elif smc_key[0] == b'0KSO':
+ # Write new data routine pointer from +LKS
+ print('OSK0 Key Before:')
+ printkey(i, offset, smc_key, smc_data)
+ # smc_old_memptr = smc_key[4]
+ f.seek(offset)
+ f.write(struct.pack(key_pack, smc_key[0], smc_key[1], smc_key[2], smc_key[3], smc_new_memptr))
+ f.flush()
+
+ # Write new data for key
+ f.seek(offset + 24)
+ smc_new_data = codecs.encode('bheuneqjbexolgurfrjbeqfthneqrqcy', 'rot_13')
+ f.write(smc_new_data.encode('UTF-8'))
+ f.flush()
+
+ # Re-read and print key
+ f.seek(offset)
+ smc_key = struct.unpack(key_pack, f.read(24))
+ smc_data = f.read(smc_key[1])
+ print('OSK0 Key After:')
+ printkey(i, offset, smc_key, smc_data)
+
+ elif smc_key[0] == b'1KSO':
+ # Write new data routine pointer from +LKS
+ print('OSK1 Key Before:')
+ printkey(i, offset, smc_key, smc_data)
+ smc_old_memptr = smc_key[4]
+ f.seek(offset)
+ f.write(struct.pack(key_pack, smc_key[0], smc_key[1], smc_key[2], smc_key[3], smc_new_memptr))
+ f.flush()
+
+ # Write new data for key
+ f.seek(offset + 24)
+ smc_new_data = codecs.encode('rnfrqbagfgrny(p)NccyrPbzchgreVap', 'rot_13')
+ f.write(smc_new_data.encode('UTF-8'))
+ f.flush()
+
+ # Re-read and print key
+ f.seek(offset)
+ smc_key = struct.unpack(key_pack, f.read(24))
+ smc_data = f.read(smc_key[1])
+ print('OSK1 Key After:')
+ printkey(i, offset, smc_key, smc_data)
+
+ # Finished so get out of loop
+ break
+
+ else:
+ pass
+
+ i += 1
+ return smc_old_memptr, smc_new_memptr
+
+
+def patchsmc(name, sharedobj):
+ with open(name, 'r+b') as f:
+
+ smc_old_memptr = 0
+ smc_new_memptr = 0
+
+ # Read file into string variable
+ vmx = f.read()
+
+ print('File: ' + name)
+
+ # Setup hex string for vSMC headers
+ # These are the private and public key counts
+ smc_header_v0 = b'\xF2\x00\x00\x00\xF0\x00\x00\x00'
+ smc_header_v1 = b'\xB4\x01\x00\x00\xB0\x01\x00\x00'
+
+ # Setup hex string for #KEY key
+ key_key = b'\x59\x45\x4B\x23\x04\x32\x33\x69\x75'
+
+ # Setup hex string for $Adr key
+ adr_key = b'\x72\x64\x41\x24\x04\x32\x33\x69\x75'
+
+ # Find the vSMC headers
+ smc_header_v0_offset = vmx.find(smc_header_v0) - 8
+ smc_header_v1_offset = vmx.find(smc_header_v1) - 8
+
+ # Find '#KEY' keys
+ smc_key0 = vmx.find(key_key)
+ smc_key1 = vmx.rfind(key_key)
+
+ # Find '$Adr' key only V1 table
+ smc_adr = vmx.find(adr_key)
+
+ # Print vSMC0 tables and keys
+ print('appleSMCTableV0 (smc.version = "0")')
+ print('appleSMCTableV0 Address : ' + hex(smc_header_v0_offset))
+ print('appleSMCTableV0 Private Key #: 0xF2/242')
+ print('appleSMCTableV0 Public Key #: 0xF0/240')
+
+ if (smc_adr - smc_key0) != 72:
+ print('appleSMCTableV0 Table : ' + hex(smc_key0))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key0)
+ elif (smc_adr - smc_key1) != 72:
+ print('appleSMCTableV0 Table : ' + hex(smc_key1))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key1)
+
+ print()
+
+ # Print vSMC1 tables and keys
+ print('appleSMCTableV1 (smc.version = "1")')
+ print('appleSMCTableV1 Address : ' + hex(smc_header_v1_offset))
+ print('appleSMCTableV1 Private Key #: 0x01B4/436')
+ print('appleSMCTableV1 Public Key #: 0x01B0/432')
+
+ if (smc_adr - smc_key0) == 72:
+ print('appleSMCTableV1 Table : ' + hex(smc_key0))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key0)
+ elif (smc_adr - smc_key1) == 72:
+ print('appleSMCTableV1 Table : ' + hex(smc_key1))
+ smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key1)
+
+ print()
+
+ # Find matching RELA record in .rela.dyn in ESXi ELF files
+ # This is temporary code until proper ELF parsing written
+ if sharedobj:
+ print('Modifying RELA records from: ' + hex(smc_old_memptr) + ' to ' + hex(smc_new_memptr))
+ patchelf(f, smc_old_memptr, smc_new_memptr)
+
+ # Tidy up
+ f.flush()
+ f.close()
+
+
+def patchbase(name):
+ # Patch file
+ print('GOS Patching: ' + name)
+ f = open(name, 'r+b')
+
+ # Entry to search for in GOS table
+ # Should work for 12 & 14 of Workstation...
+ darwin = b'\x10\x00\x00\x00\x10\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00' \
+ '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
+
+ # Read file into string variable
+ base = f.read()
+
+ # Loop through each entry and set top bit
+ # 0xBE --> 0xBF (WKS 12)
+ # 0x3E --> 0x3F (WKS 14)
+ offset = 0
+ while offset < len(base):
+ offset = base.find(darwin, offset)
+ if offset == -1:
+ break
+ f.seek(offset + 32)
+ flag = ord(f.read(1))
+ flag = set_bit(flag, 0)
+ flag = chr(flag)
+ f.seek(offset + 32)
+ f.write(flag)
+ print('GOS Patched flag @: ' + hex(offset))
+ offset += 40
+
+ # Tidy up
+ f.flush()
+ f.close()
+ print('GOS Patched: ' + name)
+
+
+def patchvmkctl(name):
+ # Patch file
+ print('smcPresent Patching: ' + name)
+ f = open(name, 'r+b')
+
+ # Read file into string variable
+ vmkctl = f.read()
+ applesmc = vmkctl.find(b'applesmc')
+ f.seek(applesmc)
+ f.write(b'vmkernel')
+
+ # Tidy up
+ f.flush()
+ f.close()
+ print('smcPresent Patched: ' + name)
+
+
+def main():
+ # Work around absent Platform module on VMkernel
+ if os.name == 'nt' or os.name == 'cli':
+ osname = 'windows'
+ else:
+ osname = os.uname()[0].lower()
+
+ vmwarebase = ''
+ libvmkctl32 = ''
+ libvmkctl64 = ''
+ vmx_so = False
+
+ # Setup default paths
+ if osname == 'darwin':
+ vmx_path = '/Applications/VMware Fusion.app/Contents/Library/'
+ vmx = joinpath(vmx_path, 'vmware-vmx')
+ vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug')
+ vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats')
+
+ elif osname == 'linux':
+ vmx_path = '/usr/lib/vmware/bin/'
+ vmx = joinpath(vmx_path, 'vmware-vmx')
+ vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug')
+ vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats')
+ if os.path.isfile('/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so'):
+ vmx_so = True
+ vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so'
+ else:
+ vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so.0/libvmwarebase.so.0'
+
+ elif osname == 'vmkernel':
+ vmx_path = os.path.dirname(os.path.abspath(__file__))
+ vmx = joinpath(vmx_path, '/unlocker/bin/vmx')
+ vmx_debug = joinpath(vmx_path, '/unlocker/bin/vmx-debug')
+ vmx_stats = joinpath(vmx_path, '/unlocker/bin/vmx-stats')
+ vmx_so = True
+ libvmkctl32 = joinpath(vmx_path, '/unlocker/lib/libvmkctl.so')
+ libvmkctl64 = joinpath(vmx_path, '/unlocker/lib64/libvmkctl.so')
+
+ elif osname == 'windows':
+ reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE)
+ key = OpenKey(reg, r'SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation')
+ vmwarebase_path = QueryValueEx(key, 'InstallPath')[0]
+ vmx_path = QueryValueEx(key, 'InstallPath64')[0]
+ vmx = joinpath(vmx_path, 'vmware-vmx.exe')
+ vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug.exe')
+ vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats.exe')
+ vmwarebase = joinpath(vmwarebase_path, 'vmwarebase.dll')
+
+ else:
+ print('Unknown Operating System: ' + osname)
+ return
+
+ # Patch the vmx executables skipping stats version for Player
+ patchsmc(vmx, vmx_so)
+ patchsmc(vmx_debug, vmx_so)
+ if os.path.isfile(vmx_stats):
+ patchsmc(vmx_stats, vmx_so)
+
+ # Patch vmwarebase for Workstation and Player
+ # Not required on Fusion or ESXi as table already has correct flags
+ if vmwarebase != '':
+ patchbase(vmwarebase)
+ else:
+ pass
+
+ # Patch libvmkctl to return Apple SMC present
+ if osname == 'vmkernel':
+ # Patch ESXi 6.0 and 6.5 32 bit .so
+ patchvmkctl(libvmkctl32)
+
+ # Patch ESXi 6.5 64 bit .so
+ if os.path.isfile(libvmkctl64):
+ patchvmkctl(libvmkctl64)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/vmmon.patch b/vmmon.patch
new file mode 100644
index 000000000000..98121825e1f3
--- /dev/null
+++ b/vmmon.patch
@@ -0,0 +1,1318 @@
+diff --git a/vmmon/Makefile b/vmmon/Makefile
+index de8162e..6124a71 100644
+--- a/vmmon/Makefile
++++ b/vmmon/Makefile
+@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared
+ endif
+
+
++ifdef KVERSION
++VM_UNAME = $(KVERSION)
++else
+ VM_UNAME = $(shell uname -r)
++endif
+
+ # Header directory for the running kernel
+ ifdef LINUXINCLUDE
+diff --git a/vmmon/common/hostif.h b/vmmon/common/hostif.h
+index 865abc0..2b94ce1 100644
+--- a/vmmon/common/hostif.h
++++ b/vmmon/common/hostif.h
+@@ -122,14 +122,10 @@ EXTERN MPN64 HostIF_GetNextAnonPage(VMDriver *vm, MPN64 mpn);
+ EXTERN int HostIF_GetLockedPageList(VMDriver *vm, VA64 uAddr,
+ unsigned int numPages);
+
+-EXTERN int HostIF_ReadPage(MPN64 mpn, VA64 addr, Bool kernelBuffer);
+-EXTERN int HostIF_WritePage(MPN64 mpn, VA64 addr, Bool kernelBuffer);
+-#ifdef _WIN32
+-/* Add a HostIF_ReadMachinePage() if/when needed */
++EXTERN int HostIF_ReadPage(VMDriver *vm, MPN64 mpn, VA64 addr, Bool kernelBuffer);
++EXTERN int HostIF_WritePage(VMDriver *vm, MPN64 mpn, VA64 addr,
++ Bool kernelBuffer);
+ EXTERN int HostIF_WriteMachinePage(MPN64 mpn, VA64 addr);
+-#else
+-#define HostIF_WriteMachinePage(_a, _b) HostIF_WritePage((_a), (_b), TRUE)
+-#endif
+ #if defined __APPLE__
+ // There is no need for a fast clock lock on Mac OS.
+ #define HostIF_FastClockLock(_callerID) do {} while (0)
+@@ -145,4 +141,8 @@ EXTERN void HostIF_FreeMachinePage(MPN64 mpn);
+
+ EXTERN int HostIF_SafeRDMSR(uint32 msr, uint64 *val);
+
++#if defined __APPLE__
++EXTERN void HostIF_PageUnitTest(void);
++#endif
++
+ #endif // ifdef _HOSTIF_H_
+diff --git a/vmmon/common/memtrack.c b/vmmon/common/memtrack.c
+index e53daeb..eec9844 100644
+--- a/vmmon/common/memtrack.c
++++ b/vmmon/common/memtrack.c
+@@ -88,6 +88,7 @@
+
+ #include "vmware.h"
+ #include "hostif.h"
++#include "vmx86.h"
+
+ #include "memtrack.h"
+
+@@ -146,12 +147,11 @@ typedef struct MemTrackHT {
+ typedef uint64 MemTrackHTKey;
+
+ typedef struct MemTrack {
++ VMDriver *vm; /* The VM instance. */
+ unsigned numPages; /* Number of pages tracked. */
+ MemTrackDir1 dir1; /* First level directory. */
+ MemTrackHT vpnHashTable; /* VPN to entry hashtable. */
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ MemTrackHT mpnHashTable; /* MPN to entry hashtable. */
+-#endif
+ } MemTrack;
+
+ /*
+@@ -304,11 +304,9 @@ MemTrackCleanup(MemTrack *mt) // IN
+ if (mt->vpnHashTable.pages[idx] != NULL) {
+ HostIF_FreePage(mt->vpnHashTable.pages[idx]);
+ }
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ if (mt->mpnHashTable.pages[idx] != NULL) {
+ HostIF_FreePage(mt->mpnHashTable.pages[idx]);
+ }
+-#endif
+ }
+
+ HostIF_FreeKernelMem(mt);
+@@ -332,7 +330,7 @@ MemTrackCleanup(MemTrack *mt) // IN
+ */
+
+ MemTrack *
+-MemTrack_Init(void)
++MemTrack_Init(VMDriver *vm) // IN:
+ {
+ MemTrack *mt;
+ unsigned idx;
+@@ -349,6 +347,7 @@ MemTrack_Init(void)
+ goto error;
+ }
+ memset(mt, 0, sizeof *mt);
++ mt->vm = vm;
+
+ for (idx = 0; idx < MEMTRACK_HT_PAGES; idx++) {
+ MemTrackHTPage *htPage = MemTrackAllocPage();
+@@ -360,7 +359,6 @@ MemTrack_Init(void)
+ mt->vpnHashTable.pages[idx] = htPage;
+ }
+
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ for (idx = 0; idx < MEMTRACK_HT_PAGES; idx++) {
+ MemTrackHTPage *htPage = MemTrackAllocPage();
+
+@@ -370,7 +368,6 @@ MemTrack_Init(void)
+ }
+ mt->mpnHashTable.pages[idx] = htPage;
+ }
+-#endif
+
+ return mt;
+
+@@ -409,6 +406,8 @@ MemTrack_Add(MemTrack *mt, // IN
+ MemTrackDir3 *dir3;
+ MEMTRACK_IDX2DIR(idx, p1, p2, p3);
+
++ ASSERT(HostIF_VMLockIsHeld(mt->vm));
++
+ if (p1 >= MEMTRACK_DIR1_ENTRIES ||
+ p2 >= MEMTRACK_DIR2_ENTRIES ||
+ p3 >= MEMTRACK_DIR3_ENTRIES) {
+@@ -430,9 +429,7 @@ MemTrack_Add(MemTrack *mt, // IN
+ ent->mpn = mpn;
+
+ MemTrackHTInsert(&mt->vpnHashTable, ent, &ent->vpnChain, ent->vpn);
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ MemTrackHTInsert(&mt->mpnHashTable, ent, &ent->mpnChain, ent->mpn);
+-#endif
+
+ mt->numPages++;
+
+@@ -461,6 +458,7 @@ MemTrack_LookupVPN(MemTrack *mt, // IN
+ VPN64 vpn) // IN
+ {
+ MemTrackEntry *next = *MemTrackHTLookup(&mt->vpnHashTable, vpn);
++ ASSERT(HostIF_VMLockIsHeld(mt->vm));
+
+ while (next != NULL) {
+ if (next->vpn == vpn) {
+@@ -473,7 +471,6 @@ MemTrack_LookupVPN(MemTrack *mt, // IN
+ }
+
+
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ /*
+ *----------------------------------------------------------------------
+ *
+@@ -493,7 +490,9 @@ MemTrackEntry *
+ MemTrack_LookupMPN(MemTrack *mt, // IN
+ MPN64 mpn) // IN
+ {
+- MemTrackEntry *next = *MemTrackHTLookup(&mt->mpnHashTable, mpn);
++ MemTrackEntry *next;
++ ASSERT(HostIF_VMLockIsHeld(mt->vm));
++ next = *MemTrackHTLookup(&mt->mpnHashTable, mpn);
+
+ while (next != NULL) {
+ if (next->mpn == mpn) {
+@@ -504,7 +503,6 @@ MemTrack_LookupMPN(MemTrack *mt, // IN
+
+ return NULL;
+ }
+-#endif
+
+
+ /*
+diff --git a/vmmon/common/memtrack.h b/vmmon/common/memtrack.h
+index 977c5af..6d104ad 100644
+--- a/vmmon/common/memtrack.h
++++ b/vmmon/common/memtrack.h
+@@ -31,30 +31,22 @@
+ #define INCLUDE_ALLOW_VMCORE
+ #include "includeCheck.h"
+
+-#if defined(VMX86_DEBUG)
+-#define MEMTRACK_MPN_LOOKUP
+-#endif
+-
+ struct MemTrack;
+
+ typedef struct MemTrackEntry {
+ VPN64 vpn;
+ MPN64 mpn;
+ struct MemTrackEntry *vpnChain;
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ struct MemTrackEntry *mpnChain;
+-#endif
+ } MemTrackEntry;
+
+ typedef void (MemTrackCleanupCb)(void *cData, MemTrackEntry *entry);
+
+-extern struct MemTrack *MemTrack_Init(void);
++extern struct MemTrack *MemTrack_Init(VMDriver *vm);
+ extern unsigned MemTrack_Cleanup(struct MemTrack *mt, MemTrackCleanupCb *cb,
+ void *cbData);
+ extern MemTrackEntry *MemTrack_Add(struct MemTrack *mt, VPN64 vpn, MPN64 mpn);
+ extern MemTrackEntry *MemTrack_LookupVPN(struct MemTrack *mt, VPN64 vpn);
+-#if defined(MEMTRACK_MPN_LOOKUP)
+ extern MemTrackEntry *MemTrack_LookupMPN(struct MemTrack *mt, MPN64 mpn);
+-#endif
+
+ #endif // _MEMTRACK_H_
+diff --git a/vmmon/common/task.c b/vmmon/common/task.c
+index de2429e..228996e 100644
+--- a/vmmon/common/task.c
++++ b/vmmon/common/task.c
+@@ -39,6 +39,9 @@
+ # include <linux/string.h> /* memset() in the kernel */
+
+ # define EXPORT_SYMTAB
++# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++# define LINUX_GDT_IS_RO
++# endif
+ #else
+ # include <string.h>
+ #endif
+@@ -59,6 +62,13 @@
+ #include "x86vtinstr.h"
+ #include "apic.h"
+
++#ifdef LINUX_GDT_IS_RO
++# include <asm/desc.h>
++# define default_rw_gdt get_current_gdt_rw()
++#else
++# define default_rw_gdt NULL
++#endif
++
+ #if defined(_WIN64)
+ # include "x86.h"
+ # include "vmmon-asm-x86-64.h"
+@@ -708,11 +718,28 @@ TaskRestoreHostGDTTRLDT(Descriptor *tempGDTBase,
+ */
+
+ desc = (Descriptor *)((VA)HOST_KERNEL_LA_2_VA(hostGDT64.offset + tr));
++#ifdef LINUX_GDT_IS_RO
++ /*
++ * If GDT is read-only, we must always load TR from alternative gdt,
++ * otherwise CPU gets page fault when marking TR busy.
++ */
++ {
++ DTR64 rwGDT64;
++
++ rwGDT64.offset = (unsigned long)tempGDTBase;
++ rwGDT64.limit = hostGDT64.limit;
++ Desc_SetType((Descriptor *)((unsigned long)tempGDTBase + tr), TASK_DESC);
++ _Set_GDT((DTR *)&rwGDT64);
++ SET_TR(tr);
++ _Set_GDT((DTR *)&hostGDT64);
++ }
++#else
+ if (Desc_Type(desc) == TASK_DESC_BUSY) {
+ Desc_SetType(desc, TASK_DESC);
+ }
+ _Set_GDT((DTR *)&hostGDT64);
+ SET_TR(tr);
++#endif
+ SET_LDT(ldt);
+ }
+ }
+@@ -1775,7 +1802,8 @@ Task_Switch(VMDriver *vm, // IN
+ ASSERT(pCPU < ARRAYSIZE(hvRootPage) && pCPU < ARRAYSIZE(tmpGDT));
+
+ hvRootMPN = Atomic_Read64(&hvRootPage[pCPU]);
+- tempGDTBase = USE_TEMPORARY_GDT ? Atomic_ReadPtr(&tmpGDT[pCPU]) : NULL;
++ tempGDTBase = USE_TEMPORARY_GDT ? Atomic_ReadPtr(&tmpGDT[pCPU])
++ : default_rw_gdt;
+
+ /*
+ * We can't allocate memory with interrupts disabled on all hosts
+diff --git a/vmmon/common/vmx86.c b/vmmon/common/vmx86.c
+index dbe794c..156e94a 100644
+--- a/vmmon/common/vmx86.c
++++ b/vmmon/common/vmx86.c
+@@ -720,6 +720,35 @@ cleanup:
+ }
+
+
++/*
++ *----------------------------------------------------------------------
++ *
++ * Vmx86_LookupUserMPN --
++ *
++ * Look up the MPN of a locked user page by user VA under the VM lock.
++ *
++ * Results:
++ * A status code and the MPN on success.
++ *
++ * Side effects:
++ * None
++ *
++ *----------------------------------------------------------------------
++ */
++
++int
++Vmx86_LookupUserMPN(VMDriver *vm, // IN: VMDriver
++ VA64 uAddr, // IN: user VA of the page
++ MPN64 *mpn) // OUT
++{
++ int ret;
++ HostIF_VMLock(vm, 38);
++ ret = HostIF_LookupUserMPN(vm, uAddr, mpn);
++ HostIF_VMUnlock(vm, 38);
++ return ret;
++}
++
++
+ /*
+ *----------------------------------------------------------------------
+ *
+diff --git a/vmmon/common/vmx86.h b/vmmon/common/vmx86.h
+index 71ea01b..9e227ca 100644
+--- a/vmmon/common/vmx86.h
++++ b/vmmon/common/vmx86.h
+@@ -106,6 +106,7 @@ extern PseudoTSC pseudoTSC;
+ #define MAX_LOCKED_PAGES (-1)
+
+ extern VMDriver *Vmx86_CreateVM(void);
++extern int Vmx86_LookupUserMPN(VMDriver *vm, VA64 uAddr, MPN64 *mpn);
+ extern int Vmx86_ReleaseVM(VMDriver *vm);
+ extern int Vmx86_InitVM(VMDriver *vm, InitBlock *initParams);
+ extern int Vmx86_LateInitVM(VMDriver *vm);
+diff --git a/vmmon/include/compat_cred.h b/vmmon/include/compat_cred.h
+--- a/vmmon/include/compat_cred.h
++++ b/vmmon/include/compat_cred.h
+@@ -24,7 +24,11 @@
+ * Include linux/cred.h via linux/sched.h - it is not nice, but
+ * as cpp does not have #ifexist...
+ */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
+ #include <linux/sched.h>
++#else
++#include <linux/cred.h>
++#endif
+
+ #if !defined(current_fsuid) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29)
+ #define current_uid() (current->uid)
+diff --git a/vmmon/include/compat_pgtable.h b/vmmon/include/compat_pgtable.h
+index dedc25a..4722d4e 100644
+--- a/vmmon/include/compat_pgtable.h
++++ b/vmmon/include/compat_pgtable.h
+@@ -30,80 +30,32 @@
+ #include <asm/pgtable.h>
+
+
+-/* pte_page() API modified in 2.3.23 to return a struct page * --hpreg */
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 23)
+-# define compat_pte_page pte_page
+-#else
+-# include "compat_page.h"
+-
+-# define compat_pte_page(_pte) virt_to_page(pte_page(_pte))
+-#endif
+-
+-
+-/* Appeared in 2.5.5 --hpreg */
+-#ifndef pte_offset_map
+-/* Appeared in SuSE 8.0's 2.4.18 --hpreg */
+-# ifdef pte_offset_atomic
+-# define pte_offset_map pte_offset_atomic
+-# define pte_unmap pte_kunmap
+-# else
+-# define pte_offset_map pte_offset
+-# define pte_unmap(_pte)
+-# endif
+-#endif
+-
+-
+-/* Appeared in 2.5.74-mmX --petr */
+-#ifndef pmd_offset_map
+-# define pmd_offset_map(pgd, address) pmd_offset(pgd, address)
+-# define pmd_unmap(pmd)
+-#endif
+-
+-
+ /*
+- * Appeared in 2.6.10-rc2-mm1. Older kernels did L4 page tables as
+- * part of pgd_offset, or they did not have L4 page tables at all.
+- * In 2.6.11 pml4 -> pgd -> pmd -> pte hierarchy was replaced by
+- * pgd -> pud -> pmd -> pte hierarchy.
++ * p4d level appeared in 4.12.
+ */
+-#ifdef PUD_MASK
+-# define compat_pgd_offset(mm, address) pgd_offset(mm, address)
+-# define compat_pgd_present(pgd) pgd_present(pgd)
+-# define compat_pud_offset(pgd, address) pud_offset(pgd, address)
+-# define compat_pud_present(pud) pud_present(pud)
+-typedef pgd_t compat_pgd_t;
+-typedef pud_t compat_pud_t;
+-#elif defined(pml4_offset)
+-# define compat_pgd_offset(mm, address) pml4_offset(mm, address)
+-# define compat_pgd_present(pml4) pml4_present(pml4)
+-# define compat_pud_offset(pml4, address) pml4_pgd_offset(pml4, address)
+-# define compat_pud_present(pgd) pgd_present(pgd)
+-typedef pml4_t compat_pgd_t;
+-typedef pgd_t compat_pud_t;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
++# define compat_p4d_offset(pgd, address) p4d_offset(pgd, address)
++# define compat_p4d_present(p4d) p4d_present(p4d)
++# define compat_p4d_large(p4d) p4d_large(p4d)
++# define compat_p4d_pfn(p4d) p4d_pfn(p4d)
++# define COMPAT_P4D_MASK P4D_MASK
++typedef p4d_t compat_p4d_t;
+ #else
+-# define compat_pgd_offset(mm, address) pgd_offset(mm, address)
+-# define compat_pgd_present(pgd) pgd_present(pgd)
+-# define compat_pud_offset(pgd, address) (pgd)
+-# define compat_pud_present(pud) (1)
+-typedef pgd_t compat_pgd_t;
+-typedef pgd_t compat_pud_t;
++# define compat_p4d_offset(pgd, address) (pgd)
++# define compat_p4d_present(p4d) (1)
++# define compat_p4d_large(p4d) (0)
++# define compat_p4d_pfn(p4d) INVALID_MPN /* Not used */
++# define COMPAT_P4D_MASK 0 /* Not used */
++typedef pgd_t compat_p4d_t;
+ #endif
+-
+-
+-#define compat_pgd_offset_k(mm, address) pgd_offset_k(address)
+-
+-
+-/* Introduced somewhere in 2.6.0, + backported to some 2.4 RedHat kernels */
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) && !defined(pte_pfn)
+-# define pte_pfn(pte) page_to_pfn(compat_pte_page(pte))
++/* p[gu]d_large did not exist before 2.6.25 */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)
++# define pud_large(pud) 0
++# define pgd_large(pgd) 0
+ #endif
+-
+-
+-/* A page_table_lock field is added to struct mm_struct in 2.3.10 --hpreg */
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 10)
+-# define compat_get_page_table_lock(_mm) (&(_mm)->page_table_lock)
+-#else
+-# define compat_get_page_table_lock(_mm) NULL
++/* pud_pfn did not exist before 3.8. */
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
++# define pud_pfn(pud) INVALID_MPN
+ #endif
+
+
+@@ -128,12 +80,8 @@ typedef pgd_t compat_pud_t;
+ #define VM_PAGE_KERNEL_EXEC PAGE_KERNEL
+ #endif
+ #else
+-#ifdef PAGE_KERNEL_EXECUTABLE
+-#define VM_PAGE_KERNEL_EXEC PAGE_KERNEL_EXECUTABLE
+-#else
+ #define VM_PAGE_KERNEL_EXEC PAGE_KERNEL_EXEC
+ #endif
+-#endif
+
+
+ #endif /* __COMPAT_PGTABLE_H__ */
+diff --git a/vmmon/include/pgtbl.h b/vmmon/include/pgtbl.h
+index 39ef4e1..0935e09 100644
+--- a/vmmon/include/pgtbl.h
++++ b/vmmon/include/pgtbl.h
+@@ -26,154 +26,14 @@
+ #include "compat_spinlock.h"
+ #include "compat_page.h"
+
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblPte2MPN --
+- *
+- * Returns the page structure associated to a Page Table Entry.
+- *
+- * This function is not allowed to schedule() because it can be called while
+- * holding a spinlock --hpreg
+- *
+- * Results:
+- * INVALID_MPN on failure
+- * mpn on success
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE MPN64
+-PgtblPte2MPN(pte_t *pte) // IN
+-{
+- MPN64 mpn;
+- if (pte_present(*pte) == 0) {
+- return INVALID_MPN;
+- }
+- mpn = pte_pfn(*pte);
+- if (mpn >= INVALID_MPN) {
+- return INVALID_MPN;
+- }
+- return mpn;
+-}
+-
+-
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblPte2Page --
+- *
+- * Returns the page structure associated to a Page Table Entry.
+- *
+- * This function is not allowed to schedule() because it can be called while
+- * holding a spinlock --hpreg
+- *
+- * Results:
+- * The page structure if the page table entry points to a physical page
+- * NULL if the page table entry does not point to a physical page
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE struct page *
+-PgtblPte2Page(pte_t *pte) // IN
+-{
+- if (pte_present(*pte) == 0) {
+- return NULL;
+- }
+-
+- return compat_pte_page(*pte);
+-}
+-
+-
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblPGD2PTELocked --
+- *
+- * Walks through the hardware page tables to try to find the pte
+- * associated to a virtual address.
+- *
+- * Results:
+- * pte. Caller must call pte_unmap if valid pte returned.
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE pte_t *
+-PgtblPGD2PTELocked(compat_pgd_t *pgd, // IN: PGD to start with
+- VA addr) // IN: Address in the virtual address
+- // space of that process
+-{
+- compat_pud_t *pud;
+- pmd_t *pmd;
+- pte_t *pte;
+-
+- if (compat_pgd_present(*pgd) == 0) {
+- return NULL;
+- }
+-
+- pud = compat_pud_offset(pgd, addr);
+- if (compat_pud_present(*pud) == 0) {
+- return NULL;
+- }
+-
+- pmd = pmd_offset_map(pud, addr);
+- if (pmd_present(*pmd) == 0) {
+- pmd_unmap(pmd);
+- return NULL;
+- }
+-
+- pte = pte_offset_map(pmd, addr);
+- pmd_unmap(pmd);
+- return pte;
+-}
+-
+-
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblVa2PTELocked --
+- *
+- * Walks through the hardware page tables to try to find the pte
+- * associated to a virtual address.
+- *
+- * Results:
+- * pte. Caller must call pte_unmap if valid pte returned.
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE pte_t *
+-PgtblVa2PTELocked(struct mm_struct *mm, // IN: Mm structure of a process
+- VA addr) // IN: Address in the virtual address
+- // space of that process
+-{
+- return PgtblPGD2PTELocked(compat_pgd_offset(mm, addr), addr);
+-}
+-
+
+ /*
+ *-----------------------------------------------------------------------------
+ *
+ * PgtblVa2MPNLocked --
+ *
+- * Retrieve MPN for a given va.
+- *
+- * Caller must call pte_unmap if valid pte returned. The mm->page_table_lock
+- * must be held, so this function is not allowed to schedule() --hpreg
++ * Walks through the hardware page tables to try to find the pte
++ * associated to a virtual address. Then maps PTE to MPN.
+ *
+ * Results:
+ * INVALID_MPN on failure
+@@ -188,89 +48,64 @@ PgtblVa2PTELocked(struct mm_struct *mm, // IN: Mm structure of a process
+ static INLINE MPN64
+ PgtblVa2MPNLocked(struct mm_struct *mm, // IN: Mm structure of a process
+ VA addr) // IN: Address in the virtual address
++ // space of that process
+ {
+- pte_t *pte;
++ pgd_t *pgd;
++ compat_p4d_t *p4d;
++ MPN64 mpn;
+
+- pte = PgtblVa2PTELocked(mm, addr);
+- if (pte != NULL) {
+- MPN64 mpn = PgtblPte2MPN(pte);
+- pte_unmap(pte);
+- return mpn;
++ pgd = pgd_offset(mm, addr);
++ if (pgd_present(*pgd) == 0) {
++ return INVALID_MPN;
+ }
+- return INVALID_MPN;
+-}
+-
+-
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblKVa2MPNLocked --
+- *
+- * Retrieve MPN for a given kernel va.
+- *
+- * Caller must call pte_unmap if valid pte returned. The mm->page_table_lock
+- * must be held, so this function is not allowed to schedule() --hpreg
+- *
+- * Results:
+- * INVALID_MPN on failure
+- * mpn on success
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE MPN64
+-PgtblKVa2MPNLocked(struct mm_struct *mm, // IN: Mm structure of a caller
+- VA addr) // IN: Address in the virtual address
+-{
+- pte_t *pte;
+-
+- pte = PgtblPGD2PTELocked(compat_pgd_offset_k(mm, addr), addr);
+- if (pte != NULL) {
+- MPN64 mpn = PgtblPte2MPN(pte);
+- pte_unmap(pte);
+- return mpn;
++ if (pgd_large(*pgd)) {
++ /* Linux kernel does not support PGD huge pages. */
++ /* return pgd_pfn(*pgd) + ((addr & PGD_MASK) >> PAGE_SHIFT); */
++ return INVALID_MPN;
+ }
+- return INVALID_MPN;
+-}
+-#endif
+-
+
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblVa2PageLocked --
+- *
+- * Return the "page" struct for a given va.
+- *
+- * Results:
+- * struct page or NULL. The mm->page_table_lock must be held, so this
+- * function is not allowed to schedule() --hpreg
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE struct page *
+-PgtblVa2PageLocked(struct mm_struct *mm, // IN: Mm structure of a process
+- VA addr) // IN: Address in the virtual address
+-{
+- pte_t *pte;
+-
+- pte = PgtblVa2PTELocked(mm, addr);
+- if (pte != NULL) {
+- struct page *page = PgtblPte2Page(pte);
+- pte_unmap(pte);
+- return page;
++ p4d = compat_p4d_offset(pgd, addr);
++ if (compat_p4d_present(*p4d) == 0) {
++ return INVALID_MPN;
++ }
++ if (compat_p4d_large(*p4d)) {
++ mpn = compat_p4d_pfn(*p4d) + ((addr & ~COMPAT_P4D_MASK) >> PAGE_SHIFT);
+ } else {
+- return NULL;
++ pud_t *pud;
++
++ pud = pud_offset(p4d, addr);
++ if (pud_present(*pud) == 0) {
++ return INVALID_MPN;
++ }
++ if (pud_large(*pud)) {
++ mpn = pud_pfn(*pud) + ((addr & ~PUD_MASK) >> PAGE_SHIFT);
++ } else {
++ pmd_t *pmd;
++
++ pmd = pmd_offset(pud, addr);
++ if (pmd_present(*pmd) == 0) {
++ return INVALID_MPN;
++ }
++ if (pmd_large(*pmd)) {
++ mpn = pmd_pfn(*pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
++ } else {
++ pte_t *pte;
++
++ pte = pte_offset_map(pmd, addr);
++ if (pte_present(*pte) == 0) {
++ pte_unmap(pte);
++ return INVALID_MPN;
++ }
++ mpn = pte_pfn(*pte);
++ pte_unmap(pte);
++ }
++ }
++ }
++ if (mpn >= INVALID_MPN) {
++ mpn = INVALID_MPN;
+ }
+-}
++ return mpn;
++}
+
+
+ /*
+@@ -298,85 +133,10 @@ PgtblVa2MPN(VA addr) // IN
+
+ /* current->mm is NULL for kernel threads, so use active_mm. */
+ mm = current->active_mm;
+- if (compat_get_page_table_lock(mm)) {
+- spin_lock(compat_get_page_table_lock(mm));
+- }
++ spin_lock(&mm->page_table_lock);
+ mpn = PgtblVa2MPNLocked(mm, addr);
+- if (compat_get_page_table_lock(mm)) {
+- spin_unlock(compat_get_page_table_lock(mm));
+- }
++ spin_unlock(&mm->page_table_lock);
+ return mpn;
+ }
+
+-
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblKVa2MPN --
+- *
+- * Walks through the hardware page tables of the current process to try to
+- * find the page structure associated to a virtual address.
+- *
+- * Results:
+- * Same as PgtblVa2MPNLocked()
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE MPN64
+-PgtblKVa2MPN(VA addr) // IN
+-{
+- struct mm_struct *mm = current->active_mm;
+- MPN64 mpn;
+-
+- if (compat_get_page_table_lock(mm)) {
+- spin_lock(compat_get_page_table_lock(mm));
+- }
+- mpn = PgtblKVa2MPNLocked(mm, addr);
+- if (compat_get_page_table_lock(mm)) {
+- spin_unlock(compat_get_page_table_lock(mm));
+- }
+- return mpn;
+-}
+-#endif
+-
+-
+-/*
+- *-----------------------------------------------------------------------------
+- *
+- * PgtblVa2Page --
+- *
+- * Walks through the hardware page tables of the current process to try to
+- * find the page structure associated to a virtual address.
+- *
+- * Results:
+- * Same as PgtblVa2PageLocked()
+- *
+- * Side effects:
+- * None
+- *
+- *-----------------------------------------------------------------------------
+- */
+-
+-static INLINE struct page *
+-PgtblVa2Page(VA addr) // IN
+-{
+- struct mm_struct *mm = current->active_mm;
+- struct page *page;
+-
+- if (compat_get_page_table_lock(mm)) {
+- spin_lock(compat_get_page_table_lock(mm));
+- }
+- page = PgtblVa2PageLocked(mm, addr);
+- if (compat_get_page_table_lock(mm)) {
+- spin_unlock(compat_get_page_table_lock(mm));
+- }
+- return page;
+-}
+-
+-
+ #endif /* __PGTBL_H__ */
+diff --git a/vmmon/linux/driver.c b/vmmon/linux/driver.c
+index 87cf45b..5390a93 100644
+--- a/vmmon/linux/driver.c
++++ b/vmmon/linux/driver.c
+@@ -108,7 +108,9 @@
+
+ static int LinuxDriver_Close(struct inode *inode, struct file *filp);
+ static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait);
+-#if defined(VMW_NOPAGE_2624)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++static int LinuxDriverFault(struct vm_fault *fault);
++#elif defined(VMW_NOPAGE_2624)
+ static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault);
+ #else
+ static struct page *LinuxDriverNoPage(struct vm_area_struct *vma,
+@@ -117,7 +117,7 @@
+ #endif
+ static int LinuxDriverMmap(struct file *filp, struct vm_area_struct *vma);
+
+-static void LinuxDriverPollTimeout(unsigned long clientData);
++static void LinuxDriverPollTimeout(struct timer_list *clientData);
+
+ static struct vm_operations_struct vmuser_mops = {
+ #ifdef VMW_NOPAGE_2624
+@@ -244,7 +259,7 @@ LinuxDriverEstimateTSCkHz(void)
+ */
+
+ static void
+-LinuxDriverComputeTSCFreq(unsigned long data) // IN:
++LinuxDriverComputeTSCFreq(struct timer_list *data) // IN:
+ {
+ Vmx86_GetkHzEstimate(&linuxState.startTime);
+ }
+@@ -287,9 +302,13 @@ init_module(void)
+ */
+
+ init_waitqueue_head(&linuxState.pollQueue);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) && !defined(timer_setup)
+ init_timer(&linuxState.pollTimer);
+ linuxState.pollTimer.data = 0;
+- linuxState.pollTimer.function = LinuxDriverPollTimeout;
++ linuxState.pollTimer.function = (void *)LinuxDriverPollTimeout;
++#else
++ timer_setup(&linuxState.pollTimer, LinuxDriverPollTimeout, 0);
++#endif
+
+ linuxState.fastClockThread = NULL;
+ linuxState.fastClockFile = NULL;
+@@ -365,9 +363,13 @@ init_module(void)
+ */
+
+ Vmx86_ReadTSCAndUptime(&linuxState.startTime);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) && !defined(timer_setup)
+ init_timer(&tscTimer);
+ tscTimer.data = 0;
+- tscTimer.function = LinuxDriverComputeTSCFreq;
++ tscTimer.function = (void *)LinuxDriverComputeTSCFreq;
++#else
++ timer_setup(&tscTimer, LinuxDriverComputeTSCFreq, 0);
++#endif
+ tscTimer.expires = jiffies + 4 * HZ;
+ add_timer(&tscTimer);
+
+@@ -903,7 +907,7 @@
+ */
+
+ static void
+-LinuxDriverPollTimeout(unsigned long clientData) // IN:
++LinuxDriverPollTimeout(struct timer_list *clientData) // IN:
+ {
+ LinuxDriverWakeUp(FALSE);
+ }
+@@ -928,7 +934,10 @@
+ *-----------------------------------------------------------------------------
+ */
+
+-#if defined(VMW_NOPAGE_2624)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++static int
++LinuxDriverFault(struct vm_fault *fault) //IN/OUT
++#elif defined(VMW_NOPAGE_2624)
+ static int LinuxDriverFault(struct vm_area_struct *vma, //IN
+ struct vm_fault *fault) //IN/OUT
+ #else
+@@ -937,6 +946,9 @@
+ int *type) //OUT: Fault type
+ #endif
+ {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++ struct vm_area_struct *vma = fault->vma;
++#endif
+ VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data;
+ unsigned long pg;
+ struct page* page;
+@@ -1398,7 +1410,6 @@ LinuxDriver_Ioctl(struct file *filp, // IN:
+ case IOCTL_VMX86_CREATE_VM:
+ case IOCTL_VMX86_INIT_CROSSGDT:
+ case IOCTL_VMX86_SET_UID:
+- case IOCTL_VMX86_LOOK_UP_MPN:
+ #if defined(__linux__) && defined(VMX86_DEVEL)
+ case IOCTL_VMX86_LOOK_UP_LARGE_MPN:
+ #endif
+@@ -1411,8 +1423,6 @@ LinuxDriver_Ioctl(struct file *filp, // IN:
+ case IOCTL_VMX86_GET_KHZ_ESTIMATE:
+ case IOCTL_VMX86_GET_ALL_CPUID:
+ case IOCTL_VMX86_GET_ALL_MSRS:
+- case IOCTL_VMX86_READ_PAGE:
+- case IOCTL_VMX86_WRITE_PAGE:
+ case IOCTL_VMX86_SET_POLL_TIMEOUT_PTR:
+ case IOCTL_VMX86_GET_KERNEL_CLOCK_RATE:
+ case IOCTL_VMX86_GET_REFERENCE_CLOCK_HZ:
+@@ -1579,7 +1589,7 @@ LinuxDriver_Ioctl(struct file *filp, // IN:
+ if (retval) {
+ break;
+ }
+- args.ret.status = HostIF_LookupUserMPN(vm, args.uAddr, &args.ret.mpn);
++ args.ret.status = Vmx86_LookupUserMPN(vm, args.uAddr, &args.ret.mpn);
+ retval = HostIF_CopyToUser((void *)ioarg, &args, sizeof args);
+ break;
+ }
+@@ -1912,7 +1922,7 @@ LinuxDriver_Ioctl(struct file *filp, // IN:
+ if (retval) {
+ break;
+ }
+- retval = HostIF_ReadPage(req.mpn, req.uAddr, FALSE);
++ retval = HostIF_ReadPage(vm, req.mpn, req.uAddr, FALSE);
+ break;
+ }
+
+@@ -1923,7 +1933,7 @@ LinuxDriver_Ioctl(struct file *filp, // IN:
+ if (retval) {
+ break;
+ }
+- retval = HostIF_WritePage(req.mpn, req.uAddr, FALSE);
++ retval = HostIF_WritePage(vm, req.mpn, req.uAddr, FALSE);
+ break;
+ }
+
+diff --git a/vmmon/linux/hostif.c b/vmmon/linux/hostif.c
+index fd32013..583d6da 100644
+--- a/vmmon/linux/hostif.c
++++ b/vmmon/linux/hostif.c
+@@ -77,19 +77,22 @@
+ #include <linux/capability.h>
+ #include <linux/kthread.h>
+ #include <linux/wait.h>
+-
++#include <linux/signal.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#include <linux/taskstats_kern.h> // For linux/sched/signal.h without version check
++#endif
+
+ #include "vmware.h"
+ #include "x86apic.h"
+ #include "vm_asm.h"
+ #include "modulecall.h"
++#include "driver.h"
+ #include "memtrack.h"
+ #include "phystrack.h"
+ #include "cpuid.h"
+ #include "cpuid_info.h"
+ #include "hostif.h"
+ #include "hostif_priv.h"
+-#include "driver.h"
+ #include "vmhost.h"
+ #include "x86msr.h"
+ #include "apic.h"
+@@ -1010,7 +1013,7 @@ HostIF_FreeLockedPages(VMDriver *vm, // IN: VM instance pointer
+ int
+ HostIF_Init(VMDriver *vm) // IN:
+ {
+- vm->memtracker = MemTrack_Init();
++ vm->memtracker = MemTrack_Init(vm);
+ if (vm->memtracker == NULL) {
+ return -1;
+ }
+@@ -1165,10 +1173,7 @@
+ {
+ int retval;
+
+- down_read(&current->mm->mmap_sem);
+- retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
+- numPages, 0, 0, ppages, NULL);
+- up_read(&current->mm->mmap_sem);
++ retval = get_user_pages_fast((unsigned long)uvAddr, numPages, 0, ppages);
+
+ return retval != numPages;
+ }
+@@ -1626,12 +1631,34 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN
+ unsigned int reservedPages = MEMDEFAULTS_MIN_HOST_PAGES;
+ unsigned int hugePages = (vm == NULL) ? 0 :
+ BYTES_2_PAGES(vm->memInfo.hugePageBytes);
+- unsigned int lockedPages = global_page_state(NR_PAGETABLE) +
+- global_page_state(NR_SLAB_UNRECLAIMABLE) +
+- global_page_state(NR_UNEVICTABLE) +
+- hugePages + reservedPages;
+- unsigned int anonPages = global_page_state(NR_ANON_PAGES);
++ unsigned int lockedPages = hugePages + reservedPages;
++ unsigned int anonPages;
+ unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize);
++
++ /* global_page_state is global_zone_page_state in 4.14. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
++ lockedPages += global_zone_page_state(NR_PAGETABLE);
++#else
++ lockedPages += global_page_state(NR_PAGETABLE);
++#endif
++ /* NR_SLAB_* moved from zone to node in 4.13. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)
++ lockedPages += global_node_page_state(NR_SLAB_UNRECLAIMABLE);
++#else
++ lockedPages += global_page_state(NR_SLAB_UNRECLAIMABLE);
++#endif
++ /* NR_UNEVICTABLE moved from global to node in 4.8. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ lockedPages += global_node_page_state(NR_UNEVICTABLE);
++#else
++ lockedPages += global_page_state(NR_UNEVICTABLE);
++#endif
++ /* NR_ANON_MAPPED moved & changed name in 4.8. */
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0)
++ anonPages = global_node_page_state(NR_ANON_MAPPED);
++#else
++ anonPages = global_page_state(NR_ANON_PAGES);
++#endif
+
+ if (anonPages > swapPages) {
+ lockedPages += anonPages - swapPages;
+@@ -1726,9 +1753,6 @@
+ unsigned long jifs, jifBase;
+ unsigned int attempts = 0;
+
+- /* Assert that HostIF_InitUptime has been called. */
+- ASSERT(uptimeState.timer.function);
+-
+ retry:
+ do {
+ version = VersionedAtomic_BeginTryRead(&uptimeState.version);
+@@ -1794,7 +1818,7 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies
+ */
+
+ static void
+-HostIFUptimeResyncMono(unsigned long data) // IN: ignored
++HostIFUptimeResyncMono(struct timer_list *timer) // IN: ignored
+ {
+ unsigned long jifs;
+ uintptr_t flags;
+@@ -1856,8 +1880,13 @@ HostIF_InitUptime(void)
+ -(tv.tv_usec * (UPTIME_FREQ / 1000000) +
+ tv.tv_sec * UPTIME_FREQ));
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) && !defined(timer_setup)
+ init_timer(&uptimeState.timer);
+- uptimeState.timer.function = HostIFUptimeResyncMono;
++ uptimeState.timer.function = (void *)HostIFUptimeResyncMono;
++ uptimeState.timer.data = (unsigned long)&uptimeState.timer;
++#else
++ timer_setup(&uptimeState.timer, HostIFUptimeResyncMono, 0);
++#endif
+ mod_timer(&uptimeState.timer, jiffies + HZ);
+ }
+
+@@ -2028,15 +2052,15 @@ HostIF_MapCrossPage(VMDriver *vm, // IN
+ return NULL;
+ }
+ vPgAddr = (VA) MapCrossPage(page);
+- HostIF_GlobalLock(16);
++ HostIF_VMLock(vm, 27);
+ if (vm->vmhost->crosspagePagesCount >= MAX_INITBLOCK_CPUS) {
+- HostIF_GlobalUnlock(16);
++ HostIF_VMUnlock(vm, 27);
+ UnmapCrossPage(page, (void*)vPgAddr);
+
+ return NULL;
+ }
+ vm->vmhost->crosspagePages[vm->vmhost->crosspagePagesCount++] = page;
+- HostIF_GlobalUnlock(16);
++ HostIF_VMUnlock(vm, 27);
+
+ ret = vPgAddr | (((VA)p) & (PAGE_SIZE - 1));
+
+@@ -2850,13 +2874,75 @@ HostIF_CallOnEachCPU(void (*func)(void*), // IN: function to call
+ }
+
+
++/*
++ *-----------------------------------------------------------------------------
++ *
++ * HostIFCheckTrackedMPN --
++ *
++ * Check if a given MPN is tracked for the specified VM.
++ *
++ * Result:
++ * TRUE if the MPN is tracked in one of the trackers for the specified VM,
++ * FALSE otherwise.
++ *
++ * Side effects:
++ * None
++ *
++ *-----------------------------------------------------------------------------
++ */
++
++Bool
++HostIFCheckTrackedMPN(VMDriver *vm, // IN: The VM instance
++ MPN64 mpn) // IN: The MPN
++{
++ VMHost * const vmh = vm->vmhost;
++
++ if (vmh == NULL) {
++ return FALSE;
++ }
++
++ HostIF_VMLock(vm, 32); // Debug version of PhysTrack wants VM's lock.
++ if (vmh->lockedPages) {
++ if (PhysTrack_Test(vmh->lockedPages, mpn)) {
++ HostIF_VMUnlock(vm, 32);
++ return TRUE;
++ }
++ }
++
++ if (vmh->AWEPages) {
++ if (PhysTrack_Test(vmh->AWEPages, mpn)) {
++ HostIF_VMUnlock(vm, 32);
++ return TRUE;
++ }
++ }
++
++ if (vm->memtracker) {
++ if (MemTrack_LookupMPN(vm->memtracker, mpn) != NULL) {
++ HostIF_VMUnlock(vm, 32);
++ return TRUE;
++ }
++ }
++ HostIF_VMUnlock(vm, 32);
++
++ if (vmx86_debug) {
++ /*
++ * The monitor may have old KSeg mappings to pages which it no longer
++ * owns. Minimize customer noise by only logging this for developers.
++ */
++ Log("%s: MPN %" FMT64 "x not owned by this VM\n", __FUNCTION__, mpn);
++ }
++ return FALSE;
++}
++
++
+ /*
+ *----------------------------------------------------------------------
+ *
+ * HostIF_ReadPage --
+ *
+- * puts the content of a machine page into a kernel or user mode
+- * buffer.
++ * Reads one page of data from a machine page and returns it in the
++ * specified kernel or user buffer. The machine page must be owned by
++ * the specified VM.
+ *
+ * Results:
+ * 0 on success
+@@ -2869,7 +2955,8 @@ HostIF_CallOnEachCPU(void (*func)(void*), // IN: function to call
+ */
+
+ int
+-HostIF_ReadPage(MPN64 mpn, // MPN of the page
++HostIF_ReadPage(VMDriver *vm, // IN: The VM instance
++ MPN64 mpn, // MPN of the page
+ VA64 addr, // buffer for data
+ Bool kernelBuffer) // is the buffer in kernel space?
+ {
+@@ -2881,6 +2968,9 @@ HostIF_ReadPage(MPN64 mpn, // MPN of the page
+ if (mpn == INVALID_MPN) {
+ return -EFAULT;
+ }
++ if (HostIFCheckTrackedMPN(vm, mpn) == FALSE) {
++ return -EFAULT;
++ }
+
+ page = pfn_to_page(mpn);
+ ptr = kmap(page);
+@@ -2904,8 +2994,8 @@ HostIF_ReadPage(MPN64 mpn, // MPN of the page
+ *
+ * HostIF_WritePage --
+ *
+- * Put the content of a kernel or user mode buffer into a machine
+- * page.
++ * Writes one page of data from a kernel or user buffer onto the specified
++ * machine page. The machine page must be owned by the specified VM.
+ *
+ * Results:
+ * 0 on success
+@@ -2918,9 +3008,9 @@ HostIF_ReadPage(MPN64 mpn, // MPN of the page
+ */
+
+ int
+-HostIF_WritePage(MPN64 mpn, // MPN of the page
+- VA64 addr, // data to write to the page
+- Bool kernelBuffer) // is the buffer in kernel space?
++HostIFWritePageWork(MPN64 mpn, // MPN of the page
++ VA64 addr, // data to write to the page
++ Bool kernelBuffer) // is the buffer in kernel space?
+ {
+ void const *buf = VA64ToPtr(addr);
+ int ret = 0;
+@@ -2947,6 +3037,45 @@ HostIF_WritePage(MPN64 mpn, // MPN of the page
+ return ret;
+ }
+
++int
++HostIF_WritePage(VMDriver *vm, // IN: The VM instance
++ MPN64 mpn, // MPN of the page
++ VA64 addr, // data to write to the page
++ Bool kernelBuffer) // is the buffer in kernel space?
++{
++ if (HostIFCheckTrackedMPN(vm, mpn) == FALSE) {
++ return -EFAULT;
++ }
++ return HostIFWritePageWork(mpn, addr, kernelBuffer);
++}
++
++
++/*
++ *-----------------------------------------------------------------------------
++ *
++ * HostIF_WriteMachinePage --
++ *
++ * Puts the content of a machine page into a kernel or user mode
++ * buffer. This should only be used for host-global pages, not any
++ * VM-owned pages.
++ *
++ * Results:
++ * On success: 0
++ * On failure: a negative error code
++ *
++ * Side effects:
++ * None
++ *
++ *-----------------------------------------------------------------------------
++ */
++
++int
++HostIF_WriteMachinePage(MPN64 mpn, // IN: MPN of the page
++ VA64 addr) // IN: data to write to the page
++{
++ return HostIFWritePageWork(mpn, addr, TRUE);
++}
++
+
+ /*
+ *----------------------------------------------------------------------
+diff --git a/vmmon/vmcore/moduleloop.c b/vmmon/vmcore/moduleloop.c
+index 94aab9e..a6b2c1a 100644
+--- a/vmmon/vmcore/moduleloop.c
++++ b/vmmon/vmcore/moduleloop.c
+@@ -205,11 +205,13 @@ skipTaskSwitch:;
+ uint32 nPages = (uint32)crosspage->args[1];
+ VA64 uAddr = (VA64)VPN_2_VA(vpn);
+ ASSERT(nPages <= MODULECALL_NUM_ARGS);
++ HostIF_VMLock(vm, 38);
+ for (i = 0; i < nPages; i++) {
+ MPN64 mpn;
+ HostIF_LookupUserMPN(vm, uAddr + i * PAGE_SIZE, &mpn);
+ crosspage->args[i] = mpn;
+ }
++ HostIF_VMUnlock(vm, 38);
+ break;
+ }
+
diff --git a/vmnet.patch b/vmnet.patch
new file mode 100644
index 000000000000..2640ec286868
--- /dev/null
+++ b/vmnet.patch
@@ -0,0 +1,122 @@
+diff --git a/vmnet/Makefile b/vmnet/Makefile
+index 459846e..cd29652 100644
+--- a/vmnet/Makefile
++++ b/vmnet/Makefile
+@@ -43,7 +43,11 @@ INCLUDE += -I$(SRCROOT)/shared
+ endif
+
+
++ifdef KVERSION
++VM_UNAME = $(KVERSION)
++else
+ VM_UNAME = $(shell uname -r)
++endif
+
+ # Header directory for the running kernel
+ ifdef LINUXINCLUDE
+diff --git a/vmnet/bridge.c b/vmnet/bridge.c
+--- a/vmnet/bridge.c
++++ b/vmnet/bridge.c
+@@ -636,7 +636,7 @@
+ unsigned long flags;
+ int i;
+
+- atomic_inc(&clone->users);
++ clone = skb_get(clone);
+
+ clone->dev = dev;
+ clone->protocol = eth_type_trans(clone, dev);
+@@ -1143,11 +1143,16 @@
+ static int
+ VNetBridgeNotify(struct notifier_block *this, // IN: callback data (bridge)
+ u_long msg, // IN: type of event
+- void *data) // IN: device pertaining to event
++ void *data) // IN: net_device or notifier info
+ {
+ VNetBridge *bridge = list_entry(this, VNetBridge, notifier);
+- struct net_device *dev = (struct net_device *) data;
++ struct net_device *dev;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
++ dev = netdev_notifier_info_to_dev(data);
++#else
++ dev = (struct net_device *)data;
++#endif
+ switch (msg) {
+ case NETDEV_UNREGISTER:
+ LOG(2, (KERN_DEBUG "bridge-%s: interface %s is unregistering\n",
+diff --git a/vmnet/compat_netdevice.h b/vmnet/compat_netdevice.h
+--- a/vmnet/compat_netdevice.h
++++ b/vmnet/compat_netdevice.h
+@@ -337,4 +337,11 @@
+ typedef u32 compat_netdev_features_t;
+ #endif
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || \
++ (defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= 0x0704)
++#define compat_netif_trans_update(d) netif_trans_update(d)
++#else
++#define compat_netif_trans_update(d) do { (d)->trans_start = jiffies; } while (0)
++#endif
++
+ #endif /* __COMPAT_NETDEVICE_H__ */
+diff --git a/vmnet/netif.c b/vmnet/netif.c
+--- a/vmnet/netif.c
++++ b/vmnet/netif.c
+@@ -149,7 +149,7 @@
+ memcpy(deviceName, devName, sizeof deviceName);
+ NULL_TERMINATE_STRING(deviceName);
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) || defined(NET_NAME_USER)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
+ dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_USER, VNetNetIfSetup);
+ #else
+ dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
+@@ -465,7 +465,7 @@
+ VNetSend(&netIf->port.jack, skb);
+
+ netIf->stats.tx_packets++;
+- dev->trans_start = jiffies;
++ compat_netif_trans_update(dev);
+
+ return 0;
+ }
+diff --git a/vmnet/userif.c b/vmnet/userif.c
+index 94146f6..5298406 100644
+--- a/vmnet/userif.c
++++ b/vmnet/userif.c
+@@ -36,6 +36,9 @@
+ #include <linux/slab.h>
+ #include <linux/version.h>
+ #include <linux/wait.h>
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
++#include <linux/taskstats_kern.h> // For <linux/sched/signal.h> without version dependency
++#endif
+
+ #include <net/checksum.h>
+ #include <net/sock.h>
+@@ -112,10 +113,7 @@
+ struct page *page = NULL;
+ int retval;
+
+- down_read(&current->mm->mmap_sem);
+- retval = get_user_pages(current, current->mm, addr,
+- 1, 1, 0, &page, NULL);
+- up_read(&current->mm->mmap_sem);
++ retval = get_user_pages_fast(addr, 1, FOLL_WRITE, &page);
+
+ if (retval != 1) {
+ return NULL;
+diff --git a/vmnet/vmnetInt.h b/vmnet/vmnetInt.h
+index 0ee52ec..4e3b923 100644
+--- a/vmnet/vmnetInt.h
++++ b/vmnet/vmnetInt.h
+@@ -77,7 +77,7 @@
+
+
+ extern struct proto vmnet_proto;
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) || defined(sk_net_refcnt)
+ # define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \
+ PF_NETLINK, _pri, &vmnet_proto, 1)
+ #elif defined(VMW_NETDEV_HAS_NET)
diff --git a/vmware-environment.sh b/vmware-environment.sh
new file mode 100644
index 000000000000..f182e1d6d204
--- /dev/null
+++ b/vmware-environment.sh
@@ -0,0 +1,5 @@
+# Need the next line to avoid a problem with incompatible libraries
+export LD_LIBRARY_PATH=/usr/lib/vmware/lib/libatk-1.0.so.0:/usr/lib/vmware/lib/libgio-2.0.so.0:$LD_LIBRARY_PATH
+
+# Uncomment the line below if you always have a problem of incompatible libraries
+#export VMWARE_USE_SHIPPED_LIBS=yes
diff --git a/vmware-hostd-certificates.service b/vmware-hostd-certificates.service
new file mode 100644
index 000000000000..8891ebe775ef
--- /dev/null
+++ b/vmware-hostd-certificates.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=VMware Host Daemon Certificates Generation
+ConditionPathExists=|!/etc/vmware/ssl/rui.key
+ConditionPathExists=|!/etc/vmware/ssl/rui.crt
+
+[Service]
+UMask=0077
+Environment=LD_LIBRARY_PATH=/usr/lib/vmware/lib/libssl.so.1.0.1:/usr/lib/vmware/lib/libcrypto.so.1.0.1
+ExecStart=/usr/lib/vmware/bin/openssl req -x509 -days 365 -newkey rsa:2048 -sha256 -keyout /etc/vmware/ssl/rui.key -out /etc/vmware/ssl/rui.crt -config /etc/vmware/ssl/hostd.ssl.config
+Type=oneshot
+RemainAfterExit=yes
diff --git a/vmware-hostd.service b/vmware-hostd.service
new file mode 100644
index 000000000000..5d755b770a2e
--- /dev/null
+++ b/vmware-hostd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=VMware Host Daemon
+Wants=vmware-hostd-certificates.service
+After=vmware-hostd-certificates.service
+
+[Service]
+ExecStartPre=/usr/bin/mkdir -p /var/run/vmware
+ExecStart=/usr/bin/vmware-hostd -a /etc/vmware/hostd/config.xml
+
+[Install]
+WantedBy=multi-user.target
diff --git a/vmware-networks-configuration.service b/vmware-networks-configuration.service
new file mode 100644
index 000000000000..779b01a3171a
--- /dev/null
+++ b/vmware-networks-configuration.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=VMware Networks Configuration Generation
+ConditionPathExists=|!/etc/vmware/networking
+ConditionPathExists=|!/etc/vmware/vmnet1/dhcpd/dhcpd.conf
+ConditionPathExists=|!/etc/vmware/vmnet1/dhcpd/dhcpd.leases
+ConditionPathExists=|!/etc/vmware/vmnet8/dhcpd/dhcpd.conf
+ConditionPathExists=|!/etc/vmware/vmnet8/dhcpd/dhcpd.leases
+ConditionPathExists=|!/etc/vmware/vmnet8/nat/nat.conf
+
+[Service]
+UMask=0077
+ExecStart=/usr/bin/vmware-networks --postinstall vmware-player,0,1
+Type=oneshot
+RemainAfterExit=yes
diff --git a/vmware-networks.service b/vmware-networks.service
new file mode 100644
index 000000000000..b501b8226ec8
--- /dev/null
+++ b/vmware-networks.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=VMware Networks
+Wants=vmware-networks-configuration.service
+After=vmware-networks-configuration.service
+
+[Service]
+Type=forking
+Restart=always
+ExecStartPre=-/sbin/modprobe vmnet
+ExecStart=/usr/bin/vmware-networks --start
+ExecStop=/usr/bin/vmware-networks --stop
+
+[Install]
+WantedBy=multi-user.target
diff --git a/vmware-usbarbitrator.service b/vmware-usbarbitrator.service
new file mode 100644
index 000000000000..fd1d9cac8034
--- /dev/null
+++ b/vmware-usbarbitrator.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=VMware USB Arbitrator
+
+[Service]
+ExecStart=/usr/lib/vmware/bin/vmware-usbarbitrator -f
+
+[Install]
+WantedBy=multi-user.target
diff --git a/vmware-vix-bootstrap b/vmware-vix-bootstrap
new file mode 100644
index 000000000000..425074de832d
--- /dev/null
+++ b/vmware-vix-bootstrap
@@ -0,0 +1,2 @@
+BINDIR="/usr/bin"
+
diff --git a/vmware-workstation.install b/vmware-workstation.install
new file mode 100644
index 000000000000..cff644a49f7e
--- /dev/null
+++ b/vmware-workstation.install
@@ -0,0 +1,19 @@
+post_install() {
+ cat << EOF
+
+==> Before using VMware, you need to reboot or load vmw_vmci and vmmon kernel modules (in a terminal on root: modprobe -a vmw_vmci vmmon)
+==> You may also need to enable some of these services:
+- vmware-networks.service: to have network access in VMs
+- vmware-usbarbitrator.service: to connect USB devices inside VMs
+- vmware-hostd.service: to share VMs on the network
+
+EOF
+}
+
+post_remove() {
+ cat << EOF
+
+==> To remove VMware settings, delete /etc/vmware and /etc/vmware-installer directories.
+
+EOF
+}