diff options
author | Maxwell Pray | 2017-02-10 11:02:40 -0800 |
---|---|---|
committer | Maxwell Pray | 2017-02-10 11:02:40 -0800 |
commit | 9f1a6eb5795da98646fc42b61a343cb8810c3a4a (patch) | |
tree | c6fa3b071dd528e01ba8cbbea4a1d5490e5b80c5 | |
download | aur-9f1a6eb5795da98646fc42b61a343cb8810c3a4a.tar.gz |
Initial commit.
-rw-r--r-- | .SRCINFO | 41 | ||||
-rw-r--r-- | PKGBUILD | 199 | ||||
-rw-r--r-- | bootstrap | 11 | ||||
-rw-r--r-- | config | 26 | ||||
-rw-r--r-- | config.xml | 903 | ||||
-rw-r--r-- | datastores.xml | 15 | ||||
-rw-r--r-- | dkms.conf | 25 | ||||
-rw-r--r-- | environments.xml | 38 | ||||
-rw-r--r-- | proxy.xml | 50 | ||||
-rw-r--r-- | vmblock.patch | 438 | ||||
-rw-r--r-- | vmci.patch | 265 | ||||
-rw-r--r-- | vmmon.patch | 771 | ||||
-rw-r--r-- | vmnet.patch | 574 | ||||
-rw-r--r-- | vmware-workstation-server-certificates.service | 11 | ||||
-rw-r--r-- | vmware-workstation-server.service | 10 | ||||
-rw-r--r-- | vsock.patch | 231 |
16 files changed, 3608 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..a036c7abb476 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,41 @@ +pkgbase = vmware-workstation + pkgdesc = The industry standard for running multiple operating systems as virtual machines on a single Linux PC. + pkgver = 12.5.2_4638234 + pkgrel = 1 + url = https://www.vmware.com/products/workstation-for-linux.html + arch = x86_64 + license = custom + options = !strip + source = https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-12.5.2-4638234.x86_64.bundle + source = bootstrap + source = config + source = config.xml + source = datastores.xml + source = environments.xml + source = proxy.xml + source = dkms.conf + source = vmware-workstation-server.service + source = vmware-workstation-server-certificates.service + source = vmblock.patch + source = vmci.patch + source = vmmon.patch + source = vmnet.patch + source = vsock.patch + sha1sums = 70f81c36f13e957fded9577fcd7b9b0fe1481c0c + sha1sums = a91b3d711846dafe10f45d89c531dab703bfb113 + sha1sums = e57f7715c092d9b1fb74a7baadc07ef214cfb4cd + sha1sums = 4bea74ce942e73bf25a8e5fdb0027493d3f114b9 + sha1sums = dfad83699f7546aeb85a38551a33666dbb14535f + sha1sums = a7e4a6fe33dc6ca95b469ec6f88de21e5b16a95b + sha1sums = 80c5626984ffcdea6fa655d248c731e7c9c657fa + sha1sums = 3f6f14f8047941c015e9067f62ae403acc7b563c + sha1sums = 97dc28cbd868f9fbeb89b1719ca05ec916c37110 + sha1sums = fa9bc954e7ea595fd365f3d34fc7b89351e355d9 + sha1sums = bd8955b45f9ac3deed99aba93d2c82bc5424167e + sha1sums = b4bd05f5d5a98f90fcbdd515b7bb7e6151951e11 + sha1sums = 4958ce81e7f5b192e1417426fb70748fdd9a15b9 + sha1sums = 51d221c5bc7e3d566d5ce27d0ac603196c12aaf4 + sha1sums = 15ecb9143dfa0135ced2e726eff4800448f3d369 + +pkgname = vmware-workstation + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..bddecddf5e6b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,199 @@ +# Maintainer: Maxwell Pray a.k.a. Synthead <synthead@gmail.com> + +pkgname=vmware-workstation +pkgver=12.5.2_4638234 +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) +source=( + "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-${pkgver/_/-}.x86_64.bundle" + + bootstrap + config + + config.xml + datastores.xml + environments.xml + proxy.xml + + dkms.conf + vmware-workstation-server.service + vmware-workstation-server-certificates.service + + vmblock.patch + vmci.patch + vmmon.patch + vmnet.patch + vsock.patch +) +sha1sums=( + 70f81c36f13e957fded9577fcd7b9b0fe1481c0c + + a91b3d711846dafe10f45d89c531dab703bfb113 + e57f7715c092d9b1fb74a7baadc07ef214cfb4cd + + 4bea74ce942e73bf25a8e5fdb0027493d3f114b9 + dfad83699f7546aeb85a38551a33666dbb14535f + a7e4a6fe33dc6ca95b469ec6f88de21e5b16a95b + 80c5626984ffcdea6fa655d248c731e7c9c657fa + + 3f6f14f8047941c015e9067f62ae403acc7b563c + 97dc28cbd868f9fbeb89b1719ca05ec916c37110 + fa9bc954e7ea595fd365f3d34fc7b89351e355d9 + + bd8955b45f9ac3deed99aba93d2c82bc5424167e + b4bd05f5d5a98f90fcbdd515b7bb7e6151951e11 + 4958ce81e7f5b192e1417426fb70748fdd9a15b9 + 51d221c5bc7e3d566d5ce27d0ac603196c12aaf4 + 15ecb9143dfa0135ced2e726eff4800448f3d369 +) +options=(!strip) + +prepare() { + extracted_dir="$srcdir/extracted" + [[ -d "$extracted_dir" ]] && rm -r "$extracted_dir" + + bash \ + "$(readlink -f "$srcdir/VMware-Workstation-Full-${pkgver/_/-}.x86_64.bundle")" \ + --extract "$extracted_dir" +} + +package() { + # Make directories and copy files. + + mkdir -p \ + "$pkgdir/usr"/{share,bin,doc,lib/vmware/setup} \ + "$pkgdir/var/lib/vmware/Shared VMs" \ + "$pkgdir/usr/lib/vmware-vix" \ + "$pkgdir/etc/vmware" + + cd "$srcdir/extracted" + + cp -r \ + vmware-workstation/share/* \ + vmware-workstation/doc \ + vmware-workstation/man \ + "$pkgdir/usr/share" + + cp -r \ + vmware-workstation/bin/* \ + vmware-vmx/bin/* \ + vmware-vix-core/bin/* \ + vmware-workstation-server/{vmware-hostd,vmware-vim-cmd,vmware-wssc-adminTool} \ + "$pkgdir/usr/bin" + + cp -r \ + vmware-workstation/lib/* \ + vmware-player-app/lib/* \ + vmware-vmx/lib/* \ + vmware-workstation-server/{bin,lib,hostd} \ + "$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-Workstation1200/lib/Workstation-12.0.0 \ + vmware-vix-core/vixwrapper-config.txt \ + "$pkgdir/usr/lib/vmware-vix" + + 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-workstation-server.service" \ + "$pkgdir/usr/lib/systemd/system/vmware-workstation-server.service" + + install -Dm 644 \ + "$srcdir/vmware-workstation-server-certificates.service" \ + "$pkgdir/usr/lib/systemd/system/vmware-workstation-server-certificates.service" + + for hostd_file in config datastores environments proxy; do + install -Dm 644 "$srcdir/$hostd_file.xml" "$pkgdir/etc/vmware/hostd/$hostd_file.xml" + done + + + # Apply permissions where necessary. + + chmod +x \ + "$pkgdir/usr/bin"/* \ + "$pkgdir/usr/lib/vmware/bin"/* \ + "$pkgdir/usr/lib/vmware/setup/vmware-config" \ + "$pkgdir/usr/lib/vmware/lib/wrapper-gtk24.sh" + + chmod -R 600 "$pkgdir/etc/vmware/ssl" + chmod +s "$pkgdir/usr/lib/vmware/bin/vmware-vmx" + + + # 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 + + + # 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,@@VMWARE_INSTALLER@@,/usr/bin/vmware,' "$pkgdir/usr/share/applications/vmware-workstation.desktop" + + sed -i 's,@@AUTHD_PORT@@,902,' "$pkgdir/usr/lib/vmware/hostd/docroot/client/clients.xml" + + sed \ + -e 's/@@VERSION@@/2.1.0/' \ + -e 's,@@VMWARE_INSTALLER@@,/usr/lib/vmware-installer/2.1.0,' \ + -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/dkms.conf" "$dkms_dir/dkms.conf" + + sed \ + -e "s/@PKGNAME@/$pkgname/g" \ + -e "s/@PKGVER@/$pkgver/g" \ + -i "$dkms_dir/dkms.conf" + + find vmware-vmx/lib/modules/source -mindepth 1 -exec bsdtar -xf {} -C "$dkms_dir" \; + + for module in vmblock vmci vmmon vmnet vsock; do + patch -p2 --read-only=ignore --directory="$dkms_dir/$module-only" < "$srcdir/$module.patch" + done +} diff --git a/bootstrap b/bootstrap new file mode 100644 index 000000000000..85d30e58f210 --- /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="/etc/init.d/vmware" diff --git a/config b/config new file mode 100644 index 000000000000..8d8ea333e5a1 --- /dev/null +++ b/config @@ -0,0 +1,26 @@ +.encoding = "UTF-8" +VMCI_CONFED = "yes" +NETWORKING = "yes" +initscriptdir = "/etc/init.d" +VMBLOCK_CONFED = "yes" +authd.fullpath = "/usr/sbin/vmware-authd" +gksu.rootMethod = "su" +VSOCK_CONFED = "yes" +libdir = "/usr/lib/vmware" +bindir = "/usr/bin" +vmware.fullpath = "/usr/bin/vmware" +vix.libdir = "/usr/lib/vmware-vix" +installerDefaults.componentDownloadEnabled = "yes" +installerDefaults.autoSoftwareUpdateEnabled.epoch = "5971871847" +vix.config.version = "1" +player.product.version = "12.5.2" +installerDefaults.dataCollectionEnabled.epoch = "2097005183" +installerDefaults.dataCollectionEnabled = "no" +installerDefaults.transferVersion = "1" +installerDefaults.autoSoftwareUpdateEnabled = "no" +product.buildNumber = "4638234" +authd.client.port = "902" +authd.proxy.nfc = "vmware-hostd:ha-nfc" +product.version = "12.5.2" +workstation.product.version = "12.5.2" +product.name = "VMware Workstation" diff --git a/config.xml b/config.xml new file mode 100644 index 000000000000..b08e4b150293 --- /dev/null +++ b/config.xml @@ -0,0 +1,903 @@ +<!-- 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>true</fairThreadPool> --> + + <!-- defaults to 14, Max number of threads used for FWQ items --> + <!-- <maxThreads>14</maxThreads> --> + + <!-- defaults to 5, Initial number of threads used for FWQ items --> + <!-- <minThreads>5</minThreads> --> + + <!-- defaults to 2, number of IO threads used by the FWQ thread pool --> + <!-- These threads perform the asynchronous IO and provide timer services. + Generally small number should be enough as no blocking operations + are executed within IO threads. + A CPU intensive operation performed in these threads is SSL handling, + so on multi-CPU machine with high volume of SSL traffic it may be + beneficial increasing this number. + --> + <!-- <ioThreads>2</ioThreads> --> + + <!-- 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> --> + + <!-- upgradeCerts is a path to a file containing accepted signer certificates --> + <!-- <upgradeCerts>/usr/share/certs/vmware.cert</upgradeCerts> --> + + <!-- 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> + + <vslmsvc> + <path>libvslmsvc.so</path> + <enabled>false</enabled> + <mockup> + <enabled>false</enabled> + </mockup> + </vslmsvc> + + <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/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 b/dkms.conf new file mode 100644 index 000000000000..6df1e9db5cfe --- /dev/null +++ b/dkms.conf @@ -0,0 +1,25 @@ +PACKAGE_NAME='@PKGNAME@' +PACKAGE_VERSION='@PKGVER@' +AUTOINSTALL='yes' +MAKE[0]='find -mindepth 1 -maxdepth 1 -type d -exec make -C {} \;' +CLEAN='find -mindepth 1 -maxdepth 1 -type d -exec make clean -C {} \;' + +BUILT_MODULE_NAME[0]='vmblock' +BUILT_MODULE_LOCATION[0]='vmblock-only' +DEST_MODULE_LOCATION[0]='/kernel/misc' + +BUILT_MODULE_NAME[1]='vmci' +BUILT_MODULE_LOCATION[1]='vmci-only' +DEST_MODULE_LOCATION[1]='/kernel/misc' + +BUILT_MODULE_NAME[2]='vmmon' +BUILT_MODULE_LOCATION[2]='vmmon-only' +DEST_MODULE_LOCATION[2]='/kernel/misc' + +BUILT_MODULE_NAME[3]='vmnet' +BUILT_MODULE_LOCATION[3]='vmnet-only' +DEST_MODULE_LOCATION[3]='/kernel/misc' + +BUILT_MODULE_NAME[4]='vsock' +BUILT_MODULE_LOCATION[4]='vsock-only' +DEST_MODULE_LOCATION[4]='/kernel/misc' diff --git a/environments.xml b/environments.xml new file mode 100644 index 000000000000..93a12dac54b8 --- /dev/null +++ b/environments.xml @@ -0,0 +1,38 @@ +<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> + <Cfg id = "9"> + <Descriptor> /etc/vmware/hostd/env/ws-hw12.xml </Descriptor> + <Options> /etc/vmware/hostd/env/vmconfigoption-ws-hw12.xml</Options> + </Cfg> +</Environment> 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/vmblock.patch b/vmblock.patch new file mode 100644 index 000000000000..cad47e8d6a2f --- /dev/null +++ b/vmblock.patch @@ -0,0 +1,438 @@ +diff --git a/vmblock/Makefile b/vmblock/Makefile +index bbfe225..8ec1a86 100644 +--- a/vmblock/Makefile ++++ b/vmblock/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/vmblock/Makefile.kernel b/vmblock/Makefile.kernel +index ab7a727..e3ec9d2 100644 +--- a/vmblock/Makefile.kernel ++++ b/vmblock/Makefile.kernel +@@ -19,7 +19,7 @@ + + INCLUDE += -I$(SRCROOT)/include + +-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) ++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE) + + EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachecreate.c, -DVMW_KMEMCR_HAS_DTOR, ) + EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/cachector.c, -DVMW_KMEMCR_CTOR_HAS_3_ARGS, ) +diff --git a/vmblock/linux/control.c b/vmblock/linux/control.c +index 79716bd..5b6acb2 100644 +--- a/vmblock/linux/control.c ++++ b/vmblock/linux/control.c +@@ -208,9 +208,17 @@ SetupProcDevice(void) + VMBlockSetProcEntryOwner(controlProcMountpoint); + + /* Create /proc/fs/vmblock/dev */ ++ // create_proc_entry deprecated in 3.10 ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) ++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, ++ VMBLOCK_CONTROL_MODE, ++ controlProcDirEntry, ++ &ControlFileOps); ++#else + controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, + VMBLOCK_CONTROL_MODE, + controlProcDirEntry); ++#endif + if (!controlProcEntry) { + Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n"); + remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry); +@@ -218,7 +226,9 @@ SetupProcDevice(void) + return -EINVAL; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) //Maybe 3.14? 3.13? + controlProcEntry->proc_fops = &ControlFileOps; ++#endif + return 0; + } + +@@ -272,17 +282,50 @@ CleanupProcDevice(void) + *---------------------------------------------------------------------------- + */ + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) ++/* copy-paste from Lustre FS by pavlinux */ ++static inline char *ll_getname(const char __user *filename) ++{ ++ int ret = 0, len; ++ char *tmp = __getname(); ++ ++ if (!tmp) ++ return ERR_PTR(-ENOMEM); ++ ++ len = strncpy_from_user(tmp, filename, PATH_MAX); ++ if (len == 0) ++ ret = -ENOENT; ++ else if (len > PATH_MAX) ++ ret = -ENAMETOOLONG; ++ ++ if (ret) { ++ __putname(tmp); ++ tmp = ERR_PTR(ret); ++ } ++ return tmp; ++}; ++#endif ++ + static int + ExecuteBlockOp(const char __user *buf, // IN: buffer with name + const os_blocker_id_t blocker, // IN: blocker ID (file) + int (*blockOp)(const char *filename, // IN: block operation + const os_blocker_id_t blocker)) + { +- char *name; ++ struct filename *fn = NULL; ++ char *name = (char *)fn->name; + int i; + int retval; + +- name = getname(buf); ++ // Not sure what changed in 3.13 to neccessitate this. ++ // Gentoo uses __getname(), though. ++ // https://github.com/gentoo/vmware/blob/master/app-emulation/vmware-modules/files/308-3.10-02-control.patch#L36 ++ // ~MK ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0) ++ name = (char *)getname(buf); ++#else ++ name = (char *)ll_getname(buf); ++#endif + if (IS_ERR(name)) { + return PTR_ERR(name); + } +@@ -293,7 +336,13 @@ ExecuteBlockOp(const char __user *buf, // IN: buffer with name + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ // I'm not sure what this does, but you seem to know what you're doing ~MK ++ if (fn->name != fn->iname) { /* add by pavlinux */ ++ __putname(fn->name); ++ kvfree(fn); ++ } else { ++ __putname(fn); ++ } + + return retval; + } +diff --git a/vmblock/linux/dentry.c b/vmblock/linux/dentry.c +index 05ea95a..1245358 100644 +--- a/vmblock/linux/dentry.c ++++ b/vmblock/linux/dentry.c +@@ -32,7 +32,13 @@ + #include "block.h" + + +-static int DentryOpRevalidate(struct dentry *dentry, struct nameidata *nd); ++// From what I can tell, this should've always been an unsigned int? ++static int DentryOpRevalidate(struct dentry *dentry, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) // Maybe 3.14 or 3.13? ++ struct nameidata *nd); ++#else ++ unsigned int flags); ++#endif + + struct dentry_operations LinkDentryOps = { + .d_revalidate = DentryOpRevalidate, +@@ -60,7 +66,11 @@ struct dentry_operations LinkDentryOps = { + + static int + DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + struct nameidata *nd) // IN: lookup flags & intent ++#else ++ unsigned int flags) // IN: lookup flags & intent ++#endif + { + VMBlockInodeInfo *iinfo; + struct nameidata actualNd; +@@ -101,7 +111,11 @@ DentryOpRevalidate(struct dentry *dentry, // IN: dentry revalidating + if (actualDentry && + actualDentry->d_op && + actualDentry->d_op->d_revalidate) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) ++ return actualDentry->d_op->d_revalidate(actualDentry, flags); ++#else + return actualDentry->d_op->d_revalidate(actualDentry, nd); ++#endif + } + + if (compat_path_lookup(iinfo->name, 0, &actualNd)) { +diff --git a/vmblock/linux/file.c b/vmblock/linux/file.c +index d7ac1f6..c5e6604 100644 +--- a/vmblock/linux/file.c ++++ b/vmblock/linux/file.c +@@ -39,6 +39,7 @@ typedef ino_t inode_num_t; + #endif + + /* Specifically for our filldir_t callback */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) + typedef struct FilldirInfo { + filldir_t filldir; + void *dirent; +@@ -76,6 +77,7 @@ Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir + /* Specify DT_LNK regardless */ + return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK); + } ++#endif + + + /* File operations */ +@@ -132,7 +134,12 @@ FileOpOpen(struct inode *inode, // IN + * and that would try to acquire the inode's semaphore; if the two inodes + * are the same we'll deadlock. + */ ++ // f_dentry is defined as f_path.dentry until 3.19 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) + if (actualFile->f_dentry && inode == actualFile->f_dentry->d_inode) { ++#else ++ if (actualFile->f_path.dentry && inode == actualFile->f_path.dentry->d_inode) { ++#endif + Warning("FileOpOpen: identical inode encountered, open cannot succeed.\n"); + if (filp_close(actualFile, current->files) < 0) { + Warning("FileOpOpen: unable to close opened file.\n"); +@@ -164,13 +171,20 @@ FileOpOpen(struct inode *inode, // IN + *---------------------------------------------------------------------------- + */ + ++// pavlinux's patch completely removes this bit for kernels older than 3.13 + static int + FileOpReaddir(struct file *file, // IN ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) + void *dirent, // IN + filldir_t filldir) // IN ++#else ++ struct dir_context* ctx) //IN ++#endif + { + int ret; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) + FilldirInfo info; ++#endif + struct file *actualFile; + + if (!file) { +@@ -184,12 +198,20 @@ FileOpReaddir(struct file *file, // IN + return -EINVAL; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) + info.filldir = filldir; + info.dirent = dirent; + + actualFile->f_pos = file->f_pos; + ret = vfs_readdir(actualFile, Filldir, &info); + file->f_pos = actualFile->f_pos; ++#else ++ /* Ricky Wong Yung Fei: ++ * Manipulation of pos is now handled internally by iterate_dir(). ++ */ ++ ret = iterate_dir(actualFile, ctx); ++ file->f_pos = actualFile->f_pos; ++#endif + + return ret; + } +@@ -236,8 +258,15 @@ FileOpRelease(struct inode *inode, // IN + } + + ++// pavlinux's patch drops FileOpReaddr for < 3.13 ++// pavlinux's patch sets .owner = THIS_MODULE and .llseek = no_llseek + struct file_operations RootFileOps = { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) + .readdir = FileOpReaddir, ++#else ++ .iterate = FileOpReaddir, ++#endif ++ .owner = THIS_MODULE, + .open = FileOpOpen, + .release = FileOpRelease, + }; +diff --git a/vmblock/linux/inode.c b/vmblock/linux/inode.c +index 098c94c..bd2bf01 100644 +--- a/vmblock/linux/inode.c ++++ b/vmblock/linux/inode.c +@@ -35,13 +35,24 @@ + + + /* Inode operations */ ++// Again, it looks like last arg should've always been unsigned int ~MK + static struct dentry *InodeOpLookup(struct inode *dir, +- struct dentry *dentry, struct nameidata *nd); +-static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) +-static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd); ++ struct dentry *dentry, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) // Maybe 3.12 or 3.13? ++ struct nameidata *nd); + #else ++ unsigned int flags); ++#endif ++static int InodeOpReadlink(struct dentry *dentry, char __user *buffer, int buflen); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) + static int InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99) ++static const char *InodeOpGetLink(struct dentry *dentry, struct inode *inode, ++ struct delayed_call *done); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99) ++static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie); ++#else ++static void *InodeOpFollowlink(struct dentry *dentry, struct nameidata *nd); + #endif + + +@@ -49,9 +60,13 @@ struct inode_operations RootInodeOps = { + .lookup = InodeOpLookup, + }; + +-static struct inode_operations LinkInodeOps = { ++struct inode_operations LinkInodeOps = { + .readlink = InodeOpReadlink, ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99) ++ .get_link = InodeOpGetLink, ++#else + .follow_link = InodeOpFollowlink, ++#endif + }; + + +@@ -75,7 +90,11 @@ static struct inode_operations LinkInodeOps = { + static struct dentry * + InodeOpLookup(struct inode *dir, // IN: parent directory's inode + struct dentry *dentry, // IN: dentry to lookup ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) + struct nameidata *nd) // IN: lookup intent and information ++#else ++ unsigned int flags) // IN: lookup intent and information ++#endif + { + char *filename; + struct inode *inode; +@@ -135,7 +154,12 @@ InodeOpLookup(struct inode *dir, // IN: parent directory's inode + inode->i_size = INODE_TO_IINFO(inode)->nameLen; + inode->i_version = 1; + inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0) + inode->i_uid = inode->i_gid = 0; ++#else ++ inode->i_gid = make_kgid(current_user_ns(), 0); ++ inode->i_uid = make_kuid(current_user_ns(), 0); ++#endif + inode->i_op = &LinkInodeOps; + + d_add(dentry, inode); +@@ -176,8 +200,13 @@ InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink + if (!iinfo) { + return -EINVAL; + } +- ++#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 99) + return vfs_readlink(dentry, buffer, buflen, iinfo->name); ++#elif LINUX_VERSION_CODE <= KERNEL_VERSION(4, 6, 99) ++ return readlink_copy(buffer, buflen, iinfo->name); ++#else ++ return generic_readlink(dentry, buffer, buflen); ++#endif + } + + +@@ -198,30 +227,58 @@ InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink + *---------------------------------------------------------------------------- + */ + +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) +-static void * ++static ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 13) ++int ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99) ++const char * + #else +-static int ++void * + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99) ++InodeOpGetLink(struct dentry *dentry, struct inode *inode, ++ struct delayed_call *done) ++#else + InodeOpFollowlink(struct dentry *dentry, // IN : dentry of symlink ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99) ++ void **cookie) ++#else + struct nameidata *nd) // OUT: stores result ++#endif ++#endif + { + int ret; + VMBlockInodeInfo *iinfo; + + if (!dentry) { ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99) ++ ret = -ECHILD; ++#else + Warning("InodeOpReadlink: invalid args from kernel\n"); + ret = -EINVAL; ++#endif + goto out; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99) ++ iinfo = INODE_TO_IINFO(inode); ++#else + iinfo = INODE_TO_IINFO(dentry->d_inode); ++#endif + if (!iinfo) { + ret = -EINVAL; + goto out; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) + ret = vfs_follow_link(nd, iinfo->name); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99) ++ return (char *)(iinfo->name); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99) ++ return *cookie = (char *)(iinfo->name); ++#else ++ nd_set_link(nd, iinfo->name); ++#endif + + out: + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13) +diff --git a/vmblock/shared/compat_namei.h b/vmblock/shared/compat_namei.h +index f82dd49..426d40b 100644 +--- a/vmblock/shared/compat_namei.h ++++ b/vmblock/shared/compat_namei.h +@@ -45,4 +45,20 @@ + #define compat_path_lookup(name, flags, nd) path_lookup(name, flags, nd) + #endif + ++/* nameidata struct for 4.2+ */ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,2,0) ++struct nameidata { ++ struct path path; ++ struct qstr last; ++ struct path root; ++ struct inode *inode; /* path.dentry.d_inode */ ++ unsigned int flags; ++ unsigned seq, m_seq; ++ int last_type; ++ unsigned depth; ++ struct file *base; ++ char *saved_names[MAX_NESTED_LINKS + 1]; ++}; ++#endif ++ + #endif /* __COMPAT_NAMEI_H__ */ diff --git a/vmci.patch b/vmci.patch new file mode 100644 index 000000000000..0f9598d74bf5 --- /dev/null +++ b/vmci.patch @@ -0,0 +1,265 @@ +diff --git a/vmci/Makefile b/vmci/Makefile +index c630705..18357e5 100644 +--- a/vmci/Makefile ++++ b/vmci/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/vmci/Makefile.kernel b/vmci/Makefile.kernel +index 8e6e7d0..28eb503 100644 +--- a/vmci/Makefile.kernel ++++ b/vmci/Makefile.kernel +@@ -21,7 +21,7 @@ CC_OPTS += -DVMCI + + INCLUDE += -I$(SRCROOT)/shared -I$(SRCROOT)/common -I$(SRCROOT)/linux + +-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) ++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE) + + obj-m += $(DRIVER).o + +diff --git a/vmci/linux/driver.c b/vmci/linux/driver.c +index f676166..9e42f3f 100644 +--- a/vmci/linux/driver.c ++++ b/vmci/linux/driver.c +@@ -26,6 +26,7 @@ + + #include <linux/file.h> + #include <linux/fs.h> ++#include <linux/vmalloc.h> + #include <linux/init.h> + #if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) + # include <linux/ioctl32.h> +@@ -1467,12 +1468,19 @@ VMCIUserVALockPage(VA addr) // IN: + int retval; + + down_read(¤t->mm->mmap_sem); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) +- retval = get_user_pages(addr, 1, 1, 0, &page, NULL); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) ++ retval = get_user_pages(addr, + #else + retval = get_user_pages(current, current->mm, addr, +- 1, 1, 0, &page, NULL); + #endif ++ 1, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) ++ 1, 0, ++#else ++ FOLL_WRITE, ++#endif ++ &page, NULL); ++ + up_read(¤t->mm->mmap_sem); + + if (retval != 1) { +@@ -1687,7 +1695,11 @@ vmci_guest_init(void) + /* This should be last to make sure we are done initializing. */ + retval = pci_register_driver(&vmci_driver); + if (retval < 0) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) + vfree(data_buffer); ++#else ++ kvfree(data_buffer); ++#endif + data_buffer = NULL; + return retval; + } +@@ -2474,7 +2486,11 @@ vmci_exit(void) + + if (guestDeviceInit) { + pci_unregister_driver(&vmci_driver); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) + vfree(data_buffer); ++#else ++ kvfree(data_buffer); ++#endif + guestDeviceInit = FALSE; + } + +@@ -2483,7 +2499,7 @@ vmci_exit(void) + + VMCI_HostCleanup(); + +- retval = misc_deregister(&linuxState.misc); ++ retval = compat_misc_deregister(&linuxState.misc); + if (retval) { + Warning(LGPFX "Module %s: error unregistering\n", VMCI_MODULE_NAME); + } else { +diff --git a/vmci/linux/vmciKernelIf.c b/vmci/linux/vmciKernelIf.c +index 3fba8b6..1836442 100644 +--- a/vmci/linux/vmciKernelIf.c ++++ b/vmci/linux/vmciKernelIf.c +@@ -40,6 +40,7 @@ + #include <linux/socket.h> /* For memcpy_{to,from}iovec(). */ + #include <linux/vmalloc.h> + #include <linux/wait.h> ++#include <linux/skbuff.h> + + #include "compat_highmem.h" + #include "compat_interrupt.h" +@@ -1198,16 +1199,29 @@ __VMCIMemcpyToQueue(VMCIQueue *queue, // OUT: + } + + if (isIovec) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + struct iovec *iov = (struct iovec *)src; ++#else ++ struct msghdr *msg = (struct msghdr *)src; ++#endif + int err; + + /* The iovec will track bytesCopied internally. */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + err = memcpy_fromiovec((uint8 *)va + pageOffset, iov, toCopy); ++#else ++ err = memcpy_from_msg((uint8 *)va + pageOffset, msg, toCopy); ++#endif + if (err != 0) { + if (kernelIf->host) { + kunmap(kernelIf->u.h.page[pageIndex]); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + } + return VMCI_ERROR_INVALID_ARGS; ++#else ++ return VMCI_ERROR_INVALID_ARGS; ++ } ++#endif + } + } else { + memcpy((uint8 *)va + pageOffset, (uint8 *)src + bytesCopied, toCopy); +@@ -1273,11 +1287,19 @@ __VMCIMemcpyFromQueue(void *dest, // OUT: + } + + if (isIovec) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + struct iovec *iov = (struct iovec *)dest; ++#else ++ struct msghdr *msg = (struct msghdr *)dest; ++#endif + int err; + + /* The iovec will track bytesCopied internally. */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + err = memcpy_toiovec(iov, (uint8 *)va + pageOffset, toCopy); ++#else ++ err = memcpy_to_msg(msg, (uint8 *)va + pageOffset, toCopy); ++#endif + if (err != 0) { + if (kernelIf->host) { + kunmap(kernelIf->u.h.page[pageIndex]); +@@ -1834,7 +1856,11 @@ VMCIReleasePages(struct page **pages, // IN + if (dirty) { + set_page_dirty(pages[i]); + } ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) ++ put_page(pages[i]); ++#else + page_cache_release(pages[i]); ++#endif + pages[i] = NULL; + } + } +@@ -2048,21 +2074,22 @@ VMCIHost_GetUserMemory(VA64 produceUVA, // IN + int err = VMCI_SUCCESS; + + down_write(¤t->mm->mmap_sem); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) + retval = get_user_pages((VA)produceUVA, +- produceQ->kernelIf->numPages, +- 1, 0, +- produceQ->kernelIf->u.h.headerPage, +- NULL); + #else + retval = get_user_pages(current, + current->mm, + (VA)produceUVA, ++#endif + produceQ->kernelIf->numPages, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) + 1, 0, ++#else ++ FOLL_WRITE, ++#endif + produceQ->kernelIf->u.h.headerPage, + NULL); +-#endif ++ + if (retval < produceQ->kernelIf->numPages) { + Log("get_user_pages(produce) failed (retval=%d)\n", retval); + VMCIReleasePages(produceQ->kernelIf->u.h.headerPage, retval, FALSE); +@@ -2070,11 +2097,19 @@ VMCIHost_GetUserMemory(VA64 produceUVA, // IN + goto out; + } + ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) ++ retval = get_user_pages((VA)consumeUVA, ++#else + retval = get_user_pages(current, + current->mm, + (VA)consumeUVA, ++#endif + consumeQ->kernelIf->numPages, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) + 1, 0, ++#else ++ FOLL_WRITE, ++#endif + consumeQ->kernelIf->u.h.headerPage, + NULL); + if (retval < consumeQ->kernelIf->numPages) { +diff --git a/vmci/shared/compat_module.h b/vmci/shared/compat_module.h +index 2af7372..729aedc 100644 +--- a/vmci/shared/compat_module.h ++++ b/vmci/shared/compat_module.h +@@ -80,4 +80,13 @@ static const char __module_cat(tag, __LINE__)[] \ + typedef int compat_mod_param_bool; + #endif + ++/* ++ * Linux kernel >= 4.2.99 does not return anything from misc_deregister ++ */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 99) ++#define compat_misc_deregister(misc) misc_deregister(misc) ++#else ++#define compat_misc_deregister(misc) ({misc_deregister(misc);0;}) ++#endif ++ + #endif /* __COMPAT_MODULE_H__ */ +diff --git a/vmci/shared/vm_device_version.h b/vmci/shared/vm_device_version.h +index e2cb477..3dd7097 100644 +--- a/vmci/shared/vm_device_version.h ++++ b/vmci/shared/vm_device_version.h +@@ -53,7 +53,9 @@ + * VMware HD Audio codec + * VMware HD Audio controller + */ ++#ifndef PCI_VENDOR_ID_VMWARE + #define PCI_VENDOR_ID_VMWARE 0x15AD ++#endif + #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 + #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 + #define PCI_DEVICE_ID_VMWARE_VGA 0x0711 +diff --git a/vmci/shared/vmci_kernel_if.h b/vmci/shared/vmci_kernel_if.h +index 9def671..082fe59 100644 +--- a/vmci/shared/vmci_kernel_if.h ++++ b/vmci/shared/vmci_kernel_if.h +@@ -93,7 +93,7 @@ + typedef Semaphore VMCIEvent; + typedef Semaphore VMCIMutex; + typedef World_ID VMCIHostVmID; +- typedef uint32 VMCIHostUser; ++ typedef uint32_t VMCIHostUser; + typedef PPN *VMCIQPGuestMem; + #elif defined(linux) + typedef spinlock_t VMCILock; diff --git a/vmmon.patch b/vmmon.patch new file mode 100644 index 000000000000..f2c4fd370679 --- /dev/null +++ b/vmmon.patch @@ -0,0 +1,771 @@ +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/Makefile.kernel b/vmmon/Makefile.kernel +index bf805e0..9aac585 100644 +--- a/vmmon/Makefile.kernel ++++ b/vmmon/Makefile.kernel +@@ -22,7 +22,7 @@ CC_OPTS += -DVMMON -DVMCORE + INCLUDE := -I$(SRCROOT)/include -I$(SRCROOT)/common -I$(SRCROOT)/linux \ + -I$(SRCROOT)/vmcore + +-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) ++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE) + + EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/smpcall.c, -DVMW_HAVE_SMP_CALL_3ARG, ) + EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/autoconf/tsc_khz.c, -DVMW_HAVE_TSC_KHZ, ) +diff --git a/vmmon/include/compat_module.h b/vmmon/include/compat_module.h +index 2af7372..729aedc 100644 +--- a/vmmon/include/compat_module.h ++++ b/vmmon/include/compat_module.h +@@ -80,4 +80,13 @@ static const char __module_cat(tag, __LINE__)[] \ + typedef int compat_mod_param_bool; + #endif + ++/* ++ * Linux kernel >= 4.2.99 does not return anything from misc_deregister ++ */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 99) ++#define compat_misc_deregister(misc) misc_deregister(misc) ++#else ++#define compat_misc_deregister(misc) ({misc_deregister(misc);0;}) ++#endif ++ + #endif /* __COMPAT_MODULE_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 +@@ -124,7 +124,16 @@ static struct vm_operations_struct vmuser_mops = { + #endif + }; + +-static struct file_operations vmuser_fops; ++static struct file_operations vmuser_fops = { ++ .owner = THIS_MODULE, ++ .poll = LinuxDriverPoll, ++ .unlocked_ioctl = LinuxDriver_Ioctl, ++ .compat_ioctl = LinuxDriver_Ioctl, ++ .open = LinuxDriver_Open, ++ .release = LinuxDriver_Close, ++ .mmap = LinuxDriverMmap ++}; ++ + static struct timer_list tscTimer; + static Atomic_uint32 tsckHz; + static VmTimeStart tsckHzStartTime; +@@ -254,7 +263,7 @@ static void + LinuxDriverInitTSCkHz(void) + { + unsigned int khz; +- ++ + khz = compat_tsc_khz(); + if (khz != 0) { + Atomic_Write(&tsckHz, khz); +@@ -269,7 +278,7 @@ LinuxDriverInitTSCkHz(void) + add_timer(&tscTimer); + } + +- ++ + /* + *---------------------------------------------------------------------- + * +@@ -317,21 +326,6 @@ init_module(void) + linuxState.fastClockPriority = -20; + linuxState.swapSize = VMMON_UNKNOWN_SWAP_SIZE; + +- /* +- * Initialize the file_operations structure. Because this code is always +- * compiled as a module, this is fine to do it here and not in a static +- * initializer. +- */ +- +- memset(&vmuser_fops, 0, sizeof vmuser_fops); +- vmuser_fops.owner = THIS_MODULE; +- vmuser_fops.poll = LinuxDriverPoll; +- vmuser_fops.unlocked_ioctl = LinuxDriver_Ioctl; +- vmuser_fops.compat_ioctl = LinuxDriver_Ioctl; +- vmuser_fops.open = LinuxDriver_Open; +- vmuser_fops.release = LinuxDriver_Close; +- vmuser_fops.mmap = LinuxDriverMmap; +- + #ifdef VMX86_DEVEL + devel_init_module(); + linuxState.minor = 0; +@@ -387,7 +381,9 @@ cleanup_module(void) + #ifdef VMX86_DEVEL + unregister_chrdev(linuxState.major, linuxState.deviceName); + #else +- misc_deregister(&linuxState.misc); ++ if (compat_misc_deregister(&linuxState.misc)) { ++ Warning("Module %s: error unregistering\n", linuxState.deviceName); ++ } + #endif + + Log("Module %s: unloaded\n", linuxState.deviceName); +@@ -1279,7 +1275,7 @@ LinuxDriverReadTSC(void *data, // OUT: TSC values + *----------------------------------------------------------------------------- + */ + +-__attribute__((always_inline)) static Bool ++inline __attribute__((always_inline)) static Bool + LinuxDriverSyncReadTSCs(uint64 *delta) // OUT: TSC max - TSC min + { + TSCDelta tscDelta; +@@ -1971,7 +1967,7 @@ LinuxDriver_Ioctl(struct file *filp, // IN: + break; + } + +- default: ++ default: + Warning("Unknown ioctl %d\n", iocmd); + retval = -EINVAL; + } +diff --git a/vmmon/linux/hostif.c b/vmmon/linux/hostif.c +index 7053a83..583d6da 100644 +--- a/vmmon/linux/hostif.c ++++ b/vmmon/linux/hostif.c +@@ -74,6 +74,7 @@ + #include <linux/kthread.h> + #include <linux/wait.h> + ++#include <asm/apic.h> + + #include "vmware.h" + #include "x86apic.h" +@@ -139,6 +140,10 @@ static DECLARE_TASKLET(timerTasklet, HostIFWakeupClockThread, 0); + */ + #define LOCKED_PAGE_SLACK 10000 + ++#if LINUX_VERSION_CODE > KERNEL_VERSION(4, 7, 99) ++#define NR_ANON_PAGES NR_ANON_MAPPED ++#endif ++ + static struct { + Atomic_uint64 uptimeBase; + VersionedAtomic version; +@@ -435,7 +440,7 @@ HostIF_CancelWaitForThreads(VMDriver *vm, // IN: + * HostIF_WakeUpYielders -- + * + * Wakeup vCPUs that are waiting for the current vCPU. +- * ++ * + * Results: + * The requested vCPUs are nudged if they are sleeping due to + * Vmx86_YieldToSet. +@@ -518,7 +523,7 @@ HostIF_InitGlobalLock(void) + * None + * + * Side effects: +- * Should be a very low contention lock. ++ * Should be a very low contention lock. + * The current thread is rescheduled if the lock is busy. + * + *----------------------------------------------------------------------------- +@@ -561,7 +566,7 @@ HostIF_GlobalUnlock(int callerID) // IN + * HostIF_GlobalLockIsHeld -- + * + * Determine if the global lock is held by the current thread. +- * ++ * + * Results: + * TRUE if yes + * FALSE if no +@@ -591,7 +596,7 @@ HostIF_GlobalLockIsHeld(void) + * None + * + * Side effects: +- * Should be a very low contention lock. ++ * Should be a very low contention lock. + * The current thread is rescheduled if the lock is busy. + * + *----------------------------------------------------------------------------- +@@ -726,7 +731,7 @@ static int + HostIFHostMemInit(VMDriver *vm) // IN: + { + VMHost *vmh = vm->vmhost; +- ++ + vmh->lockedPages = PhysTrack_Alloc(vm); + if (!vmh->lockedPages) { + return -1; +@@ -821,8 +826,8 @@ HostIF_AllocMachinePage(void) + * + * HostIF_FreeMachinePage -- + * +- * Free an anonymous machine page allocated by +- * HostIF_AllocMachinePage(). This page is not tracked in any ++ * Free an anonymous machine page allocated by ++ * HostIF_AllocMachinePage(). This page is not tracked in any + * phystracker. + * + * Results: +@@ -1115,7 +1120,7 @@ HostIF_LookupUserMPN(VMDriver *vm, // IN: VMDriver + * Results: + * prevents INTR #0x2d (IRQ 13) from being generated -- + * assume that Int16 works for interrupt reporting +- * ++ * + * + * Side effects: + * PIC +@@ -1130,7 +1135,7 @@ HostIF_InitFP(VMDriver *vm) // IN: + + uint8 val = inb(0xA1); + +- if (!(val & mask)) { ++ if (!(val & mask)) { + val = val | mask; + outb(val, 0xA1); + } +@@ -1146,7 +1151,7 @@ HostIF_InitFP(VMDriver *vm) // IN: + * If ppages is NULL, pages are only marked as dirty. + * + * Results: +- * Zero on success, non-zero on failure. ++ * Zero on success, non-zero on failure. + * + * Side effects: + * None +@@ -1162,12 +1167,16 @@ HostIFGetUserPages(void *uvAddr, // IN + int retval; + + down_read(¤t->mm->mmap_sem); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) +- retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) ++ retval = get_user_pages((unsigned long)uvAddr, + #else + retval = get_user_pages(current, current->mm, (unsigned long)uvAddr, +- numPages, 0, 0, ppages, NULL); + #endif ++ numPages, 0, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) ++ 0, ++#endif ++ ppages, NULL); + up_read(¤t->mm->mmap_sem); + + return retval != numPages; +@@ -1179,11 +1188,11 @@ HostIFGetUserPages(void *uvAddr, // IN + * + * HostIF_IsLockedByMPN -- + * +- * Checks if mpn was locked using allowMultipleMPNsPerVA. ++ * Checks if mpn was locked using allowMultipleMPNsPerVA. + * + * Results: + * TRUE if mpn is present in the physTracker. +- * ++ * + * + * Side effects: + * None. +@@ -1305,7 +1314,7 @@ HostIF_UnlockPage(VMDriver *vm, // IN: + + vpn = VA_2_VPN((VA)addr); + e = MemTrack_LookupVPN(vm->memtracker, vpn); +- ++ + if (e == NULL) { + return PAGE_UNLOCK_NOT_TRACKED; + } +@@ -1351,7 +1360,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver + { + void *va = VA64ToPtr(uAddr); + MemTrackEntry *e; +- ++ + /* + * Verify for debugging that VA and MPN make sense. + * PgtblVa2MPN() can fail under high memory pressure. +@@ -1369,7 +1378,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver + } + + /* +- * Verify that this MPN was locked with ++ * Verify that this MPN was locked with + * HostIF_LockPage(allowMultipleMPNsPerVA = TRUE). + * That means that this MPN should not be in the MemTracker. + */ +@@ -1382,7 +1391,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver + return PAGE_UNLOCK_MISMATCHED_TYPE; + } + } +-#endif ++#endif + + HOST_UNLOCK_PFN_BYMPN(vm, mpn); + +@@ -1390,7 +1399,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver + } + + +-static void ++static void + UnlockEntry(void *clientData, // IN: + MemTrackEntry *entryPtr) // IN: + { +@@ -1453,11 +1462,11 @@ HostIF_FreeAllResources(VMDriver *vm) // IN + * + * HostIF_AllocKernelMem + * +- * Allocate some kernel memory for the driver. ++ * Allocate some kernel memory for the driver. + * + * Results: +- * The address allocated or NULL on error. +- * ++ * The address allocated or NULL on error. ++ * + * + * Side effects: + * memory is malloced +@@ -1469,8 +1478,8 @@ HostIF_AllocKernelMem(size_t size, // IN: + int wired) // IN: + { + void * ptr = kmalloc(size, GFP_KERNEL); +- +- if (ptr == NULL) { ++ ++ if (ptr == NULL) { + Warning("%s failed (size=%p)\n", __func__, (void*)size); + } + +@@ -1498,7 +1507,7 @@ void * + HostIF_AllocPage(void) + { + VA kvAddr; +- ++ + kvAddr = __get_free_page(GFP_KERNEL); + if (kvAddr == 0) { + Warning("%s: __get_free_page() failed\n", __func__); +@@ -1513,7 +1522,7 @@ HostIF_AllocPage(void) + * + * HostIF_FreeKernelMem + * +- * Free kernel memory allocated for the driver. ++ * Free kernel memory allocated for the driver. + * + * Results: + * None. +@@ -1552,7 +1561,7 @@ HostIF_FreePage(void *ptr) // IN: + * from the kernel without causing the host to die or to be really upset. + * + * Results: +- * The maximum number of pages that can be locked. ++ * The maximum number of pages that can be locked. + * + * Side effects: + * none +@@ -1580,9 +1589,9 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN + * Use the memory information linux exports as of late for a more + * precise estimate of locked memory. All kernel page-related structures + * (slab, pagetable) are as good as locked. Unevictable includes things +- * that are explicitly marked as such (like mlock()). Huge pages are +- * also as good as locked, since we don't use them. Lastly, without +- * available swap, anonymous pages become locked in memory as well. ++ * that are explicitly marked as such (like mlock()). Huge pages are ++ * also as good as locked, since we don't use them. Lastly, without ++ * available swap, anonymous pages become locked in memory as well. + */ + + unsigned int forHost; +@@ -1602,7 +1611,7 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN + unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); + + if (anonPages > swapPages) { +- lockedPages += anonPages - swapPages; ++ lockedPages += anonPages - swapPages; + } + forHost = lockedPages + LOCKED_PAGE_SLACK; + if (forHost > totalPhysicalPages) { +@@ -1647,7 +1656,7 @@ HostIF_Wait(unsigned int timeoutMs) + *---------------------------------------------------------------------- + */ + +-void ++void + HostIF_WaitForFreePages(unsigned int timeoutMs) // IN: + { + static unsigned count; +@@ -1672,20 +1681,20 @@ HostIF_WaitForFreePages(unsigned int timeoutMs) // IN: + * timeofday to have small drift (due to NTP rate correction, etc). + * We handle this by rebasing the jiffies based monotonic clock + * every second (see HostIFUptimeResyncMono). +- * ++ * + * Results: + * The uptime, in units of UPTIME_FREQ. Also returns the jiffies + * value that was used in the monotonic time calculation. + * + * Side effects: +- * May reset the uptime base in the case gettimeofday warp was ++ * May reset the uptime base in the case gettimeofday warp was + * detected. + * + *---------------------------------------------------------------------- + */ + + static uint64 +-HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies ++HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies + { + struct timeval tv; + uint64 monotime, uptime, upBase, monoBase; +@@ -1707,14 +1716,14 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies + + do_gettimeofday(&tv); + upBase = Atomic_Read64(&uptimeState.uptimeBase); +- ++ + monotime = (uint64)(jifs - jifBase) * (UPTIME_FREQ / HZ); + monotime += monoBase; + + uptime = tv.tv_usec * (UPTIME_FREQ / 1000000) + tv.tv_sec * UPTIME_FREQ; + uptime += upBase; +- +- /* ++ ++ /* + * Use the jiffies based monotonic time to sanity check gettimeofday. + * If they differ by more than one second, assume the time of day has + * been warped, and use the jiffies time to undo (most of) the warp. +@@ -1726,7 +1735,7 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies + uint64 newUpBase = monotime - (uptime - upBase); + + attempts++; +- if (!Atomic_CMPXCHG64(&uptimeState.uptimeBase, &upBase, &newUpBase) && ++ if (!Atomic_CMPXCHG64(&uptimeState.uptimeBase, &upBase, &newUpBase) && + attempts < 5) { + /* Another thread updated uptimeBase. Recalculate uptime. */ + goto retry; +@@ -1767,7 +1776,7 @@ HostIFUptimeResyncMono(unsigned long data) // IN: ignored + unsigned long jifs; + uintptr_t flags; + +- /* ++ /* + * Read the uptime and the corresponding jiffies value. This will + * also correct the uptime (which is based on time of day) if needed + * before we rebase monotonic time (which is based on jiffies). +@@ -1775,7 +1784,7 @@ HostIFUptimeResyncMono(unsigned long data) // IN: ignored + + uint64 uptime = HostIFReadUptimeWork(&jifs); + +- /* ++ /* + * Every second, recalculate monoBase and jiffiesBase to squash small + * drift between gettimeofday and jiffies. Also, this prevents + * (jiffies - jiffiesBase) wrap on 32-bits. +@@ -1820,8 +1829,8 @@ HostIF_InitUptime(void) + + uptimeState.jiffiesBase = jiffies; + do_gettimeofday(&tv); +- Atomic_Write64(&uptimeState.uptimeBase, +- -(tv.tv_usec * (UPTIME_FREQ / 1000000) + ++ Atomic_Write64(&uptimeState.uptimeBase, ++ -(tv.tv_usec * (UPTIME_FREQ / 1000000) + + tv.tv_sec * UPTIME_FREQ)); + + init_timer(&uptimeState.timer); +@@ -1949,7 +1958,7 @@ HostIF_CopyFromUser(void *dst, // OUT + *----------------------------------------------------------------------------- + */ + +-int ++int + HostIF_CopyToUser(void *dst, // OUT + const void *src, // IN + unsigned int len) // IN +@@ -1962,15 +1971,15 @@ HostIF_CopyToUser(void *dst, // OUT + *----------------------------------------------------------------------------- + * + * HostIF_MapCrossPage -- +- * +- * Obtain kernel pointer to crosspage. + * +- * We must return a VA that is obtained through a kernel mapping, so that ++ * Obtain kernel pointer to crosspage. ++ * ++ * We must return a VA that is obtained through a kernel mapping, so that + * the mapping never goes away (see bug 29753). + * +- * However, the LA corresponding to that VA must not overlap with the +- * monitor (see bug 32922). The userland code ensures that by only +- * allocating cross pages from low memory. For those pages, the kernel ++ * However, the LA corresponding to that VA must not overlap with the ++ * monitor (see bug 32922). The userland code ensures that by only ++ * allocating cross pages from low memory. For those pages, the kernel + * uses a permanent mapping, instead of a temporary one with a high LA. + * + * Results: +@@ -2158,7 +2167,7 @@ HostIF_VMLock(VMDriver *vm, // IN + * None + * + * Side effects: +- * Can wake up the thread blocked on this lock. ++ * Can wake up the thread blocked on this lock. + * + *----------------------------------------------------------------------------- + */ +@@ -2181,7 +2190,7 @@ HostIF_VMUnlock(VMDriver *vm, // IN + * HostIF_VMLockIsHeld -- + * + * Determine if the per-VM lock is held by the current thread. +- * ++ * + * Results: + * TRUE if yes + * FALSE if no +@@ -2237,14 +2246,14 @@ HostIF_VMLockIsHeld(VMDriver *vm) // IN + * + *---------------------------------------------------------------------- + */ +- ++ + static Bool + isVAReadable(VA r) // IN: + { + mm_segment_t old_fs; + uint32 dummy; + int ret; +- ++ + old_fs = get_fs(); + set_fs(get_ds()); + r = APICR_TO_ADDR(r, APICR_VERSION); +@@ -2319,7 +2328,7 @@ ProbeAPIC(VMDriver *vm, // IN/OUT: driver state + Bool setVMPtr) // IN: set a pointer to the APIC's virtual address + { + MA ma = APIC_GetMA(); +- ++ + if (ma == (MA)-1) { + return FALSE; + } +@@ -2420,7 +2429,7 @@ HostIF_APICInit(VMDriver *vm, // IN: + * Perform the semaphore wait (P) operation, possibly blocking. + * + * Result: +- * 1 (which equals MX_WAITNORMAL) if success, ++ * 1 (which equals MX_WAITNORMAL) if success, + * negated error code otherwise. + * + * Side-effects: +@@ -2429,7 +2438,7 @@ HostIF_APICInit(VMDriver *vm, // IN: + *----------------------------------------------------------------------------- + */ + +-int ++int + HostIF_SemaphoreWait(VMDriver *vm, // IN: + Vcpuid vcpuid, // IN: + uint64 *args) // IN: +@@ -2452,7 +2461,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN: + { + struct poll_wqueues table; + unsigned int mask; +- ++ + poll_initwait(&table); + current->state = TASK_INTERRUPTIBLE; + mask = file->f_op->poll(file, &table.pt); +@@ -2527,7 +2536,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN: + *----------------------------------------------------------------------------- + */ + +-void ++void + HostIF_SemaphoreForceWakeup(VMDriver *vm, // IN: + const VCPUSet *vcs) // IN: + { +@@ -2817,8 +2826,8 @@ HostIF_CallOnEachCPU(void (*func)(void*), // IN: function to call + * + * HostIF_ReadPage -- + * +- * puts the content of a machine page into a kernel or user mode +- * buffer. ++ * puts the content of a machine page into a kernel or user mode ++ * buffer. + * + * Results: + * 0 on success +@@ -2849,7 +2858,7 @@ HostIF_ReadPage(MPN mpn, // MPN of the page + if (ptr == NULL) { + return -ENOMEM; + } +- ++ + if (kernelBuffer) { + memcpy(buf, ptr, PAGE_SIZE); + } else { +@@ -2866,7 +2875,7 @@ HostIF_ReadPage(MPN mpn, // MPN of the page + * + * HostIF_WritePage -- + * +- * Put the content of a kernel or user mode buffer into a machine ++ * Put the content of a kernel or user mode buffer into a machine + * page. + * + * Results: +@@ -2996,7 +3005,7 @@ HostIF_GetNextAnonPage(VMDriver *vm, MPN inMPN) + * Side effects: + * None. + * +- *---------------------------------------------------------------------- ++ *---------------------------------------------------------------------- + */ + + uint32 +@@ -3014,18 +3023,18 @@ HostIF_GetCurrentPCPU(void) + * + * Wake up the fast clock thread. Can't do this from the timer + * callback, because it holds locks that the scheduling code +- * might take. ++ * might take. + * + * Results: + * None. +- * ++ * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +-static void ++static void + HostIFWakeupClockThread(unsigned long data) //IN: + { + wake_up_process(linuxState.fastClockThread); +@@ -3036,7 +3045,7 @@ HostIFWakeupClockThread(unsigned long data) //IN: + *---------------------------------------------------------------------- + * + * HostIFTimerCallback -- +- * ++ * + * Schedule a tasklet to wake up the fast clock thread. + * + * Results: +@@ -3047,8 +3056,8 @@ HostIFWakeupClockThread(unsigned long data) //IN: + * + *---------------------------------------------------------------------- + */ +- +-static enum hrtimer_restart ++ ++static enum hrtimer_restart + HostIFTimerCallback(struct hrtimer *timer) //IN: + { + tasklet_schedule(&timerTasklet); +@@ -3061,7 +3070,7 @@ HostIFTimerCallback(struct hrtimer *timer) //IN: + *---------------------------------------------------------------------- + * + * HostIFScheduleHRTimeout -- +- * ++ * + * Schedule an hrtimer to wake up the fast clock thread. + * + * Results: +@@ -3073,7 +3082,7 @@ HostIFTimerCallback(struct hrtimer *timer) //IN: + *---------------------------------------------------------------------- + */ + +-static void ++static void + HostIFScheduleHRTimeout(ktime_t *expires) //IN: + { + struct hrtimer t; +@@ -3091,7 +3100,7 @@ HostIFScheduleHRTimeout(ktime_t *expires) //IN: + if (hrtimer_active(&t)) { + schedule(); + } +- ++ + hrtimer_cancel(&t); + __set_current_state(TASK_RUNNING); + } +@@ -3114,7 +3123,7 @@ HostIFScheduleHRTimeout(ktime_t *expires) //IN: + * Side effects: + * none. + * +- *---------------------------------------------------------------------- ++ *---------------------------------------------------------------------- + */ + + static long +@@ -3147,7 +3156,7 @@ HostIFDoIoctl(struct file *filp, + */ + + int +-HostIFStartTimer(Bool rateChanged, //IN: Did rate change? ++HostIFStartTimer(Bool rateChanged, //IN: Did rate change? + unsigned int rate, //IN: current clock rate + struct file *filp) //IN: /dev/rtc descriptor + { +@@ -3157,14 +3166,14 @@ HostIFStartTimer(Bool rateChanged, //IN: Did rate change? + int timerPeriod; + + if (rateChanged) { +- timerPeriod = NSEC_PER_SEC / rate; ++ timerPeriod = NSEC_PER_SEC / rate; + expires = ktime_set(0, timerPeriod); + /* + * Allow the kernel to expire the timer at its convenience. + * ppoll() uses 0.1% of the timeout value. I think we can + * tolerate 1%. + */ +- ++ + slack = timerPeriod / 100; + } + set_current_state(TASK_INTERRUPTIBLE); +@@ -3510,7 +3519,7 @@ HostIF_MapUserMem(VA addr, // IN: User memory virtual address + + printk(KERN_DEBUG "%s: p = 0x%p, offset = 0x%p, numPagesNeeded = %"FMTSZ"u," + " handleSize = %"FMTSZ"u, mappedAddr = 0x%p\n", +- __func__, p, (void *)offset, numPagesNeeded, handleSize, mappedAddr); ++ __func__, p, (void *)offset, numPagesNeeded, handleSize, mappedAddr); + + newHandle->numPages = numPagesNeeded; + newHandle->addr = mappedAddr; +@@ -3546,7 +3555,7 @@ HostIF_UnmapUserMem(VMMappedUserMem *handle) // IN: Handle to mapped memory + } + + printk(KERN_DEBUG "%s: numPages = %"FMTSZ"u, addr = 0x%p\n", +- __func__, handle->numPages, handle->addr); ++ __func__, handle->numPages, handle->addr); + + if (handle->numPages > 1) { + vunmap(handle->addr); +diff --git a/vmmon/linux/vmmonInt.h b/vmmon/linux/vmmonInt.h +index 4dc04e9..993212d 100644 +--- a/vmmon/linux/vmmonInt.h ++++ b/vmmon/linux/vmmonInt.h +@@ -28,7 +28,7 @@ + * Hide all kernel compatibility stuff in these macros and functions. + */ + +-#ifdef VMW_HAVE_SMP_CALL_3ARG ++#if defined (VMW_HAVE_SMP_CALL_3ARG) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + #define compat_smp_call_function(fn, info, wait) smp_call_function(fn, info, wait) + #else + #define compat_smp_call_function(fn, info, wait) smp_call_function(fn, info, 1, wait) diff --git a/vmnet.patch b/vmnet.patch new file mode 100644 index 000000000000..9413d349ad81 --- /dev/null +++ b/vmnet.patch @@ -0,0 +1,574 @@ +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/Makefile.kernel b/vmnet/Makefile.kernel +index 2d8e6f6..a14166b 100644 +--- a/vmnet/Makefile.kernel ++++ b/vmnet/Makefile.kernel +@@ -19,7 +19,7 @@ + + INCLUDE := -I$(SRCROOT) + +-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) ++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE) + EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_net.c,-DVMW_NETDEV_HAS_NET, ) + EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/netdev_has_dev_net.c,-DVMW_NETDEV_HAS_DEV_NET, ) + EXTRA_CFLAGS += $(call vm_check_build, $(SRCROOT)/nfhook_uses_skb.c,-DVMW_NFHOOK_USES_SKB, ) +diff --git a/vmnet/driver.c b/vmnet/driver.c +index 7e7ad99..5f508f6 100644 +--- a/vmnet/driver.c ++++ b/vmnet/driver.c +@@ -137,7 +137,16 @@ static ssize_t VNetFileOpWrite(struct file *filp, const char *buf, size_t count + static long VNetFileOpUnlockedIoctl(struct file * filp, + unsigned int iocmd, unsigned long ioarg); + +-static struct file_operations vnetFileOps; ++static struct file_operations vnetFileOps = { ++ .owner = THIS_MODULE, ++ .read = VNetFileOpRead, ++ .write = VNetFileOpWrite, ++ .poll = VNetFileOpPoll, ++ .unlocked_ioctl = VNetFileOpUnlockedIoctl, ++ .compat_ioctl = VNetFileOpUnlockedIoctl, ++ .open = VNetFileOpOpen, ++ .release = VNetFileOpClose ++}; + + /* + * Utility functions +@@ -317,22 +326,6 @@ init_module(void) + goto err_proto; + } + +- /* +- * Initialize the file_operations structure. Because this code is always +- * compiled as a module, this is fine to do it here and not in a static +- * initializer. +- */ +- +- memset(&vnetFileOps, 0, sizeof vnetFileOps); +- vnetFileOps.owner = THIS_MODULE; +- vnetFileOps.read = VNetFileOpRead; +- vnetFileOps.write = VNetFileOpWrite; +- vnetFileOps.poll = VNetFileOpPoll; +- vnetFileOps.unlocked_ioctl = VNetFileOpUnlockedIoctl; +- vnetFileOps.compat_ioctl = VNetFileOpUnlockedIoctl; +- vnetFileOps.open = VNetFileOpOpen; +- vnetFileOps.release = VNetFileOpClose; +- + retval = register_chrdev(VNET_MAJOR_NUMBER, "vmnet", &vnetFileOps); + if (retval) { + LOG(0, (KERN_NOTICE "/dev/vmnet: could not register major device %d\n", +@@ -1145,12 +1138,12 @@ VNetMulticastFilter(const uint8 *destAddr, // IN: multicast MAC + } + /* + * Do not need to further compute and check ladrf if no match +- * in exact multicast filter, since only one of them is ++ * in exact multicast filter, since only one of them is + * used at a time. + */ + return FALSE; + } +- ++ + + crc = 0xffffffff; /* init CRC for each address */ + for (byte = 0; byte < ETH_ALEN; byte++) { /* for each address byte */ +diff --git a/vmnet/userif.c b/vmnet/userif.c +index 2b976d7..5298406 100644 +--- a/vmnet/userif.c ++++ b/vmnet/userif.c +@@ -113,12 +113,18 @@ UserifLockPage(VA addr) // IN + int retval; + + down_read(¤t->mm->mmap_sem); +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) +- retval = get_user_pages(addr, 1, 1, 0, &page, NULL); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99) ++ retval = get_user_pages(addr, + #else + retval = get_user_pages(current, current->mm, addr, +- 1, 1, 0, &page, NULL); + #endif ++ 1, ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0) ++ 1, 0, ++#else ++ FOLL_WRITE, ++#endif ++ &page, NULL); + up_read(¤t->mm->mmap_sem); + + if (retval != 1) { +@@ -182,13 +188,13 @@ VNetUserIfMapUint32Ptr(VA uAddr, // IN: pointer to user memory + * + * Sets up notification by filling in pollPtr, actPtr, and recvClusterCount + * fields. +- * +- * Results: ++ * ++ * Results: + * 0 on success + * < 0 on failure: the actual value determines the type of failure + * + * Side effects: +- * Fields pollPtr, actPtr, recvClusterCount, pollPage, actPage, and ++ * Fields pollPtr, actPtr, recvClusterCount, pollPage, actPage, and + * recvClusterPage are filled in VNetUserIf structure. + * + *----------------------------------------------------------------------------- +@@ -278,8 +284,8 @@ VNetUserIfSetupNotify(VNetUserIF *userIf, // IN + * VNetUserIfUnsetupNotify -- + * + * Destroys permanent mapping for notify structure provided by user. +- * +- * Results: ++ * ++ * Results: + * None. + * + * Side effects: +@@ -333,7 +339,7 @@ VNetUserIfUnsetupNotify(VNetUserIF *userIf) // IN + * + * Free the user interface port. + * +- * Results: ++ * Results: + * None. + * + * Side effects: +@@ -355,7 +361,7 @@ VNetUserIfFree(VNetJack *this) // IN + } + dev_kfree_skb(skb); + } +- ++ + if (userIf->pollPtr) { + VNetUserIfUnsetupNotify(userIf); + } +@@ -379,7 +385,7 @@ VNetUserIfFree(VNetJack *this) // IN + * + * This jack is receiving a packet. Take appropriate action. + * +- * Results: ++ * Results: + * None. + * + * Side effects: +@@ -395,12 +401,12 @@ VNetUserIfReceive(VNetJack *this, // IN + VNetUserIF *userIf = (VNetUserIF*)this->private; + uint8 *dest = SKB_2_DESTMAC(skb); + unsigned long flags; +- ++ + if (!UP_AND_RUNNING(userIf->port.flags)) { + userIf->stats.droppedDown++; + goto drop_packet; + } +- ++ + if (!VNetPacketMatch(dest, + userIf->port.paddr, + (const uint8 *)userIf->port.exactFilter, +@@ -410,12 +416,12 @@ VNetUserIfReceive(VNetJack *this, // IN + userIf->stats.droppedMismatch++; + goto drop_packet; + } +- ++ + if (skb_queue_len(&userIf->packetQueue) >= vnet_max_qlen) { + userIf->stats.droppedOverflow++; + goto drop_packet; + } +- ++ + if (skb->len > ETHER_MAX_QUEUED_PACKET) { + userIf->stats.droppedLargePacket++; + goto drop_packet; +@@ -439,7 +445,7 @@ VNetUserIfReceive(VNetJack *this, // IN + + wake_up(&userIf->waitQueue); + return; +- ++ + drop_packet: + dev_kfree_skb(skb); + } +@@ -452,7 +458,7 @@ VNetUserIfReceive(VNetJack *this, // IN + * + * Callback for read operation on this userif entry in vnets proc fs. + * +- * Results: ++ * Results: + * Length of read operation. + * + * Side effects: +@@ -471,21 +477,21 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into + // read + void *data) // IN: client data - not used + { +- VNetUserIF *userIf = (VNetUserIF*)data; ++ VNetUserIF *userIf = (VNetUserIF*)data; + int len = 0; +- ++ + if (!userIf) { + return len; + } +- ++ + len += VNetPrintPort(&userIf->port, page+len); +- ++ + len += sprintf(page+len, "read %u written %u queued %u ", + userIf->stats.read, + userIf->stats.written, + userIf->stats.queued); +- +- len += sprintf(page+len, ++ ++ len += sprintf(page+len, + "dropped.down %u dropped.mismatch %u " + "dropped.overflow %u dropped.largePacket %u", + userIf->stats.droppedDown, +@@ -494,7 +500,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into + userIf->stats.droppedLargePacket); + + len += sprintf(page+len, "\n"); +- ++ + *start = 0; + *eof = 1; + return len; +@@ -508,7 +514,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into + * + * Copy part of datagram to userspace. + * +- * Results: ++ * Results: + * zero on success, + * -EFAULT if buffer is an invalid area + * +@@ -545,12 +551,12 @@ VNetCopyDatagram(const struct sk_buff *skb, // IN: skb to copy + * + * Copy part of datagram to userspace doing checksum at same time. + * +- * Do not mark this function INLINE, it is recursive! With all gcc's ++ * Do not mark this function INLINE, it is recursive! With all gcc's + * released up to now (<= gcc-3.3.1) inlining this function just + * consumes 120 more bytes of code and goes completely mad on + * register allocation, storing almost everything in the memory. + * +- * Results: ++ * Results: + * folded checksum (non-negative value) on success, + * -EINVAL if offset is too big, + * -EFAULT if buffer is an invalid area +@@ -572,7 +578,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy + char *curr = buf; + const skb_frag_t *frag; + +- /* ++ /* + * Something bad happened. We skip only up to skb->nh.raw, and skb->nh.raw + * must be in the header, otherwise we are in the big troubles. + */ +@@ -629,7 +635,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy + * Copy complete datagram to the user space. Fill correct checksum + * into the copied datagram if nobody did it yet. + * +- * Results: ++ * Results: + * On success byte count, on failure -EFAULT. + * + * Side effects: +@@ -658,7 +664,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN + size_t skl; + int csum; + u_int16_t csum16; +- ++ + skl = compat_skb_csum_start(skb); + if (VNetCopyDatagram(skb, buf, skl)) { + return -EFAULT; +@@ -689,7 +695,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN + * The virtual network's read file operation. Reads the next pending + * packet for this network connection. + * +- * Results: ++ * Results: + * On success the len of the packet received, + * else if no packet waiting and nonblocking 0, + * else -errno. +@@ -700,7 +706,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN + *---------------------------------------------------------------------- + */ + +-static int ++static int + VNetUserIfRead(VNetPort *port, // IN + struct file *filp, // IN + char *buf, // OUT +@@ -768,7 +774,7 @@ VNetUserIfRead(VNetPort *port, // IN + * The virtual network's write file operation. Send the raw packet + * to the network. + * +- * Results: ++ * Results: + * On success the count of bytes written else errno. + * + * Side effects: +@@ -777,7 +783,7 @@ VNetUserIfRead(VNetPort *port, // IN + *---------------------------------------------------------------------- + */ + +-static int ++static int + VNetUserIfWrite(VNetPort *port, // IN + struct file *filp, // IN + const char *buf, // IN +@@ -789,8 +795,8 @@ VNetUserIfWrite(VNetPort *port, // IN + /* + * Check size + */ +- +- if (count < sizeof (struct ethhdr) || ++ ++ if (count < sizeof (struct ethhdr) || + count > ETHER_MAX_QUEUED_PACKET) { + return -EINVAL; + } +@@ -807,25 +813,25 @@ VNetUserIfWrite(VNetPort *port, // IN + /* + * Allocate an sk_buff. + */ +- ++ + skb = dev_alloc_skb(count + 7); + if (skb == NULL) { + // XXX obey O_NONBLOCK? + return -ENOBUFS; + } +- ++ + skb_reserve(skb, 2); +- ++ + /* + * Copy the data and send it. + */ +- ++ + userIf->stats.written++; + if (copy_from_user(skb_put(skb, count), buf, count)) { + dev_kfree_skb(skb); + return -EFAULT; + } +- ++ + VNetSend(&userIf->port.jack, skb); + + return count; +@@ -839,7 +845,7 @@ VNetUserIfWrite(VNetPort *port, // IN + * + * XXX + * +- * Results: ++ * Results: + * 0 on success + * -errno on failure + * +@@ -862,8 +868,8 @@ VNetUserIfIoctl(VNetPort *port, // IN + return -EINVAL; + case SIOCSETNOTIFY2: + #ifdef VMX86_SERVER +- /* +- * This ioctl always return failure on ESX since we cannot map pages into ++ /* ++ * This ioctl always return failure on ESX since we cannot map pages into + * the console os that are from the VMKernel address space which was the + * only case we used this. + */ +@@ -906,20 +912,20 @@ VNetUserIfIoctl(VNetPort *port, // IN + break; + + case SIOCSIFFLAGS: +- /* +- * Drain queue when interface is no longer active. We drain the queue to ++ /* ++ * Drain queue when interface is no longer active. We drain the queue to + * avoid having old packets delivered to the guest when reneabled. + */ +- ++ + if (!UP_AND_RUNNING(userIf->port.flags)) { + struct sk_buff *skb; + unsigned long flags; + struct sk_buff_head *q = &userIf->packetQueue; +- ++ + while ((skb = skb_dequeue(q)) != NULL) { + dev_kfree_skb(skb); + } +- ++ + spin_lock_irqsave(&q->lock, flags); + if (userIf->pollPtr) { + if (skb_queue_empty(q)) { +@@ -936,11 +942,11 @@ VNetUserIfIoctl(VNetPort *port, // IN + case SIOCINJECTLINKSTATE: + { + uint8 linkUpFromUser; +- if (copy_from_user(&linkUpFromUser, (void *)ioarg, ++ if (copy_from_user(&linkUpFromUser, (void *)ioarg, + sizeof linkUpFromUser)) { + return -EFAULT; + } +- ++ + if (linkUpFromUser != 0 && linkUpFromUser != 1) { + return -EINVAL; + } +@@ -952,7 +958,7 @@ VNetUserIfIoctl(VNetPort *port, // IN + return -ENOIOCTLCMD; + break; + } +- ++ + return 0; + } + +@@ -964,7 +970,7 @@ VNetUserIfIoctl(VNetPort *port, // IN + * + * The virtual network's file poll operation. + * +- * Results: ++ * Results: + * Return POLLIN if success, else sleep and return 0. + * FIXME: Should not we always return POLLOUT? + * +@@ -980,7 +986,7 @@ VNetUserIfPoll(VNetPort *port, // IN + poll_table *wait) // IN + { + VNetUserIF *userIf = (VNetUserIF*)port->jack.private; +- ++ + poll_wait(filp, &userIf->waitQueue, wait); + if (!skb_queue_empty(&userIf->packetQueue)) { + return POLLIN; +@@ -995,8 +1001,8 @@ VNetUserIfPoll(VNetPort *port, // IN + * VNetUserIfSetUplinkState -- + * + * Sends link state change event. +- * +- * Results: ++ * ++ * Results: + * 0 on success, errno on failure. + * + * Side effects: +@@ -1038,7 +1044,7 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp) + event.header.eventId = 0; + event.header.classSet = VNET_EVENT_CLASS_UPLINK; + event.header.type = VNET_EVENT_TYPE_LINK_STATE; +- /* ++ /* + * XXX kind of a hack, vmx will coalesce linkup/down if they come from the + * same adapter. + */ +@@ -1063,8 +1069,8 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp) + * + * Create a user level port to the wonderful world of virtual + * networking. +- * +- * Results: ++ * ++ * Results: + * Errno. Also returns an allocated port to connect to, + * NULL on error. + * +@@ -1080,7 +1086,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT + VNetUserIF *userIf; + static unsigned id = 0; + int retval; +- ++ + userIf = kmalloc(sizeof *userIf, GFP_USER); + if (!userIf) { + return -ENOMEM; +@@ -1089,7 +1095,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT + /* + * Initialize fields. + */ +- ++ + userIf->port.id = id++; + + userIf->port.jack.peer = NULL; +@@ -1134,7 +1140,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT + /* + * Rest of fields. + */ +- ++ + userIf->port.flags = IFF_RUNNING; + + memset(userIf->port.paddr, 0, sizeof userIf->port.paddr); +@@ -1147,12 +1153,12 @@ VNetUserIf_Create(VNetPort **ret) // OUT + userIf->port.fileOpWrite = VNetUserIfWrite; + userIf->port.fileOpIoctl = VNetUserIfIoctl; + userIf->port.fileOpPoll = VNetUserIfPoll; +- ++ + skb_queue_head_init(&(userIf->packetQueue)); + init_waitqueue_head(&userIf->waitQueue); + + memset(&userIf->stats, 0, sizeof userIf->stats); +- ++ + *ret = &userIf->port; + return 0; + } +diff --git a/vmnet/vm_device_version.h b/vmnet/vm_device_version.h +index e2cb477..3dd7097 100644 +--- a/vmnet/vm_device_version.h ++++ b/vmnet/vm_device_version.h +@@ -53,7 +53,9 @@ + * VMware HD Audio codec + * VMware HD Audio controller + */ ++#ifndef PCI_VENDOR_ID_VMWARE + #define PCI_VENDOR_ID_VMWARE 0x15AD ++#endif + #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 + #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 + #define PCI_DEVICE_ID_VMWARE_VGA 0x0711 +diff --git a/vmnet/vmnetInt.h b/vmnet/vmnetInt.h +index 0ee52ec..4e3b923 100644 +--- a/vmnet/vmnetInt.h ++++ b/vmnet/vmnetInt.h +@@ -77,9 +77,9 @@ + + + extern struct proto vmnet_proto; +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99) + # define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \ +- PF_NETLINK, _pri, &vmnet_proto, 1) ++ PF_NETLINK, _pri, &vmnet_proto, 0) + #elif defined(VMW_NETDEV_HAS_NET) + # define compat_sk_alloc(_bri, _pri) sk_alloc(&init_net, \ + PF_NETLINK, _pri, &vmnet_proto) diff --git a/vmware-workstation-server-certificates.service b/vmware-workstation-server-certificates.service new file mode 100644 index 000000000000..02aa2614ab67 --- /dev/null +++ b/vmware-workstation-server-certificates.service @@ -0,0 +1,11 @@ +[Unit] +Description=VMware Workstation Server 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-workstation-server.service b/vmware-workstation-server.service new file mode 100644 index 000000000000..20b33ec45953 --- /dev/null +++ b/vmware-workstation-server.service @@ -0,0 +1,10 @@ +[Unit] +Description=VMware Workstation Server +Wants=vmware-workstation-server-certificates.service +After=vmware-workstation-server-certificates.service + +[Service] +ExecStart=/usr/bin/vmware-hostd -a /etc/vmware/hostd/config.xml + +[Install] +WantedBy=multi-user.target diff --git a/vsock.patch b/vsock.patch new file mode 100644 index 000000000000..9617ff200bdd --- /dev/null +++ b/vsock.patch @@ -0,0 +1,231 @@ +diff --git a/vsock/Makefile b/vsock/Makefile +index 5d92e9b..7d315e8 100644 +--- a/vsock/Makefile ++++ b/vsock/Makefile +@@ -42,8 +42,11 @@ AUTOCONF_DIR := $(SRCROOT)/shared/autoconf + 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/vsock/Makefile.kernel b/vsock/Makefile.kernel +index 5218df2..374cc1f 100644 +--- a/vsock/Makefile.kernel ++++ b/vsock/Makefile.kernel +@@ -25,7 +25,7 @@ INCLUDE += -I$(SRCROOT)/include + INCLUDE += -I$(SRCROOT)/linux + INCLUDE += -I$(SRCROOT)/common + +-EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) ++EXTRA_CFLAGS := $(CC_OPTS) $(INCLUDE) $(LINUXINCLUDE) + EXTRA_CFLAGS += $(call vm_check_build, $(AUTOCONF_DIR)/netcreate_num_params.c, -DVMW_NETCREATE_KERNARG, ) + + +diff --git a/vsock/linux/af_vsock.c b/vsock/linux/af_vsock.c +index bde1497..9f8f843 100644 +--- a/vsock/linux/af_vsock.c ++++ b/vsock/linux/af_vsock.c +@@ -232,13 +232,29 @@ static int VSockVmciStreamSetsockopt(struct socket *sock, int level, int optname + static int VSockVmciStreamGetsockopt(struct socket *sock, int level, int optname, + char __user *optval, int __user * optlen); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + static int VSockVmciDgramSendmsg(struct kiocb *kiocb, ++#else ++static int VSockVmciDgramSendmsg( ++#endif + struct socket *sock, struct msghdr *msg, size_t len); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + static int VSockVmciDgramRecvmsg(struct kiocb *kiocb, struct socket *sock, ++#else ++static int VSockVmciDgramRecvmsg(struct socket *sock, ++#endif + struct msghdr *msg, size_t len, int flags); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + static int VSockVmciStreamSendmsg(struct kiocb *kiocb, ++#else ++static int VSockVmciStreamSendmsg( ++#endif + struct socket *sock, struct msghdr *msg, size_t len); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + static int VSockVmciStreamRecvmsg(struct kiocb *kiocb, struct socket *sock, ++#else ++static int VSockVmciStreamRecvmsg(struct socket *sock, ++#endif + struct msghdr *msg, size_t len, int flags); + + static int VSockVmciCreate( +@@ -2822,11 +2838,18 @@ __VSockVmciCreate(struct net *net, // IN: Network namespace + * From 2.6.9 to until 2.6.12 sk_alloc() used a cache in + * the protocol structure, but you still had to specify the size and cache + * yourself. +- * Most recently (in 2.6.24), sk_alloc() was changed to expect the ++ * In 2.6.24, sk_alloc() was changed to expect the + * network namespace, and the option to zero the sock was dropped. + * ++ * In 4.2, another parameter was added to sk_alloc() allowing you to specify ++ * whether or not the socket is to be a kernel socket. Previously, we passed ++ * 1 to this new parameter, but following Gentoo's lead ++ * ( https://github.com/gentoo/vmware/blob/master/app-emulation/vmware-modules/files/308-4.02-01-sk_alloc.patch#L19 ) ++ * we have switched to passing 0. + */ +-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99) ++ sk = sk_alloc(net, vsockVmciFamilyOps.family, priority, &vsockVmciProto, 0); ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12) + sk = sk_alloc(vsockVmciFamilyOps.family, priority, + vsockVmciProto.slab_obj_size, vsockVmciProto.slab); + #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) +@@ -4210,7 +4233,11 @@ VSockVmciShutdown(struct socket *sock, // IN + */ + + static int ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + VSockVmciDgramSendmsg(struct kiocb *kiocb, // UNUSED ++#else ++VSockVmciDgramSendmsg( ++#endif + struct socket *sock, // IN: socket to send on + struct msghdr *msg, // IN: message to send + size_t len) // IN: length of message +@@ -4302,7 +4329,11 @@ VSockVmciDgramSendmsg(struct kiocb *kiocb, // UNUSED + goto out; + } + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + memcpy_fromiovec(VMCI_DG_PAYLOAD(dg), msg->msg_iov, len); ++#else ++ memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len); ++#endif + + dg->dst = VMCI_MAKE_HANDLE(remoteAddr->svm_cid, remoteAddr->svm_port); + dg->src = VMCI_MAKE_HANDLE(vsk->localAddr.svm_cid, vsk->localAddr.svm_port); +@@ -4540,7 +4571,11 @@ VSockVmciStreamGetsockopt(struct socket *sock, // IN + */ + + static int ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + VSockVmciStreamSendmsg(struct kiocb *kiocb, // UNUSED ++#else ++VSockVmciStreamSendmsg( ++#endif + struct socket *sock, // IN: socket to send on + struct msghdr *msg, // IN: message to send + size_t len) // IN: length of message +@@ -4662,7 +4697,11 @@ VSockVmciStreamSendmsg(struct kiocb *kiocb, // UNUSED + * able to send. + */ + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + written = vmci_qpair_enquev(vsk->qpair, msg->msg_iov, ++#else ++ written = vmci_qpair_enquev(vsk->qpair, &msg->msg_iter.iov, ++#endif + len - totalWritten, 0); + if (written < 0) { + err = -ENOMEM; +@@ -4709,7 +4748,11 @@ out: + */ + + static int ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + VSockVmciDgramRecvmsg(struct kiocb *kiocb, // UNUSED ++#else ++VSockVmciDgramRecvmsg( ++#endif + struct socket *sock, // IN: socket to receive from + struct msghdr *msg, // IN/OUT: message to receive into + size_t len, // IN: length of receive buffer +@@ -4759,7 +4802,11 @@ VSockVmciDgramRecvmsg(struct kiocb *kiocb, // UNUSED + } + + /* Place the datagram payload in the user's iovec. */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + err = skb_copy_datagram_iovec(skb, sizeof *dg, msg->msg_iov, payloadLen); ++#else ++ err = skb_copy_datagram_iter(skb, sizeof *dg, &msg->msg_iter, payloadLen); ++#endif + if (err) { + goto out; + } +@@ -4800,7 +4847,11 @@ out: + */ + + static int ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 99) + VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED ++#else ++VSockVmciStreamRecvmsg( ++#endif + struct socket *sock, // IN: socket to receive from + struct msghdr *msg, // IN/OUT: message to receive into + size_t len, // IN: length of receive buffer +@@ -4905,9 +4956,17 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb, // UNUSED + } + + if (flags & MSG_PEEK) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + read = vmci_qpair_peekv(vsk->qpair, msg->msg_iov, len - copied, 0); ++#else ++ read = vmci_qpair_peekv(vsk->qpair, &msg->msg_iter.iov, len - copied, 0); ++#endif + } else { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0) + read = vmci_qpair_dequev(vsk->qpair, msg->msg_iov, len - copied, 0); ++#else ++ read = vmci_qpair_dequev(vsk->qpair, &msg->msg_iter.iov, len - copied, 0); ++#endif + } + + if (read < 0) { +diff --git a/vsock/linux/notify.c b/vsock/linux/notify.c +index 5b1e134..82d8738 100644 +--- a/vsock/linux/notify.c ++++ b/vsock/linux/notify.c +@@ -516,7 +516,11 @@ VSockVmciHandleWrote(struct sock *sk, // IN + PKT_FIELD(vsk, sentWaitingRead) = FALSE; + #endif + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) + sk->sk_data_ready(sk, 0); ++#else ++ sk->sk_data_ready(sk); ++#endif + } + + +diff --git a/vsock/linux/notifyQState.c b/vsock/linux/notifyQState.c +index 464454b..7933be7 100644 +--- a/vsock/linux/notifyQState.c ++++ b/vsock/linux/notifyQState.c +@@ -164,7 +164,11 @@ VSockVmciHandleWrote(struct sock *sk, // IN + struct sockaddr_vm *dst, // IN: unused + struct sockaddr_vm *src) // IN: unused + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) + sk->sk_data_ready(sk, 0); ++#else ++ sk->sk_data_ready(sk); ++#endif + } + + +@@ -566,7 +570,11 @@ VSockVmciNotifyPktRecvPostDequeue(struct sock *sk, // IN + } + + /* See the comment in VSockVmciNotifyPktSendPostEnqueue */ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0) + sk->sk_data_ready(sk, 0); ++#else ++ sk->sk_data_ready(sk); ++#endif + } + + return err; |