diff options
-rw-r--r-- | .SRCINFO | 29 | ||||
-rw-r--r-- | PKGBUILD | 163 | ||||
-rw-r--r-- | dkms.conf | 2 | ||||
-rw-r--r-- | unlocker.py | 428 | ||||
-rw-r--r-- | vmblock.patch | 18 | ||||
-rw-r--r-- | vmci.patch | 5 | ||||
-rw-r--r-- | vmmon.patch | 145 | ||||
-rw-r--r-- | vmnet.patch | 90 | ||||
-rw-r--r-- | vmware-workstation.install | 8 | ||||
-rw-r--r-- | vsock.patch | 35 |
10 files changed, 796 insertions, 127 deletions
@@ -1,18 +1,25 @@ 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 = 14 + pkgver = 12.5.5_5234757 + pkgrel = 1 url = https://www.vmware.com/products/workstation-for-linux.html + install = vmware-workstation.install arch = x86_64 license = custom + makedepends = sqlite depends = dkms - depends = linux-headers + depends = fontconfig + depends = zlib + optdepends = linux-headers: build modules against Arch kernel + provides = vmware-ovftool conflicts = vmware-modules-dkms conflicts = vmware-ovftool + conflicts = vmware-patch conflicts = vmware-systemd-services options = !strip options = emptydirs - source = https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-12.5.2-4638234.x86_64.bundle + backup = etc/vmware/config + source = https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-12.5.5-5234757.x86_64.bundle source = bootstrap source = config source = config.xml @@ -30,7 +37,7 @@ pkgbase = vmware-workstation source = vmmon.patch source = vmnet.patch source = vsock.patch - sha1sums = 70f81c36f13e957fded9577fcd7b9b0fe1481c0c + sha1sums = 85082ae7d79ae42b5debe4be1dc210ec5ea69bae sha1sums = a91b3d711846dafe10f45d89c531dab703bfb113 sha1sums = e57f7715c092d9b1fb74a7baadc07ef214cfb4cd sha1sums = 4bea74ce942e73bf25a8e5fdb0027493d3f114b9 @@ -42,12 +49,12 @@ pkgbase = vmware-workstation sha1sums = d90c687250c16fc5586938de5dc7539a58500adc sha1sums = 529556a0db5564dc8237ee327a2ee176bcf2c02d sha1sums = c1dbfbad3473d12e9c82b75c5f1faf795f3cc217 - sha1sums = 3f6f14f8047941c015e9067f62ae403acc7b563c - sha1sums = be1fb82253f1a95518c990e930c449eaa426c16b - sha1sums = b4bd05f5d5a98f90fcbdd515b7bb7e6151951e11 - sha1sums = 4958ce81e7f5b192e1417426fb70748fdd9a15b9 - sha1sums = 51d221c5bc7e3d566d5ce27d0ac603196c12aaf4 - sha1sums = 15ecb9143dfa0135ced2e726eff4800448f3d369 + sha1sums = 91907f53492e3cfdabffd00b6c56e6a435fc9749 + sha1sums = f4af25095e51d8f12bfde89282261dbc0f0faa10 + sha1sums = 73a78bbeac0625d50756da786a59e1e1e5df95f3 + sha1sums = c183c6a5be9ecf834381832e63d7f39edf147678 + sha1sums = c5109127f746cb6672f871331bab9bd368d990ac + sha1sums = 3ca42f0e86986782827f221cbbd3ed66e7330b73 pkgname = vmware-workstation @@ -1,21 +1,48 @@ -# Maintainer: Maxwell Pray a.k.a. Synthead <synthead@gmail.com> +# Maintainer: Jean-Marc Lenoir <archlinux "at" jihemel "dot" com> +# Contributor: Maxwell Pray a.k.a. Synthead <synthead@gmail.com> +################################################################################ +# Patch VMware Workstation to enable macOS guests support +# Uncomment the line below to enable it + +#_enable_macOS_guests=y + +# CAUTION: Run macOS on a non Apple computer may be forbidden in your country. +# Source of the patch: https://github.com/DrDonk/unlocker +# Forum: http://www.insanelymac.com/forum/topic/303311-workstation-1112-player-712-fusion-78-and-esxi-6-mac-os-x-unlocker-2 +################################################################################ + +#PKGEXT=.pkg.tar pkgname=vmware-workstation -pkgver=12.5.2_4638234 -pkgrel=14 +pkgver=12.5.5_5234757 +pkgrel=1 pkgdesc='The industry standard for running multiple operating systems as virtual machines on a single Linux PC.' arch=(x86_64) url='https://www.vmware.com/products/workstation-for-linux.html' license=(custom) +install="vmware-workstation.install" conflicts=( vmware-modules-dkms vmware-ovftool + vmware-patch vmware-systemd-services ) +provides=( + vmware-ovftool +) depends=( dkms - linux-headers + # needed to replace internal libs: + fontconfig + zlib +) +optdepends=( + 'linux-headers: build modules against Arch kernel' ) +makedepends=( + sqlite +) +backup=('etc/vmware/config') source=( "https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-${pkgver/_/-}.x86_64.bundle" @@ -41,7 +68,7 @@ source=( vsock.patch ) sha1sums=( - 70f81c36f13e957fded9577fcd7b9b0fe1481c0c + 85082ae7d79ae42b5debe4be1dc210ec5ea69bae a91b3d711846dafe10f45d89c531dab703bfb113 e57f7715c092d9b1fb74a7baadc07ef214cfb4cd @@ -57,15 +84,66 @@ sha1sums=( 529556a0db5564dc8237ee327a2ee176bcf2c02d c1dbfbad3473d12e9c82b75c5f1faf795f3cc217 - 3f6f14f8047941c015e9067f62ae403acc7b563c - be1fb82253f1a95518c990e930c449eaa426c16b - b4bd05f5d5a98f90fcbdd515b7bb7e6151951e11 - 4958ce81e7f5b192e1417426fb70748fdd9a15b9 - 51d221c5bc7e3d566d5ce27d0ac603196c12aaf4 - 15ecb9143dfa0135ced2e726eff4800448f3d369 + 91907f53492e3cfdabffd00b6c56e6a435fc9749 + f4af25095e51d8f12bfde89282261dbc0f0faa10 + 73a78bbeac0625d50756da786a59e1e1e5df95f3 + c183c6a5be9ecf834381832e63d7f39edf147678 + c5109127f746cb6672f871331bab9bd368d990ac + 3ca42f0e86986782827f221cbbd3ed66e7330b73 ) options=(!strip emptydirs) + +_isoimages=(freebsd linux linuxPreGlibc25 netware solaris windows winPre2k winPreVista) + +if [ -n "$_enable_macOS_guests" ]; then + +_vmware_fusion_ver=8.5.6_5234762 +# List of VMware Fusion versions: https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/ + +makedepends+=( + python2 + unzip +) + +source+=( + "https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/${_vmware_fusion_ver/_//}/packages/com.vmware.fusion.tools.darwinPre15.zip.tar" + "https://softwareupdate.vmware.com/cds/vmw-desktop/fusion/${_vmware_fusion_ver/_//}/packages/com.vmware.fusion.tools.darwin.zip.tar" + unlocker.py +) +sha1sums+=( + de76483a5c58c4fbdec8dc1e339808497aa2afbb + 3dca561a996bea5f356ea47a62f7a0e995b5e7ce + 18773b64c403621a9c286797ba3c0ea618b58af6 +) + +_fusion_isoimages=(darwin darwinPre15) +fi + + +_create_database_file() { + # Create a database which contains the list of guest tools (necessary to avoid that vmware try to download them) + local database_filename="$pkgdir/etc/vmware-installer/database" + echo -n "" > $database_filename + + sqlite3 $database_filename "CREATE TABLE settings(key VARCHAR PRIMARY KEY, value VARCHAR NOT NULL, component_name VARCHAR NOT NULL);" + sqlite3 $database_filename "INSERT INTO settings(key,value,component_name) VALUES('db.schemaVersion','2','vmware-installer');" + sqlite3 $database_filename "CREATE TABLE components(id INTEGER PRIMARY KEY, name VARCHAR NOT NULL, version VARCHAR NOT NULL, buildNumber INTEGER NOT NULL, component_core_id INTEGER NOT NULL, longName VARCHAR NOT NULL, description VARCHAR, type INTEGER NOT NULL);" + + for isoimage in ${_isoimages[@]} + do + local version=$(cat "$srcdir/extracted/vmware-tools-$isoimage/manifest.xml" | grep -oPm1 "(?<=<version>)[^<]+") + sqlite3 $database_filename "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"vmware-tools-$isoimage\",\"$version\",\"${pkgver#*_}\",1,\"$isoimage\",\"$isoimage\",1);" + done + +if [ -n "$_enable_macOS_guests" ]; then + for isoimage in ${_fusion_isoimages[@]} + do + sqlite3 $database_filename "INSERT INTO components(name,version,buildNumber,component_core_id,longName,description,type) VALUES(\"vmware-tools-$isoimage\",\"0\",\"${_vmware_fusion_ver#*_}\",1,\"$isoimage\",\"$isoimage\",1);" + done +fi +} + prepare() { extracted_dir="$srcdir/extracted" [[ -d "$extracted_dir" ]] && rm -r "$extracted_dir" @@ -73,17 +151,29 @@ prepare() { bash \ "$(readlink -f "$srcdir/VMware-Workstation-Full-${pkgver/_/-}.x86_64.bundle")" \ --extract "$extracted_dir" + +if [ -n "$_enable_macOS_guests" ]; then + for isoimage in ${_fusion_isoimages[@]} + do + unzip -q com.vmware.fusion.tools.$isoimage.zip + rm manifest.plist + done + + sed -i -e "s/vmx_path = '/vmx_path = '${pkgdir//\//\\/}/" \ + -i -e "s/vmwarebase = '/vmwarebase = '${pkgdir//\//\\/}/" \ + -i -e "s/vmx_version = .*$/vmx_version = 'VMware Player ${pkgver/_/ build-}'/" "$srcdir/unlocker.py" +fi } package() { # Make directories and copy files. mkdir -p \ - "$pkgdir/usr"/{share,bin,doc} \ - "$pkgdir/usr/lib"/{vmware/setup,vmware-vix,vmware-ovftool} \ + "$pkgdir/usr"/{share,bin} \ + "$pkgdir/usr/lib"/{vmware/setup,vmware-vix,vmware-ovftool,vmware-installer/2.1.0} \ "$pkgdir/var/lib/vmware/Shared VMs" \ - "$pkgdir/run/vmware" \ - "$pkgdir/etc/vmware" + "$pkgdir/etc/vmware" \ + "$pkgdir/usr/share/licenses/$pkgname" cd "$srcdir/extracted" @@ -92,6 +182,7 @@ package() { vmware-workstation/doc \ vmware-workstation/man \ vmware-network-editor-ui/share/* \ + vmware-player-app/share/* \ "$pkgdir/usr/share" cp -r \ @@ -100,6 +191,7 @@ package() { vmware-vix-core/bin/* \ vmware-workstation-server/{vmware-hostd,vmware-vim-cmd,vmware-wssc-adminTool} \ vmware-network-editor-ui/bin/* \ + vmware-player-app/bin/* \ "$pkgdir/usr/bin" cp -r \ @@ -130,18 +222,20 @@ package() { vmware-ovftool/* \ "$pkgdir/usr/lib/vmware-ovftool" - for isoimage in \ - freebsd \ - linux \ - netware \ - solaris \ - winPre2k \ - windows + cp -r \ + vmware-installer/{python,sopython,vmis,vmis-launcher,vmware-installer,vmware-installer.py} \ + "$pkgdir/usr/lib/vmware-installer/2.1.0" + + for isoimage in ${_isoimages[@]} do install -Dm 644 "vmware-tools-$isoimage/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso" install -Dm 644 "vmware-tools-$isoimage/$isoimage.iso.sig" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso.sig" done + mv "$pkgdir/usr/lib/vmware/licenses"/* "$pkgdir/usr/share/licenses/$pkgname" + rmdir "$pkgdir/usr/lib/vmware/licenses" + mv "$pkgdir/usr/share/doc"/{EULA,*open_source_licenses.txt} "$pkgdir/usr/share/licenses/$pkgname" + install -Dm 644 vmware-player-app/lib/isoimages/tools-key.pub "$pkgdir/usr/lib/vmware/isoimages/tools-key.pub" install -Dm 644 vmware-vmx/extra/modules.xml "$pkgdir/usr/lib/vmware/modules/modules.xml" @@ -171,7 +265,8 @@ package() { "$pkgdir/usr/lib/vmware/bin"/* \ "$pkgdir/usr/lib/vmware/setup/vmware-config" \ "$pkgdir/usr/lib/vmware/lib"/{wrapper-gtk24.sh,libgksu2.so.0/gksu-run-helper} \ - "$pkgdir/usr/lib/vmware-ovftool"/{ovftool,ovftool.bin} + "$pkgdir/usr/lib/vmware-ovftool"/{ovftool,ovftool.bin} \ + "$pkgdir/usr/lib/vmware-installer/2.1.0"/{vmware-installer,vmis-launcher} chmod -R 600 "$pkgdir/etc/vmware/ssl" chmod +s "$pkgdir/usr/lib/vmware/bin/vmware-vmx" @@ -218,6 +313,7 @@ package() { sed -i 's,@@BINARY@@,/usr/bin/vmware,' "$pkgdir/usr/share/applications/vmware-workstation.desktop" sed -i 's,@@BINARY@@,/usr/bin/vmware-netcfg,' "$pkgdir/usr/share/applications/vmware-netcfg.desktop" sed -i 's,@@VMWARE_INSTALLER@@,/usr/bin/vmware,' "$pkgdir/usr/share/applications/vmware-workstation.desktop" + sed -i 's,@@BINARY@@,/usr/bin/vmplayer,' "$pkgdir/usr/share/applications/vmware-player.desktop" sed -i 's,@@AUTHD_PORT@@,902,' "$pkgdir/usr/lib/vmware/hostd/docroot/client/clients.xml" @@ -243,4 +339,25 @@ package() { for module in vmblock vmci vmmon vmnet vsock; do patch -p2 --read-only=ignore --directory="$dkms_dir/$module-only" < "$srcdir/$module.patch" done + +if [ -n "$_enable_macOS_guests" ]; then + # Patch VMware files to add macOS guest support + python2 "$srcdir/unlocker.py" + + for isoimage in ${_fusion_isoimages[@]} + do + install -Dm 644 "$srcdir/payload/$isoimage.iso" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso" + install -Dm 644 "$srcdir/payload/$isoimage.iso.sig" "$pkgdir/usr/lib/vmware/isoimages/$isoimage.iso.sig" + done +fi + + _create_database_file + + # to solve bugs with incompatibles library versions: + ln -sf /usr/lib/libz.so.1 "$pkgdir/usr/lib/vmware/lib/libz.so.1/" + # if there is not a better solution, define environment variable VMWARE_USE_SHIPPED_LIBS + install -dm755 "$pkgdir/etc/profile.d" + echo -e "#export VMWARE_USE_SHIPPED_LIBS=yes" > "$pkgdir/etc/profile.d/vmware.sh" + chmod 755 "$pkgdir/etc/profile.d/vmware.sh" + ln -sf /usr/lib/libfontconfig.so.1 "$pkgdir/usr/lib/vmware/lib/libfontconfig.so.1/" # avoid a conflict with fontconfig when VMWARE_USE_SHIPPED_LIBS is defined } diff --git a/dkms.conf b/dkms.conf index 6df1e9db5cfe..2cbefff293b3 100644 --- a/dkms.conf +++ b/dkms.conf @@ -1,7 +1,7 @@ PACKAGE_NAME='@PKGNAME@' PACKAGE_VERSION='@PKGVER@' AUTOINSTALL='yes' -MAKE[0]='find -mindepth 1 -maxdepth 1 -type d -exec make -C {} \;' +MAKE[0]='find -mindepth 1 -maxdepth 1 -type d -exec make KVERSION=$kernelver -C {} \;' CLEAN='find -mindepth 1 -maxdepth 1 -type d -exec make clean -C {} \;' BUILT_MODULE_NAME[0]='vmblock' diff --git a/unlocker.py b/unlocker.py new file mode 100644 index 000000000000..664c11d55c08 --- /dev/null +++ b/unlocker.py @@ -0,0 +1,428 @@ +#!/usr/bin/env python +""" +The MIT License (MIT) + +Copyright (c) 2014-2016 Dave Parsons & Sam Bingner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the 'Software'), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +vSMC Header Structure +Offset Length Struct Type Description +---------------------------------------- +0x00/00 0x08/08 Q ptr Offset to key table +0x08/08 0x04/4 I int Number of private keys +0x0C/12 0x04/4 I int Number of public keys + +vSMC Key Data Structure +Offset Length Struct Type Description +---------------------------------------- +0x00/00 0x04/04 4s int Key name (byte reversed e.g. #KEY is YEK#) +0x04/04 0x01/01 B byte Length of returned data +0x05/05 0x04/04 4s int Data type (byte reversed e.g. ui32 is 23iu) +0x09/09 0x01/01 B byte Flag R/W +0x0A/10 0x06/06 6x byte Padding +0x10/16 0x08/08 Q ptr Internal VMware routine +0x18/24 0x30/48 48B byte Data +""" + +from __future__ import print_function +import os +import sys +import struct +import subprocess + +if sys.version_info < (2, 7): + sys.stderr.write('You need Python 2.7 or later\n') + sys.exit(1) + +# Setup imports depending on whether IronPython or CPython +if sys.platform == 'win32' \ + or sys.platform == 'cli': + from _winreg import * + + +def rot13(s): + chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz' + trans = chars[26:] + chars[:26] + rot_char = lambda c: trans[chars.find(c)] if chars.find(c) > -1 else c + return ''.join(rot_char(c) for c in s) + + +def bytetohex(data): + if sys.version_info > (3, 0): + # Python 3 code in this block + return "".join("{:02X} ".format(c) for c in data) + else: + # Python 2 code in this block + return "".join("{:02X} ".format(ord(c)) for c in data) + + +def joinpath(folder, file): + return os.path.join(folder, file) + + +def printkey(i, offset, smc_key, smc_data): + print(str(i + 1).zfill(3) + + ' ' + hex(offset) + + ' ' + smc_key[0][::-1].decode('UTF-8') + + ' ' + str(smc_key[1]).zfill(2) + + ' ' + smc_key[2][::-1].replace(b'\x00', b' ').decode('UTF-8') + + ' ' + '{0:#0{1}x}'.format(smc_key[3], 4) + + ' ' + hex(smc_key[4]) + + ' ' + bytetohex(smc_data)) + + +E_CLASS64 = 2 +E_SHT_RELA = 4 + + +def patchelf(f, oldoffset, newoffset): + f.seek(0) + magic = f.read(4) + if not magic == b'\x7fELF': + raise Exception('Magic number does not match') + + ei_class = struct.unpack('=B', f.read(1))[0] + if ei_class != E_CLASS64: + raise Exception('Not 64bit elf header: ' + ei_class) + + f.seek(40) + e_shoff = struct.unpack('=Q', f.read(8))[0] + f.seek(58) + e_shentsize = struct.unpack('=H', f.read(2))[0] + e_shnum = struct.unpack('=H', f.read(2))[0] + e_shstrndx = struct.unpack('=H', f.read(2))[0] + + print('e_shoff: 0x{:x} e_shentsize: 0x{:x} e_shnum:0x{:x} e_shstrndx:0x{:x}'.format(e_shoff, e_shentsize, + e_shnum, e_shstrndx)) + + for i in range(0, e_shnum): + f.seek(e_shoff + i * e_shentsize) + e_sh = struct.unpack('=LLQQQQLLQQ', f.read(e_shentsize)) + e_sh_name = e_sh[0] + e_sh_type = e_sh[1] + e_sh_offset = e_sh[4] + e_sh_size = e_sh[5] + e_sh_entsize = e_sh[9] + if e_sh_type == E_SHT_RELA: + e_sh_nument = int(e_sh_size / e_sh_entsize) + # print 'RELA at 0x{:x} with {:d} entries'.format(e_sh_offset, e_sh_nument) + for j in range(0, e_sh_nument): + f.seek(e_sh_offset + e_sh_entsize * j) + rela = struct.unpack('=QQq', f.read(e_sh_entsize)) + r_offset = rela[0] + r_info = rela[1] + r_addend = rela[2] + if r_addend == oldoffset: + r_addend = newoffset + f.seek(e_sh_offset + e_sh_entsize * j) + f.write(struct.pack('=QQq', r_offset, r_info, r_addend)) + print('Relocation modified at: ' + hex(e_sh_offset + e_sh_entsize * j)) + + +def patchkeys(f, key): + # Setup struct pack string + key_pack = '=4sB4sB6xQ' + smc_old_memptr = 0 + smc_new_memptr = 0 + + # Do Until OSK1 read + i = 0 + while True: + + # Read key into struct str and data byte str + offset = key + (i * 72) + f.seek(offset) + smc_key = struct.unpack(key_pack, f.read(24)) + smc_data = f.read(smc_key[1]) + + # Reset pointer to beginning of key entry + f.seek(offset) + + if smc_key[0] == b'SKL+': + # Use the +LKS data routine for OSK0/1 + smc_new_memptr = smc_key[4] + print('+LKS Key: ') + printkey(i, offset, smc_key, smc_data) + + elif smc_key[0] == b'0KSO': + # Write new data routine pointer from +LKS + print('OSK0 Key Before:') + printkey(i, offset, smc_key, smc_data) + smc_old_memptr = smc_key[4] + f.seek(offset) + f.write(struct.pack(key_pack, smc_key[0], smc_key[1], smc_key[2], smc_key[3], smc_new_memptr)) + f.flush() + + # Write new data for key + f.seek(offset + 24) + smc_new_data = rot13('bheuneqjbexolgurfrjbeqfthneqrqcy') + f.write(smc_new_data.encode('UTF-8')) + f.flush() + + # Re-read and print key + f.seek(offset) + smc_key = struct.unpack(key_pack, f.read(24)) + smc_data = f.read(smc_key[1]) + print('OSK0 Key After:') + printkey(i, offset, smc_key, smc_data) + + elif smc_key[0] == b'1KSO': + # Write new data routine pointer from +LKS + print('OSK1 Key Before:') + printkey(i, offset, smc_key, smc_data) + smc_old_memptr = smc_key[4] + f.seek(offset) + f.write(struct.pack(key_pack, smc_key[0], smc_key[1], smc_key[2], smc_key[3], smc_new_memptr)) + f.flush() + + # Write new data for key + f.seek(offset + 24) + smc_new_data = rot13('rnfrqbagfgrny(p)NccyrPbzchgreVap') + f.write(smc_new_data.encode('UTF-8')) + f.flush() + + # Re-read and print key + f.seek(offset) + smc_key = struct.unpack(key_pack, f.read(24)) + smc_data = f.read(smc_key[1]) + print('OSK1 Key After:') + printkey(i, offset, smc_key, smc_data) + + # Finished so get out of loop + break + + else: + pass + + i += 1 + return smc_old_memptr, smc_new_memptr + + +def patchsmc(name, sharedobj): + with open(name, 'r+b') as f: + + smc_old_memptr = 0 + smc_new_memptr = 0 + + # Read file into string variable + vmx = f.read() + + print('File: ' + name) + + # Setup hex string for vSMC headers + # These are the private and public key counts + smc_header_v0 = b'\xF2\x00\x00\x00\xF0\x00\x00\x00' + smc_header_v1 = b'\xB4\x01\x00\x00\xB0\x01\x00\x00' + + # Setup hex string for #KEY key + key_key = b'\x59\x45\x4B\x23\x04\x32\x33\x69\x75' + + # Setup hex string for $Adr key + adr_key = b'\x72\x64\x41\x24\x04\x32\x33\x69\x75' + + # Find the vSMC headers + smc_header_v0_offset = vmx.find(smc_header_v0) - 8 + smc_header_v1_offset = vmx.find(smc_header_v1) - 8 + + # Find '#KEY' keys + smc_key0 = vmx.find(key_key) + smc_key1 = vmx.rfind(key_key) + + # Find '$Adr' key only V1 table + smc_adr = vmx.find(adr_key) + + # Print vSMC0 tables and keys + print('appleSMCTableV0 (smc.version = "0")') + print('appleSMCTableV0 Address : ' + hex(smc_header_v0_offset)) + print('appleSMCTableV0 Private Key #: 0xF2/242') + print('appleSMCTableV0 Public Key #: 0xF0/240') + + if (smc_adr - smc_key0) != 72: + print('appleSMCTableV0 Table : ' + hex(smc_key0)) + smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key0) + elif (smc_adr - smc_key1) != 72: + print('appleSMCTableV0 Table : ' + hex(smc_key1)) + smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key1) + + print() + + # Print vSMC1 tables and keys + print('appleSMCTableV1 (smc.version = "1")') + print('appleSMCTableV1 Address : ' + hex(smc_header_v1_offset)) + print('appleSMCTableV1 Private Key #: 0x01B4/436') + print('appleSMCTableV1 Public Key #: 0x01B0/432') + + if (smc_adr - smc_key0) == 72: + print('appleSMCTableV1 Table : ' + hex(smc_key0)) + smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key0) + elif (smc_adr - smc_key1) == 72: + print('appleSMCTableV1 Table : ' + hex(smc_key1)) + smc_old_memptr, smc_new_memptr = patchkeys(f, smc_key1) + + print() + + # Find matching RELA record in .rela.dyn in ESXi ELF files + # This is temporary code until proper ELF parsing written + if sharedobj: + print('Modifying RELA records from: ' + hex(smc_old_memptr) + ' to ' + hex(smc_new_memptr)) + patchelf(f, smc_old_memptr, smc_new_memptr) + + # Tidy up + f.flush() + f.close() + + +def patchbase(name): + # Patch file + print('GOS Patching: ' + name) + f = open(name, 'r+b') + + # Entry to search for in GOS table + darwin = ( + '\x10\x00\x00\x00\x10\x00\x00\x00' + '\x02\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00' + '\xBE' + ) + + # Read file into string variable + base = f.read() + + # Loop thorugh each entry and set top bit + # 0xBE --> 0xBF + offset = 0 + while offset < len(base): + offset = base.find(darwin, offset) + if offset == -1: + break + f.seek(offset + 32) + flag = f.read(1) + if flag == '\xBE': + f.seek(offset + 32) + f.write('\xBF') + print('GOS Patched flag @: ' + hex(offset)) + else: + print('GOS Unknown flag @: ' + hex(offset) + '/' + hex(int(flag))) + + offset += 33 + + # Tidy up + f.flush() + f.close() + print('GOS Patched: ' + name) + + +def patchvmkctl(name): + # Patch file + print('smcPresent Patching: ' + name) + f = open(name, 'r+b') + + # Read file into string variable + vmkctl = f.read() + applesmc = vmkctl.find(b'applesmc') + f.seek(applesmc) + f.write(b'vmkernel') + + # Tidy up + f.flush() + f.close() + print('smcPresent Patched: ' + name) + + +def main(): + # Work around absent Platform module on VMkernel + if os.name == 'nt' or os.name == 'cli': + osname = 'windows' + else: + osname = os.uname()[0].lower() + + vmwarebase = '' + libvmkctl32 = '' + libvmkctl64 = '' + vmx_so = False + + # Setup default paths + if osname == 'darwin': + vmx_path = '/Applications/VMware Fusion.app/Contents/Library/' + vmx = joinpath(vmx_path, 'vmware-vmx') + vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug') + vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats') + + elif osname == 'linux': + vmx_path = '/usr/lib/vmware/bin/' + vmx = joinpath(vmx_path, 'vmware-vmx') + vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug') + vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats') + vmx_version = subprocess.check_output(["vmplayer", "-v"]) + if vmx_version.startswith('VMware Player 12'): + vmx_so = True + vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so/libvmwarebase.so' + else: + vmwarebase = '/usr/lib/vmware/lib/libvmwarebase.so.0/libvmwarebase.so.0' + + elif osname == 'vmkernel': + vmx_path = os.path.dirname(os.path.abspath(__file__)) + vmx = joinpath(vmx_path, '/unlocker/bin/vmx') + vmx_debug = joinpath(vmx_path, '/unlocker/bin/vmx-debug') + vmx_stats = joinpath(vmx_path, '/unlocker/bin/vmx-stats') + vmx_so = True + libvmkctl32 = joinpath(vmx_path, '/unlocker/lib/libvmkctl.so') + libvmkctl64 = joinpath(vmx_path, '/unlocker/lib64/libvmkctl.so') + + elif osname == 'windows': + reg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) + key = OpenKey(reg, r'SOFTWARE\Wow6432Node\VMware, Inc.\VMware Workstation') + vmwarebase_path = QueryValueEx(key, 'InstallPath')[0] + vmx_path = QueryValueEx(key, 'InstallPath64')[0] + vmx = joinpath(vmx_path, 'vmware-vmx.exe') + vmx_debug = joinpath(vmx_path, 'vmware-vmx-debug.exe') + vmx_stats = joinpath(vmx_path, 'vmware-vmx-stats.exe') + vmwarebase = joinpath(vmwarebase_path, 'vmwarebase.dll') + + else: + print('Unknown Operating System: ' + osname) + return + + # Patch the vmx executables skipping stats version for Player + patchsmc(vmx, vmx_so) + patchsmc(vmx_debug, vmx_so) + if os.path.isfile(vmx_stats): + patchsmc(vmx_stats, vmx_so) + + # Patch vmwarebase for Workstation and Player + # Not required on Fusion or ESXi as table already has correct flags + if vmwarebase != '': + patchbase(vmwarebase) + else: + print('Patching vmwarebase is not required on this system') + + # Now using sed in the local.sh script + if osname == 'vmkernel': + # Patch ESXi 6.0 and 6.5 32 bit .so + patchvmkctl(libvmkctl32) + + # Patch ESXi 6.5 64 bit .so + if os.path.isfile(libvmkctl64): + patchvmkctl(libvmkctl64) + + +if __name__ == '__main__': + main() diff --git a/vmblock.patch b/vmblock.patch index 14f2f0324ef2..85068ad0d2d1 100644 --- a/vmblock.patch +++ b/vmblock.patch @@ -262,10 +262,18 @@ index d7ac1f6..c5e6604 100644 .release = FileOpRelease, }; diff --git a/vmblock/linux/inode.c b/vmblock/linux/inode.c -index 098c94c..bd2bf01 100644 +index 098c94c..7aed6e7 100644 --- a/vmblock/linux/inode.c +++ b/vmblock/linux/inode.c -@@ -35,13 +35,24 @@ +@@ -28,20 +28,32 @@ + #include <linux/fs.h> + #include <linux/time.h> + #include <linux/namei.h> ++#include <linux/cred.h> + + #include "vmblockInt.h" + #include "filesystem.h" + #include "block.h" /* Inode operations */ @@ -334,7 +342,7 @@ index 098c94c..bd2bf01 100644 inode->i_op = &LinkInodeOps; d_add(dentry, inode); -@@ -176,8 +200,13 @@ InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink +@@ -176,8 +200,15 @@ InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink if (!iinfo) { return -EINVAL; } @@ -343,13 +351,15 @@ index 098c94c..bd2bf01 100644 return vfs_readlink(dentry, buffer, buflen, iinfo->name); +#elif LINUX_VERSION_CODE <= KERNEL_VERSION(4, 6, 99) + return readlink_copy(buffer, buflen, iinfo->name); ++#elif LINUX_VERSION_CODE <= KERNEL_VERSION(4, 9, 99) ++ return generic_readlink(dentry, buffer, buflen); +#else + return vfs_readlink(dentry, buffer, buflen); +#endif } -@@ -198,30 +227,58 @@ InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink +@@ -198,30 +229,58 @@ InodeOpReadlink(struct dentry *dentry, // IN : dentry of symlink *---------------------------------------------------------------------------- */ diff --git a/vmci.patch b/vmci.patch index 0f9598d74bf5..d52194e45cb0 100644 --- a/vmci.patch +++ b/vmci.patch @@ -99,11 +99,14 @@ 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 @@ +@@ -40,6 +40,10 @@ #include <linux/socket.h> /* For memcpy_{to,from}iovec(). */ #include <linux/vmalloc.h> #include <linux/wait.h> +#include <linux/skbuff.h> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 99) ++#include <linux/sched/signal.h> ++#endif #include "compat_highmem.h" #include "compat_interrupt.h" diff --git a/vmmon.patch b/vmmon.patch index f2c4fd370679..eea253c0a3ac 100644 --- a/vmmon.patch +++ b/vmmon.patch @@ -49,6 +49,19 @@ 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 +@@ -105,8 +105,12 @@ + static int LinuxDriver_Close(struct inode *inode, struct file *filp); + static unsigned int LinuxDriverPoll(struct file *file, poll_table *wait); + #if defined(VMW_NOPAGE_2624) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + static int LinuxDriverFault(struct vm_area_struct *vma, struct vm_fault *fault); + #else ++static int LinuxDriverFault(struct vm_fault *fault); ++#endif ++#else + static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, + unsigned long address, + int *type); @@ -124,7 +124,16 @@ static struct vm_operations_struct vmuser_mops = { #endif }; @@ -118,6 +131,30 @@ index 87cf45b..5390a93 100644 #endif Log("Module %s: unloaded\n", linuxState.deviceName); +@@ -882,15 +886,23 @@ + */ + + #if defined(VMW_NOPAGE_2624) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + static int LinuxDriverFault(struct vm_area_struct *vma, //IN + struct vm_fault *fault) //IN/OUT + #else ++static int LinuxDriverFault(struct vm_fault *fault) //IN/OUT ++#endif ++#else + static struct page *LinuxDriverNoPage(struct vm_area_struct *vma, //IN + unsigned long address, //IN + int *type) //OUT: Fault type + #endif + { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + VMLinux *vmLinux = (VMLinux *) vma->vm_file->private_data; ++#else ++ VMLinux *vmLinux = (VMLinux *) fault->vma->vm_file->private_data; ++#endif + unsigned long pg; + struct page* page; + @@ -1279,7 +1275,7 @@ LinuxDriverReadTSC(void *data, // OUT: TSC values *----------------------------------------------------------------------------- */ @@ -137,9 +174,19 @@ index 87cf45b..5390a93 100644 retval = -EINVAL; } diff --git a/vmmon/linux/hostif.c b/vmmon/linux/hostif.c -index 7053a83..583d6da 100644 +index fd32013..583d6da 100644 --- a/vmmon/linux/hostif.c +++ b/vmmon/linux/hostif.c +@@ -37,6 +37,9 @@ + + #include <linux/vmalloc.h> + #include <linux/slab.h> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 99) ++#include <linux/sched/signal.h> ++#endif + + #include <linux/preempt.h> + #include <linux/poll.h> @@ -74,6 +74,7 @@ #include <linux/kthread.h> #include <linux/wait.h> @@ -242,11 +289,13 @@ index 7053a83..583d6da 100644 * * Side effects: * None -@@ -1162,12 +1167,16 @@ HostIFGetUserPages(void *uvAddr, // IN +@@ -1162,14 +1167,16 @@ HostIFGetUserPages(void *uvAddr, // IN int retval; down_read(¤t->mm->mmap_sem); --#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) +- retval = get_user_pages((unsigned long)uvAddr, numPages, 0, ppages, NULL); +-#elif 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, @@ -262,7 +311,7 @@ index 7053a83..583d6da 100644 up_read(¤t->mm->mmap_sem); return retval != numPages; -@@ -1179,11 +1188,11 @@ HostIFGetUserPages(void *uvAddr, // IN +@@ -1181,11 +1188,11 @@ HostIFGetUserPages(void *uvAddr, // IN * * HostIF_IsLockedByMPN -- * @@ -276,7 +325,7 @@ index 7053a83..583d6da 100644 * * Side effects: * None. -@@ -1305,7 +1314,7 @@ HostIF_UnlockPage(VMDriver *vm, // IN: +@@ -1307,7 +1314,7 @@ HostIF_UnlockPage(VMDriver *vm, // IN: vpn = VA_2_VPN((VA)addr); e = MemTrack_LookupVPN(vm->memtracker, vpn); @@ -285,7 +334,7 @@ index 7053a83..583d6da 100644 if (e == NULL) { return PAGE_UNLOCK_NOT_TRACKED; } -@@ -1351,7 +1360,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver +@@ -1353,7 +1360,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver { void *va = VA64ToPtr(uAddr); MemTrackEntry *e; @@ -294,7 +343,7 @@ index 7053a83..583d6da 100644 /* * 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 +@@ -1371,7 +1378,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver } /* @@ -303,7 +352,7 @@ index 7053a83..583d6da 100644 * 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 +@@ -1384,7 +1391,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver return PAGE_UNLOCK_MISMATCHED_TYPE; } } @@ -312,7 +361,7 @@ index 7053a83..583d6da 100644 HOST_UNLOCK_PFN_BYMPN(vm, mpn); -@@ -1390,7 +1399,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver +@@ -1392,7 +1399,7 @@ HostIF_UnlockPageByMPN(VMDriver *vm, // IN: VMDriver } @@ -321,7 +370,7 @@ index 7053a83..583d6da 100644 UnlockEntry(void *clientData, // IN: MemTrackEntry *entryPtr) // IN: { -@@ -1453,11 +1462,11 @@ HostIF_FreeAllResources(VMDriver *vm) // IN +@@ -1455,11 +1462,11 @@ HostIF_FreeAllResources(VMDriver *vm) // IN * * HostIF_AllocKernelMem * @@ -336,7 +385,7 @@ index 7053a83..583d6da 100644 * * Side effects: * memory is malloced -@@ -1469,8 +1478,8 @@ HostIF_AllocKernelMem(size_t size, // IN: +@@ -1471,8 +1478,8 @@ HostIF_AllocKernelMem(size_t size, // IN: int wired) // IN: { void * ptr = kmalloc(size, GFP_KERNEL); @@ -347,7 +396,7 @@ index 7053a83..583d6da 100644 Warning("%s failed (size=%p)\n", __func__, (void*)size); } -@@ -1498,7 +1507,7 @@ void * +@@ -1500,7 +1507,7 @@ void * HostIF_AllocPage(void) { VA kvAddr; @@ -356,7 +405,7 @@ index 7053a83..583d6da 100644 kvAddr = __get_free_page(GFP_KERNEL); if (kvAddr == 0) { Warning("%s: __get_free_page() failed\n", __func__); -@@ -1513,7 +1522,7 @@ HostIF_AllocPage(void) +@@ -1515,7 +1522,7 @@ HostIF_AllocPage(void) * * HostIF_FreeKernelMem * @@ -365,7 +414,7 @@ index 7053a83..583d6da 100644 * * Results: * None. -@@ -1552,7 +1561,7 @@ HostIF_FreePage(void *ptr) // IN: +@@ -1554,7 +1561,7 @@ HostIF_FreePage(void *ptr) // IN: * from the kernel without causing the host to die or to be really upset. * * Results: @@ -374,7 +423,7 @@ index 7053a83..583d6da 100644 * * Side effects: * none -@@ -1580,9 +1589,9 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN +@@ -1582,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 @@ -387,7 +436,7 @@ index 7053a83..583d6da 100644 */ unsigned int forHost; -@@ -1602,7 +1611,7 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN +@@ -1604,7 +1611,7 @@ HostIF_EstimateLockedPageLimit(const VMDriver* vm, // IN unsigned int swapPages = BYTES_2_PAGES(linuxState.swapSize); if (anonPages > swapPages) { @@ -396,7 +445,7 @@ index 7053a83..583d6da 100644 } forHost = lockedPages + LOCKED_PAGE_SLACK; if (forHost > totalPhysicalPages) { -@@ -1647,7 +1656,7 @@ HostIF_Wait(unsigned int timeoutMs) +@@ -1649,7 +1656,7 @@ HostIF_Wait(unsigned int timeoutMs) *---------------------------------------------------------------------- */ @@ -405,7 +454,7 @@ index 7053a83..583d6da 100644 HostIF_WaitForFreePages(unsigned int timeoutMs) // IN: { static unsigned count; -@@ -1672,20 +1681,20 @@ HostIF_WaitForFreePages(unsigned int timeoutMs) // IN: +@@ -1674,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). @@ -429,7 +478,7 @@ index 7053a83..583d6da 100644 { struct timeval tv; uint64 monotime, uptime, upBase, monoBase; -@@ -1707,14 +1716,14 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies +@@ -1709,14 +1716,14 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies do_gettimeofday(&tv); upBase = Atomic_Read64(&uptimeState.uptimeBase); @@ -447,7 +496,7 @@ index 7053a83..583d6da 100644 * 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 +@@ -1728,7 +1735,7 @@ HostIFReadUptimeWork(unsigned long *j) // OUT: current jiffies uint64 newUpBase = monotime - (uptime - upBase); attempts++; @@ -456,7 +505,7 @@ index 7053a83..583d6da 100644 attempts < 5) { /* Another thread updated uptimeBase. Recalculate uptime. */ goto retry; -@@ -1767,7 +1776,7 @@ HostIFUptimeResyncMono(unsigned long data) // IN: ignored +@@ -1769,7 +1776,7 @@ HostIFUptimeResyncMono(unsigned long data) // IN: ignored unsigned long jifs; uintptr_t flags; @@ -465,7 +514,7 @@ index 7053a83..583d6da 100644 * 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 +@@ -1777,7 +1784,7 @@ HostIFUptimeResyncMono(unsigned long data) // IN: ignored uint64 uptime = HostIFReadUptimeWork(&jifs); @@ -474,7 +523,7 @@ index 7053a83..583d6da 100644 * 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) +@@ -1822,8 +1829,8 @@ HostIF_InitUptime(void) uptimeState.jiffiesBase = jiffies; do_gettimeofday(&tv); @@ -485,7 +534,7 @@ index 7053a83..583d6da 100644 tv.tv_sec * UPTIME_FREQ)); init_timer(&uptimeState.timer); -@@ -1949,7 +1958,7 @@ HostIF_CopyFromUser(void *dst, // OUT +@@ -1951,7 +1958,7 @@ HostIF_CopyFromUser(void *dst, // OUT *----------------------------------------------------------------------------- */ @@ -494,7 +543,7 @@ index 7053a83..583d6da 100644 HostIF_CopyToUser(void *dst, // OUT const void *src, // IN unsigned int len) // IN -@@ -1962,15 +1971,15 @@ HostIF_CopyToUser(void *dst, // OUT +@@ -1964,15 +1971,15 @@ HostIF_CopyToUser(void *dst, // OUT *----------------------------------------------------------------------------- * * HostIF_MapCrossPage -- @@ -516,7 +565,7 @@ index 7053a83..583d6da 100644 * uses a permanent mapping, instead of a temporary one with a high LA. * * Results: -@@ -2158,7 +2167,7 @@ HostIF_VMLock(VMDriver *vm, // IN +@@ -2160,7 +2167,7 @@ HostIF_VMLock(VMDriver *vm, // IN * None * * Side effects: @@ -525,7 +574,7 @@ index 7053a83..583d6da 100644 * *----------------------------------------------------------------------------- */ -@@ -2181,7 +2190,7 @@ HostIF_VMUnlock(VMDriver *vm, // IN +@@ -2183,7 +2190,7 @@ HostIF_VMUnlock(VMDriver *vm, // IN * HostIF_VMLockIsHeld -- * * Determine if the per-VM lock is held by the current thread. @@ -534,7 +583,7 @@ index 7053a83..583d6da 100644 * Results: * TRUE if yes * FALSE if no -@@ -2237,14 +2246,14 @@ HostIF_VMLockIsHeld(VMDriver *vm) // IN +@@ -2239,14 +2246,14 @@ HostIF_VMLockIsHeld(VMDriver *vm) // IN * *---------------------------------------------------------------------- */ @@ -551,7 +600,7 @@ index 7053a83..583d6da 100644 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 +@@ -2321,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(); @@ -560,7 +609,7 @@ index 7053a83..583d6da 100644 if (ma == (MA)-1) { return FALSE; } -@@ -2420,7 +2429,7 @@ HostIF_APICInit(VMDriver *vm, // IN: +@@ -2422,7 +2429,7 @@ HostIF_APICInit(VMDriver *vm, // IN: * Perform the semaphore wait (P) operation, possibly blocking. * * Result: @@ -569,7 +618,7 @@ index 7053a83..583d6da 100644 * negated error code otherwise. * * Side-effects: -@@ -2429,7 +2438,7 @@ HostIF_APICInit(VMDriver *vm, // IN: +@@ -2431,7 +2438,7 @@ HostIF_APICInit(VMDriver *vm, // IN: *----------------------------------------------------------------------------- */ @@ -578,7 +627,7 @@ index 7053a83..583d6da 100644 HostIF_SemaphoreWait(VMDriver *vm, // IN: Vcpuid vcpuid, // IN: uint64 *args) // IN: -@@ -2452,7 +2461,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN: +@@ -2454,7 +2461,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN: { struct poll_wqueues table; unsigned int mask; @@ -587,7 +636,7 @@ index 7053a83..583d6da 100644 poll_initwait(&table); current->state = TASK_INTERRUPTIBLE; mask = file->f_op->poll(file, &table.pt); -@@ -2527,7 +2536,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN: +@@ -2529,7 +2536,7 @@ HostIF_SemaphoreWait(VMDriver *vm, // IN: *----------------------------------------------------------------------------- */ @@ -596,7 +645,7 @@ index 7053a83..583d6da 100644 HostIF_SemaphoreForceWakeup(VMDriver *vm, // IN: const VCPUSet *vcs) // IN: { -@@ -2817,8 +2826,8 @@ HostIF_CallOnEachCPU(void (*func)(void*), // IN: function to call +@@ -2819,8 +2826,8 @@ HostIF_CallOnEachCPU(void (*func)(void*), // IN: function to call * * HostIF_ReadPage -- * @@ -607,7 +656,7 @@ index 7053a83..583d6da 100644 * * Results: * 0 on success -@@ -2849,7 +2858,7 @@ HostIF_ReadPage(MPN mpn, // MPN of the page +@@ -2851,7 +2858,7 @@ HostIF_ReadPage(MPN mpn, // MPN of the page if (ptr == NULL) { return -ENOMEM; } @@ -616,7 +665,7 @@ index 7053a83..583d6da 100644 if (kernelBuffer) { memcpy(buf, ptr, PAGE_SIZE); } else { -@@ -2866,7 +2875,7 @@ HostIF_ReadPage(MPN mpn, // MPN of the page +@@ -2868,7 +2875,7 @@ HostIF_ReadPage(MPN mpn, // MPN of the page * * HostIF_WritePage -- * @@ -625,7 +674,7 @@ index 7053a83..583d6da 100644 * page. * * Results: -@@ -2996,7 +3005,7 @@ HostIF_GetNextAnonPage(VMDriver *vm, MPN inMPN) +@@ -2998,7 +3005,7 @@ HostIF_GetNextAnonPage(VMDriver *vm, MPN inMPN) * Side effects: * None. * @@ -634,7 +683,7 @@ index 7053a83..583d6da 100644 */ uint32 -@@ -3014,18 +3023,18 @@ HostIF_GetCurrentPCPU(void) +@@ -3016,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 @@ -656,7 +705,7 @@ index 7053a83..583d6da 100644 HostIFWakeupClockThread(unsigned long data) //IN: { wake_up_process(linuxState.fastClockThread); -@@ -3036,7 +3045,7 @@ HostIFWakeupClockThread(unsigned long data) //IN: +@@ -3038,7 +3045,7 @@ HostIFWakeupClockThread(unsigned long data) //IN: *---------------------------------------------------------------------- * * HostIFTimerCallback -- @@ -665,7 +714,7 @@ index 7053a83..583d6da 100644 * Schedule a tasklet to wake up the fast clock thread. * * Results: -@@ -3047,8 +3056,8 @@ HostIFWakeupClockThread(unsigned long data) //IN: +@@ -3049,8 +3056,8 @@ HostIFWakeupClockThread(unsigned long data) //IN: * *---------------------------------------------------------------------- */ @@ -676,7 +725,7 @@ index 7053a83..583d6da 100644 HostIFTimerCallback(struct hrtimer *timer) //IN: { tasklet_schedule(&timerTasklet); -@@ -3061,7 +3070,7 @@ HostIFTimerCallback(struct hrtimer *timer) //IN: +@@ -3063,7 +3070,7 @@ HostIFTimerCallback(struct hrtimer *timer) //IN: *---------------------------------------------------------------------- * * HostIFScheduleHRTimeout -- @@ -685,7 +734,7 @@ index 7053a83..583d6da 100644 * Schedule an hrtimer to wake up the fast clock thread. * * Results: -@@ -3073,7 +3082,7 @@ HostIFTimerCallback(struct hrtimer *timer) //IN: +@@ -3075,7 +3082,7 @@ HostIFTimerCallback(struct hrtimer *timer) //IN: *---------------------------------------------------------------------- */ @@ -694,7 +743,7 @@ index 7053a83..583d6da 100644 HostIFScheduleHRTimeout(ktime_t *expires) //IN: { struct hrtimer t; -@@ -3091,7 +3100,7 @@ HostIFScheduleHRTimeout(ktime_t *expires) //IN: +@@ -3093,7 +3100,7 @@ HostIFScheduleHRTimeout(ktime_t *expires) //IN: if (hrtimer_active(&t)) { schedule(); } @@ -703,7 +752,7 @@ index 7053a83..583d6da 100644 hrtimer_cancel(&t); __set_current_state(TASK_RUNNING); } -@@ -3114,7 +3123,7 @@ HostIFScheduleHRTimeout(ktime_t *expires) //IN: +@@ -3116,7 +3123,7 @@ HostIFScheduleHRTimeout(ktime_t *expires) //IN: * Side effects: * none. * @@ -712,7 +761,7 @@ index 7053a83..583d6da 100644 */ static long -@@ -3147,7 +3156,7 @@ HostIFDoIoctl(struct file *filp, +@@ -3149,7 +3156,7 @@ HostIFDoIoctl(struct file *filp, */ int @@ -721,7 +770,7 @@ index 7053a83..583d6da 100644 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? +@@ -3159,14 +3166,14 @@ HostIFStartTimer(Bool rateChanged, //IN: Did rate change? int timerPeriod; if (rateChanged) { @@ -738,7 +787,7 @@ index 7053a83..583d6da 100644 slack = timerPeriod / 100; } set_current_state(TASK_INTERRUPTIBLE); -@@ -3510,7 +3519,7 @@ HostIF_MapUserMem(VA addr, // IN: User memory virtual address +@@ -3512,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", @@ -747,7 +796,7 @@ index 7053a83..583d6da 100644 newHandle->numPages = numPagesNeeded; newHandle->addr = mappedAddr; -@@ -3546,7 +3555,7 @@ HostIF_UnmapUserMem(VMMappedUserMem *handle) // IN: Handle to mapped memory +@@ -3548,7 +3555,7 @@ HostIF_UnmapUserMem(VMMappedUserMem *handle) // IN: Handle to mapped memory } printk(KERN_DEBUG "%s: numPages = %"FMTSZ"u, addr = 0x%p\n", diff --git a/vmnet.patch b/vmnet.patch index 9413d349ad81..429b57d09275 100644 --- a/vmnet.patch +++ b/vmnet.patch @@ -88,14 +88,26 @@ index 7e7ad99..5f508f6 100644 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 +index 94146f6..5298406 100644 --- a/vmnet/userif.c +++ b/vmnet/userif.c -@@ -113,12 +113,18 @@ UserifLockPage(VA addr) // IN +@@ -36,6 +36,9 @@ + #include <linux/slab.h> + #include <linux/version.h> + #include <linux/wait.h> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 99) ++#include <linux/sched/signal.h> ++#endif + + #include <net/checksum.h> + #include <net/sock.h> +@@ -113,14 +113,18 @@ UserifLockPage(VA addr) // IN int retval; down_read(¤t->mm->mmap_sem); --#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0) +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) +- retval = get_user_pages(addr, 1, FOLL_WRITE, &page, NULL); +-#elif 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, @@ -113,7 +125,7 @@ index 2b976d7..5298406 100644 up_read(¤t->mm->mmap_sem); if (retval != 1) { -@@ -182,13 +188,13 @@ VNetUserIfMapUint32Ptr(VA uAddr, // IN: pointer to user memory +@@ -184,13 +188,13 @@ VNetUserIfMapUint32Ptr(VA uAddr, // IN: pointer to user memory * * Sets up notification by filling in pollPtr, actPtr, and recvClusterCount * fields. @@ -130,7 +142,7 @@ index 2b976d7..5298406 100644 * recvClusterPage are filled in VNetUserIf structure. * *----------------------------------------------------------------------------- -@@ -278,8 +284,8 @@ VNetUserIfSetupNotify(VNetUserIF *userIf, // IN +@@ -280,8 +284,8 @@ VNetUserIfSetupNotify(VNetUserIF *userIf, // IN * VNetUserIfUnsetupNotify -- * * Destroys permanent mapping for notify structure provided by user. @@ -141,7 +153,7 @@ index 2b976d7..5298406 100644 * None. * * Side effects: -@@ -333,7 +339,7 @@ VNetUserIfUnsetupNotify(VNetUserIF *userIf) // IN +@@ -335,7 +339,7 @@ VNetUserIfUnsetupNotify(VNetUserIF *userIf) // IN * * Free the user interface port. * @@ -150,7 +162,7 @@ index 2b976d7..5298406 100644 * None. * * Side effects: -@@ -355,7 +361,7 @@ VNetUserIfFree(VNetJack *this) // IN +@@ -357,7 +361,7 @@ VNetUserIfFree(VNetJack *this) // IN } dev_kfree_skb(skb); } @@ -159,7 +171,7 @@ index 2b976d7..5298406 100644 if (userIf->pollPtr) { VNetUserIfUnsetupNotify(userIf); } -@@ -379,7 +385,7 @@ VNetUserIfFree(VNetJack *this) // IN +@@ -381,7 +385,7 @@ VNetUserIfFree(VNetJack *this) // IN * * This jack is receiving a packet. Take appropriate action. * @@ -168,7 +180,7 @@ index 2b976d7..5298406 100644 * None. * * Side effects: -@@ -395,12 +401,12 @@ VNetUserIfReceive(VNetJack *this, // IN +@@ -397,12 +401,12 @@ VNetUserIfReceive(VNetJack *this, // IN VNetUserIF *userIf = (VNetUserIF*)this->private; uint8 *dest = SKB_2_DESTMAC(skb); unsigned long flags; @@ -183,7 +195,7 @@ index 2b976d7..5298406 100644 if (!VNetPacketMatch(dest, userIf->port.paddr, (const uint8 *)userIf->port.exactFilter, -@@ -410,12 +416,12 @@ VNetUserIfReceive(VNetJack *this, // IN +@@ -412,12 +416,12 @@ VNetUserIfReceive(VNetJack *this, // IN userIf->stats.droppedMismatch++; goto drop_packet; } @@ -198,7 +210,7 @@ index 2b976d7..5298406 100644 if (skb->len > ETHER_MAX_QUEUED_PACKET) { userIf->stats.droppedLargePacket++; goto drop_packet; -@@ -439,7 +445,7 @@ VNetUserIfReceive(VNetJack *this, // IN +@@ -441,7 +445,7 @@ VNetUserIfReceive(VNetJack *this, // IN wake_up(&userIf->waitQueue); return; @@ -207,7 +219,7 @@ index 2b976d7..5298406 100644 drop_packet: dev_kfree_skb(skb); } -@@ -452,7 +458,7 @@ VNetUserIfReceive(VNetJack *this, // IN +@@ -454,7 +458,7 @@ VNetUserIfReceive(VNetJack *this, // IN * * Callback for read operation on this userif entry in vnets proc fs. * @@ -216,7 +228,7 @@ index 2b976d7..5298406 100644 * Length of read operation. * * Side effects: -@@ -471,21 +477,21 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into +@@ -473,21 +477,21 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into // read void *data) // IN: client data - not used { @@ -244,7 +256,7 @@ index 2b976d7..5298406 100644 "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 +@@ -496,7 +500,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into userIf->stats.droppedLargePacket); len += sprintf(page+len, "\n"); @@ -253,7 +265,7 @@ index 2b976d7..5298406 100644 *start = 0; *eof = 1; return len; -@@ -508,7 +514,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into +@@ -510,7 +514,7 @@ VNetUserIfProcRead(char *page, // IN/OUT: buffer to write into * * Copy part of datagram to userspace. * @@ -262,7 +274,7 @@ index 2b976d7..5298406 100644 * zero on success, * -EFAULT if buffer is an invalid area * -@@ -545,12 +551,12 @@ VNetCopyDatagram(const struct sk_buff *skb, // IN: skb to copy +@@ -547,12 +551,12 @@ VNetCopyDatagram(const struct sk_buff *skb, // IN: skb to copy * * Copy part of datagram to userspace doing checksum at same time. * @@ -277,7 +289,7 @@ index 2b976d7..5298406 100644 * 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 +@@ -574,7 +578,7 @@ VNetCsumCopyDatagram(const struct sk_buff *skb, // IN: skb to copy char *curr = buf; const skb_frag_t *frag; @@ -286,7 +298,7 @@ index 2b976d7..5298406 100644 * 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 +@@ -631,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. * @@ -295,7 +307,7 @@ index 2b976d7..5298406 100644 * On success byte count, on failure -EFAULT. * * Side effects: -@@ -658,7 +664,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN +@@ -660,7 +664,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN size_t skl; int csum; u_int16_t csum16; @@ -304,7 +316,7 @@ index 2b976d7..5298406 100644 skl = compat_skb_csum_start(skb); if (VNetCopyDatagram(skb, buf, skl)) { return -EFAULT; -@@ -689,7 +695,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN +@@ -691,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. * @@ -313,7 +325,7 @@ index 2b976d7..5298406 100644 * 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 +@@ -702,7 +706,7 @@ VNetCopyDatagramToUser(const struct sk_buff *skb, // IN *---------------------------------------------------------------------- */ @@ -322,7 +334,7 @@ index 2b976d7..5298406 100644 VNetUserIfRead(VNetPort *port, // IN struct file *filp, // IN char *buf, // OUT -@@ -768,7 +774,7 @@ VNetUserIfRead(VNetPort *port, // IN +@@ -770,7 +774,7 @@ VNetUserIfRead(VNetPort *port, // IN * The virtual network's write file operation. Send the raw packet * to the network. * @@ -331,7 +343,7 @@ index 2b976d7..5298406 100644 * On success the count of bytes written else errno. * * Side effects: -@@ -777,7 +783,7 @@ VNetUserIfRead(VNetPort *port, // IN +@@ -779,7 +783,7 @@ VNetUserIfRead(VNetPort *port, // IN *---------------------------------------------------------------------- */ @@ -340,7 +352,7 @@ index 2b976d7..5298406 100644 VNetUserIfWrite(VNetPort *port, // IN struct file *filp, // IN const char *buf, // IN -@@ -789,8 +795,8 @@ VNetUserIfWrite(VNetPort *port, // IN +@@ -791,8 +795,8 @@ VNetUserIfWrite(VNetPort *port, // IN /* * Check size */ @@ -351,7 +363,7 @@ index 2b976d7..5298406 100644 count > ETHER_MAX_QUEUED_PACKET) { return -EINVAL; } -@@ -807,25 +813,25 @@ VNetUserIfWrite(VNetPort *port, // IN +@@ -809,25 +813,25 @@ VNetUserIfWrite(VNetPort *port, // IN /* * Allocate an sk_buff. */ @@ -382,7 +394,7 @@ index 2b976d7..5298406 100644 VNetSend(&userIf->port.jack, skb); return count; -@@ -839,7 +845,7 @@ VNetUserIfWrite(VNetPort *port, // IN +@@ -841,7 +845,7 @@ VNetUserIfWrite(VNetPort *port, // IN * * XXX * @@ -391,7 +403,7 @@ index 2b976d7..5298406 100644 * 0 on success * -errno on failure * -@@ -862,8 +868,8 @@ VNetUserIfIoctl(VNetPort *port, // IN +@@ -864,8 +868,8 @@ VNetUserIfIoctl(VNetPort *port, // IN return -EINVAL; case SIOCSETNOTIFY2: #ifdef VMX86_SERVER @@ -402,7 +414,7 @@ index 2b976d7..5298406 100644 * 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 +@@ -908,20 +912,20 @@ VNetUserIfIoctl(VNetPort *port, // IN break; case SIOCSIFFLAGS: @@ -428,7 +440,7 @@ index 2b976d7..5298406 100644 spin_lock_irqsave(&q->lock, flags); if (userIf->pollPtr) { if (skb_queue_empty(q)) { -@@ -936,11 +942,11 @@ VNetUserIfIoctl(VNetPort *port, // IN +@@ -938,11 +942,11 @@ VNetUserIfIoctl(VNetPort *port, // IN case SIOCINJECTLINKSTATE: { uint8 linkUpFromUser; @@ -442,7 +454,7 @@ index 2b976d7..5298406 100644 if (linkUpFromUser != 0 && linkUpFromUser != 1) { return -EINVAL; } -@@ -952,7 +958,7 @@ VNetUserIfIoctl(VNetPort *port, // IN +@@ -954,7 +958,7 @@ VNetUserIfIoctl(VNetPort *port, // IN return -ENOIOCTLCMD; break; } @@ -451,7 +463,7 @@ index 2b976d7..5298406 100644 return 0; } -@@ -964,7 +970,7 @@ VNetUserIfIoctl(VNetPort *port, // IN +@@ -966,7 +970,7 @@ VNetUserIfIoctl(VNetPort *port, // IN * * The virtual network's file poll operation. * @@ -460,7 +472,7 @@ index 2b976d7..5298406 100644 * Return POLLIN if success, else sleep and return 0. * FIXME: Should not we always return POLLOUT? * -@@ -980,7 +986,7 @@ VNetUserIfPoll(VNetPort *port, // IN +@@ -982,7 +986,7 @@ VNetUserIfPoll(VNetPort *port, // IN poll_table *wait) // IN { VNetUserIF *userIf = (VNetUserIF*)port->jack.private; @@ -469,7 +481,7 @@ index 2b976d7..5298406 100644 poll_wait(filp, &userIf->waitQueue, wait); if (!skb_queue_empty(&userIf->packetQueue)) { return POLLIN; -@@ -995,8 +1001,8 @@ VNetUserIfPoll(VNetPort *port, // IN +@@ -997,8 +1001,8 @@ VNetUserIfPoll(VNetPort *port, // IN * VNetUserIfSetUplinkState -- * * Sends link state change event. @@ -480,7 +492,7 @@ index 2b976d7..5298406 100644 * 0 on success, errno on failure. * * Side effects: -@@ -1038,7 +1044,7 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp) +@@ -1040,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; @@ -489,7 +501,7 @@ index 2b976d7..5298406 100644 * 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) +@@ -1065,8 +1069,8 @@ VNetUserIfSetUplinkState(VNetPort *port, uint8 linkUp) * * Create a user level port to the wonderful world of virtual * networking. @@ -500,7 +512,7 @@ index 2b976d7..5298406 100644 * Errno. Also returns an allocated port to connect to, * NULL on error. * -@@ -1080,7 +1086,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT +@@ -1082,7 +1086,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT VNetUserIF *userIf; static unsigned id = 0; int retval; @@ -509,7 +521,7 @@ index 2b976d7..5298406 100644 userIf = kmalloc(sizeof *userIf, GFP_USER); if (!userIf) { return -ENOMEM; -@@ -1089,7 +1095,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT +@@ -1091,7 +1095,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT /* * Initialize fields. */ @@ -518,7 +530,7 @@ index 2b976d7..5298406 100644 userIf->port.id = id++; userIf->port.jack.peer = NULL; -@@ -1134,7 +1140,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT +@@ -1136,7 +1140,7 @@ VNetUserIf_Create(VNetPort **ret) // OUT /* * Rest of fields. */ @@ -527,7 +539,7 @@ index 2b976d7..5298406 100644 userIf->port.flags = IFF_RUNNING; memset(userIf->port.paddr, 0, sizeof userIf->port.paddr); -@@ -1147,12 +1153,12 @@ VNetUserIf_Create(VNetPort **ret) // OUT +@@ -1149,12 +1153,12 @@ VNetUserIf_Create(VNetPort **ret) // OUT userIf->port.fileOpWrite = VNetUserIfWrite; userIf->port.fileOpIoctl = VNetUserIfIoctl; userIf->port.fileOpPoll = VNetUserIfPoll; diff --git a/vmware-workstation.install b/vmware-workstation.install new file mode 100644 index 000000000000..51ffcf879d64 --- /dev/null +++ b/vmware-workstation.install @@ -0,0 +1,8 @@ +post_install() { + cat << EOF + +Before using VMware, you will need to enable some services. +For example: systemctl enable --now vmware-hostd.service vmware-networks.service vmware-usbarbitrator.service + +EOF +} diff --git a/vsock.patch b/vsock.patch index 9617ff200bdd..e6e341c58a34 100644 --- a/vsock.patch +++ b/vsock.patch @@ -32,6 +32,28 @@ 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 +@@ -113,6 +113,9 @@ + asmlinkage __attribute__((weak)) long + sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg); + #endif ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 99) ++#include <linux/sched/signal.h> ++#endif + + #include "compat_cred.h" + #include "compat_module.h" +@@ -212,7 +215,11 @@ + struct sockaddr *addr, int addrLen, int flags); + static int VSockVmciStreamConnect(struct socket *sock, + struct sockaddr *addr, int addrLen, int flags); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + static int VSockVmciAccept(struct socket *sock, struct socket *newsock, int flags); ++#else ++static int VSockVmciAccept(struct socket *sock, struct socket *newsock, int flags, bool kern); ++#endif + static int VSockVmciGetname(struct socket *sock, + struct sockaddr *addr, int *addrLen, int peer); + static unsigned int VSockVmciPoll(struct file *file, @@ -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); @@ -83,6 +105,19 @@ index bde1497..9f8f843 100644 sk = sk_alloc(vsockVmciFamilyOps.family, priority, vsockVmciProto.slab_obj_size, vsockVmciProto.slab); #elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) +@@ -3775,7 +3805,12 @@ + static int + VSockVmciAccept(struct socket *sock, // IN + struct socket *newsock, // IN/OUT ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) + int flags) // IN ++#else ++ int flags, // IN ++ bool kern) ++#endif + { + struct sock *listener; + int err; @@ -4210,7 +4233,11 @@ VSockVmciShutdown(struct socket *sock, // IN */ |