[llvm-dev] Success : clang/LLVM-built host kernel and clang-built VMware kernel modules for VMware Player 14.1.1 on host Ubuntu 17.10 x86_64

Raghavan Santhanam via llvm-dev llvm-dev at lists.llvm.org
Sat Apr 7 17:05:43 PDT 2018


Hello All,

As part of my clang/LLVM experiments and explorations with different
clang-built kernel versions, I have tried to bring up other Linux/Ubuntu
applications with their kernel modules also being clang-built. One such
case has been with VMware Player 14.1.1. I am sharing this report for
interested people that highlights my research and success in overcoming and
solving the challenges in installing and running VMware Player
14.1.1(x86_64) on Ubuntu 17.10 x86_64 with clang-built VMware kernel
modules(vmmon and vmnet) on clang-built host kernel 4.16(latest stable as
of now).

For my earlier report on successful bringup of clang-built kernel for
Ubuntu 17.10 x86_64 along with clang-built Nvidia driver(v390.25, v390.42,
etc), you can read that here : Success : Ubuntu 17.10 x86_64 on
LLVM/clang-built kernel with Nvidia 390.25 driver
<https://ubuntuforums.org/showthread.php?t=2386423>


Cheers

------------------------------



*Stage 1 :* Installed VMware Player 14.1.1 using
VMware-Player-14.1.1-7528167.x86_64.bundle. The GUI installer showed
"Installation was successful..". But, when I tried to run "vmplayer" from
command-line, it led to a segfault/crash as under.


Code:

Segmentation fault      (core dumped) "$BINDIR"/vmware-modconfig
--appname="VMware Player" --icon="vmware-player"

It was not clear as to what actually went wrong - was it some installer's
internal silent failure that went unnoticed or kernel modules were not
successfully built/installed/loaded or was it some compatibility issue of
VMware Player with underlying host clang-built kernel and not gcc-built
kernel. So, I manually built vmmon and vmnet from
/usr/lib/vmware/modules/source/(vmmon|vmnet).tar using clang/LLVM compiler
itself as the host Linux kernel 4.16.0 was clang-built as well. After
successfully building it, installing it and loading them and verifying them
that thay are correctly loaded(lsmod, etc), I reran "vmplayer" command - it
again failed with the same "segfault" as shown above.


Code:

exp at exp:~$
exp at exp:~$
exp at exp:~$ cat /proc/version
Linux version 4.16.0 (exp at exp) (clang version 5.0.0-3
(tags/RELEASE_500/final)) #4 SMP Thu Apr 5 02:12:22 PDT 2018
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$
exp at exp:~$ lsmod | grep "vmnet\|vmmon"
vmnet                  53248  13
vmmon                  90112  0
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$ vmplayer --version
.
.
VMware Player 14.1.1 build-7528167
exp at exp:~$


exp at exp:~$
exp at exp:~$ vmplayer
+ /usr/bin/vmware-modconfig '--appname=VMware Player' --icon=vmware-player
/usr/bin/vmplayer: line 109:  1467 Segmentation fault      (core
dumped) "$BINDIR"/vmware-modconfig --appname="VMware Player"
--icon="vmware-player"
+ exit 1
exp at exp:~$

*Stage 2 :* I tried to use gdb invidually with vmware-config/vmplayer
binary to look at the failing point in their code. Running gdb on
/usr/bin/vmware-config and /usr/bin/vmplayer is useless as they are just
scripts and running directly on their binary counterparts : "gdb --args
/usr/lib/vmware/bin/vmware-modconfig --appname="VMware Player"
--icon="vmware-player" and "gdb /usr/lib/vmware/bin/vmplayer", didn't
result in any segfault/crash either. So, I had to invoke a gdb-session as
part of /usr/bin/vmware-config itself while it launches
/usr/lib/vmware/bin/vmware-modconfig --appname="VMware Player"
--icon="vmware-player" within itself and that worked and I saw
ModConf_NewKernelInfo() within libvmware-modconfig.so was trying to get
current kernel version information and while doing so or parsing the
version information after getting it, it segfault-ed.


Code:

exp at exp:~$
exp at exp:~$ vmplayer
GNU gdb (Ubuntu 8.0.1-0ubuntu1) 8.0.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/vmware/bin/vmware-modconfig...(no
debugging symbols found)...done.
(gdb) r
Starting program: /usr/lib/vmware/bin/vmware-modconfig
--launcher=/usr/bin/vmware-modconfig --appname=VMware Player
--icon=vmware-player
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 24600 is executing new program: /usr/lib/vmware/bin/appLoader
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe4b15700 (LWP 24633)]
[New Thread 0x7fffdffff700 (LWP 24634)]


Thread 1 "vmware-modconfi" received signal SIGSEGV, Segmentation fault.
0x00007ffff73312e8 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff73312e8 in  () at /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff674d72b in ModConf_NewKernelInfo () at
/usr/lib/vmware/lib/libvmware-modconfig.so/libvmware-modconfig.so
#2  0x00007ffff6749540 in main () at
/usr/lib/vmware/lib/libvmware-modconfig.so/libvmware-modconfig.so
#3  0x000055555556db6b in  ()
#4  0x0000555555569fd7 in main ()

*Stage 3 :* I used strace on vmware-modconfig to get further in the
direction of the kernel version retrieval/parsing which is resulting in
crash. It turned out that, the above crash is likely related to parsing of
the content of "/proc/version".


Code:

exp at exp:~$
exp at exp:~$ strace /usr/bin/vmware-modconfig --appname="VMware Player"
--icon="vmware-player" 2>&1 | tail
write(10, "2018-04-07T00:16:17.901-07:00| v"..., 89) = 89
openat(AT_FDCWD, "/proc/version", O_RDONLY) = 11
fstat(11, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
fcntl(11, F_GETFL)                      = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(11, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(11, "Linux version 4.16.0 (exp at exp) (clan"..., 4096) = 111
read(11, "", 3072)                      = 0
close(11)                               = 0
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---
+++ killed by SIGSEGV (core dumped) +++
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$ cat /tmp/vmware-g/vmware-17594.log
2018-04-07T00:16:17.768-07:00| vthread-1| I125: Log for VMware
Workstation pid=17594 version=14.1.1 build=build-7528167
option=Release
2018-04-07T00:16:17.768-07:00| vthread-1| I125: The process is 64-bit.
2018-04-07T00:16:17.768-07:00| vthread-1| I125: Host codepage=UTF-8
encoding=UTF-8
2018-04-07T00:16:17.768-07:00| vthread-1| I125: Host is Linux 4.16.0
Ubuntu 17.10
2018-04-07T00:16:17.768-07:00| vthread-1| I125: DictionaryLoad: Cannot
open file "/usr/lib/vmware/settings": No such file or directory.
2018-04-07T00:16:17.768-07:00| vthread-1| I125:
[msg.dictionary.load.openFailed] Cannot open file
"/usr/lib/vmware/settings": No such file or directory.
2018-04-07T00:16:17.768-07:00| vthread-1| I125: PREF Optional
preferences file not found at /usr/lib/vmware/settings. Using default
values.
2018-04-07T00:16:17.768-07:00| vthread-1| I125: DictionaryLoad: Cannot
open file "/home/g/.vmware/config": No such file or directory.
2018-04-07T00:16:17.768-07:00| vthread-1| I125:
[msg.dictionary.load.openFailed] Cannot open file
"/home/g/.vmware/config": No such file or directory.
2018-04-07T00:16:17.768-07:00| vthread-1| I125: PREF Optional
preferences file not found at /home/g/.vmware/config. Using default
values.
2018-04-07T00:16:17.813-07:00| vthread-1| W115: Logging to
/tmp/vmware-g/vmware-17594.log
2018-04-07T00:16:17.901-07:00| vthread-1| I125: Obtaining info using
the running kernel.
exp at exp:~$

*Stage 4 :* After looking at the strace and gdb specific information from
the above stages, I thought of running the usually suggested
"vmware-modconfig --console --install-all" to fix any VMware kernel modules
issue, since I didn't have the source code of /usr/lib/vmware/lib/
libvmware-modconfig.so/libvmware-modconfig.so to debug further for finding
what's with the kernel version information(/proc/version, etc) determining
and parsing method within ModConf_NewKernelInfo() of
libvmware-modconfig.so. It also segfault-ed as I expected since it involves
the same vmware-modconfig*.


Code:

exp at exp:~$
exp at exp:~$ sudo vmware-modconfig --console --install-all
[AppLoader] GLib does not have GSettings support.
Segmentation fault
exp at exp:~$


*Stage 5 : *Going one step further, I spent time on the output of "cat
/proc/version" - one thing that I paid attention to was the compiler
information of the compiler used to build kernel. That was the
hitting-the-nail-on-its-head moment! I understood that VMware Player
config/scripts probably assumes underlying host Linux kernel is built using
some gcc-* version compiler and expects the output of "cat /proc/version"
to have some "gcc ..." and if it doesn't find that(in this case, it's
"clang..." as that's the compiler used for building host kernel), it
doesn't seem to report any error/warning and simply segfaults - probably
due to a NULL(from substring search on output of "cat /proc/version" for
"gcc...") dereference.


Below is what seems to be happening within "vmware-modconfig" and/or
internal programs/scripts :


Code:

##
## My visualization of crash(SIGSEGV) case when compiler used to build
kernel is clang-*/LLVM :
##
## == Likely a dereferencing of NULL similar to the below case ==
##


const char *gcc_ver = strstr("Linux version 4.16.0 (exp at exp) (clang
version 5.0.0-3 (tags/RELEASE_500/final)) #4 SMP Thu Apr 5 02:12:22
PDT 2018", "gcc...");
if (strcmp(gcc_ver, "gcc...") == 0) { // Here, there's no check on gcc_ver to be
                                       // non-NULL - since it's likely
that the compiler used to build the kernel
                       // is *assumed* to be always some gcc and so
on. Probably, it's not designed to work
                       // work with clang/LLVM if the compiler used to
build kernel is clang/LLVM.
         .
         .
         .
         .
}


##
##  My visualization of working case when compiler used to build
kernel is gcc-* :
##


const char *gcc_ver = strstr("Linux version 4.16.0 (exp at exp) (gcc
version 7.3.0 (Ubuntu 7.3.0-8ubuntu3)) #4 SMP Thu Apr 5 02:12:22 PDT
2018", "gcc...");
if (strcmp(gcc_ver, "gcc...") == 0) { // Works as always
         .
         .
         .
         .
}

*Stage 6 :* For the sake of VMware Player configuration script check,
modified linux-4.16/fs/proc/version.c to report GCC 7.3.0 on a *need*
basis, as the Linux compiler used to build the current kernel(4.16) instead
of the actual clang/LLVM compiler used in building the current
kernel(4.16). This took past the "vmplayer" invocation past the point where
it would segfault otherwise since the compiler information in /proc/version
not being gcc-specific but clang-specific! This confirmed that my
understanding and interpretation of VMware Player config/script being
incapable of correctly translating the clang-compiler information in
/proc/version into the actual clang/LLVM compiler used to build the
underlying host kernel and hence the unexpected SIGSEGV/segfault.


Code:

exp at exp:~$
exp at exp:~$ eclang /lib/modules/4.16.0/build/vmlinux | head -1
++ strings -a /lib/modules/4.16.0/build/vmlinux
++ grep 'clang version'
Linux version 4.16.0 (exp at exp) (clang version 5.0.0-3
(tags/RELEASE_500/final)) #4 SMP Thu Apr 5 02:12:22 PDT 2018
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$ egcc /lib/modules/4.16.0/build/vmlinux
++ strings -a /lib/modules/4.16.0/build/vmlinux
++ grep 'GCC: ('
exp at exp:~$
exp at exp:~$


###
### [procfs] - version logic updated.
###


exp at exp:~$
exp at exp:~$
exp at exp:~$ cat /proc/version
Linux version 4.16.0 (exp at exp) (gcc version 7.3.0 (Ubuntu
7.3.0-8ubuntu3)) #4 SMP Thu Apr 5 02:12:22 PDT 2018
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$
exp at exp:~$ strace /usr/bin/vmware-modconfig --appname="VMware Player"
--icon="vmware-player" 2>&1 | grep -A 40 -B 1 "/proc/version"
write(10, "2018-04-07T00:37:09.944-07:00| v"..., 89) = 89
openat(AT_FDCWD, "/proc/version", O_RDONLY) = 11
fstat(11, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
fcntl(11, F_GETFL)                      = 0x8000 (flags O_RDONLY|O_LARGEFILE)
fstat(11, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(11, "Linux version 4.16.0 (exp at exp) (gcc "..., 4096) = 106
read(11, "", 3072)                      = 0
close(11)                               = 0
write(10, "2018-04-07T00:37:09.944-07:00| v"..., 71) = 71
access("/sbin/gcc-7.3", X_OK)           = -1 ENOENT (No such file or directory)
access("/home/g/CodeSourcery/Sourcery_G++_Lite/bin/gcc-7.3", X_OK) =
-1 ENOENT (No such file or directory)
access("/home/g/bin/gcc-7.3", X_OK)     = -1 ENOENT (No such file or directory)
access("/home/g/.local/bin/gcc-7.3", X_OK) = -1 ENOENT (No such file
or directory)
access("/usr/local/sbin/gcc-7.3", X_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/bin/gcc-7.3", X_OK)  = -1 ENOENT (No such file or directory)
access("/usr/sbin/gcc-7.3", X_OK)       = -1 ENOENT (No such file or directory)
access("/usr/bin/gcc-7.3", X_OK)        = -1 ENOENT (No such file or directory)
access("/sbin/gcc-7.3", X_OK)           = -1 ENOENT (No such file or directory)
access("/bin/gcc-7.3", X_OK)            = -1 ENOENT (No such file or directory)
access("/usr/games/gcc-7.3", X_OK)      = -1 ENOENT (No such file or directory)
access("/usr/local/games/gcc-7.3", X_OK) = -1 ENOENT (No such file or directory)
access("/snap/bin/gcc-7.3", X_OK)       = -1 ENOENT (No such file or directory)
access("/usr/lib/jvm/java-8-oracle/bin/gcc-7.3", X_OK) = -1 ENOENT (No
such file or directory)
access("/usr/lib/jvm/java-8-oracle/db/bin/gcc-7.3", X_OK) = -1 ENOENT
(No such file or directory)
access("/usr/lib/jvm/java-8-oracle/jre/bin/gcc-7.3", X_OK) = -1 ENOENT
(No such file or directory)
access("/sbin/gcc-7", X_OK)             = -1 ENOENT (No such file or directory)
access("/home/g/CodeSourcery/Sourcery_G++_Lite/bin/gcc-7", X_OK) = -1
ENOENT (No such file or directory)
access("/home/g/bin/gcc-7", X_OK)       = -1 ENOENT (No such file or directory)
access("/home/g/.local/bin/gcc-7", X_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/sbin/gcc-7", X_OK)   = -1 ENOENT (No such file or directory)
access("/usr/local/bin/gcc-7", X_OK)    = -1 ENOENT (No such file or directory)
access("/usr/sbin/gcc-7", X_OK)         = -1 ENOENT (No such file or directory)
access("/usr/bin/gcc-7", X_OK)          = 0
getuid()                                = 1000
stat("/usr/bin/gcc-7", {st_mode=S_IFREG|0755, st_size=287, ...}) = 0
access("/usr/bin/gcc-7", X_OK)          = 0
getuid()                                = 1000
write(10, "2018-04-07T00:37:09.944-07:00| v"..., 119) = 119
exp at exp:~$
exp at exp:~$

*Stage 7 :* With the above update to /proc/version(fs/proc/version.c) to
show gcc-* on a *need* basis, "vmplayer" would no longer segfault/crash -
but, was using gcc(7.3.0) to build VMware kernel modules(vmnet and vmmon)
which was of course "expected" as that was what was in /proc/version - I
did *not* want this - I wanted clang/LLVM to be used for building VMware
kernel modules like I have done the same for other kernel modules(Nvidia
driver, VirtualBox, etc) that are working without any issues. Simply put, I
want both underlying kernel and all the kernel modules to be built by
clang/LLVM and *not* gcc.


I observed that VMware configuration script performs a "preprocessor check"
with the determined compiler(gcc-7.3.0 in this case) And that command looks
like :


Code:

"/usr/bin/gcc-7 -E -I/lib/modules/4.16.0/build/include - ...."

Once that's complete and succeeds, it moves onto check if it's needed to
build VMware kernel modules - vmnet and vmmon.


*Stage 8 :* Manually the VMware kernel modules(from source : vmmon.tar and
vmnet.tar) can be built with clang/LLVM and I have built them(with any
needed patches for hostif.c(vmmon-only) and bridge.c(vmnet-only),
installed, and used it without any issues by invoking
/usr/lib/vmware/bin/vmplayer directly. But, when invoking VMware player by
just "vmplayer" or by clicking on "VMware Player" icon from app menu/list,
vmware-modconfig performs the checks on the compiler and its version used
to build the current kernel and then checks if VMware kernel modules are
built and loaded, before launching finally "vmplayer". And the
compiler-check that vmware-modconfig does, doesn't seem to work if the
compiler(as shown by /proc/version) is clang/LLVM instead of gcc as shown
above.


Code:

exp at exp:~$
exp at exp:~$ ~/vmware_modules_compiler.sh
++ eclang /lib/modules/4.16.0/misc/vmmon.ko
++ head -1
+++ strings -a /lib/modules/4.16.0/misc/vmmon.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
++ eclang /lib/modules/4.16.0/misc/vmnet.ko
++ head -1
+++ strings -a /lib/modules/4.16.0/misc/vmnet.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$ ~/vmware_modules_metadata.sh
++ strings -a /lib/modules/4.16.0/misc/vmnet.ko
++ grep VMware
author=VMware, Inc.
description=VMware Virtual Networking Driver.
++ strings -a /lib/modules/4.16.0/misc/vmmon.ko
++ grep VMware
author=VMware, Inc.
description=VMware Virtual Machine Monitor.
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$
exp at exp:~$ lsmod | grep "vmnet\|vmmon"
vmnet                  53248  13
vmmon                  90112  0
exp at exp:~$
exp at exp:~$

*Stage 9 :* With the above understanding how VMware config/script performs
initial "preprocessor check" with the compiler determined to be gcc-7(.3.0)
and how subsequent invocations happen for building the VMware kernel
modules, I worked upon the compiler invocation logic for both the instances
by vmware-modconfig script/program :




   1. First to perform "preprocessor check" with the actual gcc(7.3.0)
   compiler itself.
   2. Second and for all the subsequent invocation of compiler with
   clang/LLVM instead of gcc 7.3.0 - to have VMware kernel modules to be built
   with clang/LLVM itself like the underlying host kernel.


*Stage 10 :* With that, I was able to completely automate the whole VMware
Player installation, first invocation, configuration, and overall setup
with clang-built(via installer itself) VMware kernel modules on underlying
host clang-built Linux 4.16.0 kernel.


Code:

##
## Compact log of VMware kernel modules built using clang/LLVM instead
of gcc, automatically by vmware-* config/scripts
##


## NOTE : Needed to run "vmplayer" as root(sudo) for (only) the first
time for building kernel modules and install them.
## Normal user mode didn't go beyond the start of "VMware kernel
modules build..." step.


exp at exp:~$
exp at exp:~$
exp at exp:~$ sudo vmplayer
Stopping VMware services:
   VMware Authentication Daemon                                        done
   VM communication interface socket family                            done
   Virtual machine communication interface                             done
   Virtual machine monitor                                             done
   Blocking file system                                                done
make: Entering directory '/tmp/modconfig-sImz9k/vmmon-only'
Using kernel build system.
/usr/bin/make -C /lib/modules/4.16.0/build/include/.. SUBDIRS=$PWD
SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/media/exp/ext/linux-4.16'
+ /usr/bin/clang -print-file-name=include
  CC [M]  /tmp/modconfig-sImz9k/vmmon-only/linux/driverLog.o
    .
    .
++ /usr/bin/clang
-Wp,-MD,/tmp/modconfig-sImz9k/vmmon-only/linux/.hostif.o.d -nostdinc
-isystem /usr/lib/llvm-5.0/lib/clang/5.0.0/include
-I./arch/x86/include -I./arch/x86/include/generated -I./include
-I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/kconfig.h -D__KERNEL__ -DCONFIG_CC_STACKPROTECTOR
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -fshort-wchar -Werror-implicit-function-declaration
-Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2
-mno-3dnow -mno-avx -m64 -mno-80387 -mstack-alignment=8 -mtune=generic
-mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_X86_X32_ABI
-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
-DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1
-DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1
-DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -O2 -Wframe-larger-than=1024
-fstack-protector-strong -Wno-unused-const-variable -g -gdwarf-4 -pg
-mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants
-fno-stack-check -Werror=implicit-int -Werror=strict-prototypes
-Werror=date-time -Werror=incompatible-pointer-types -Wall
-Wstrict-prototypes -DVMW_USING_KBUILD -DVMMON -DVMCORE
-I/tmp/modconfig-sImz9k/vmmon-only/./include
-I/tmp/modconfig-sImz9k/vmmon-only/./common
-I/tmp/modconfig-sImz9k/vmmon-only/./linux
-I/tmp/modconfig-sImz9k/vmmon-only/./vmcore -DMODULE
'-DKBUILD_BASENAME="hostif"' '-DKBUILD_MODNAME="vmmon"' -c -o
/tmp/modconfig-sImz9k/vmmon-only/linux/.tmp_hostif.o
/tmp/modconfig-sImz9k/vmmon-only/linux/hostif.c
    .
    .
    .
    .
    .
    .
 LD [M]  /tmp/modconfig-sImz9k/vmmon-only/vmmon.ko
make[1]: Leaving directory '/media/exp/ext/linux-4.16'
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[1]: Entering directory '/tmp/modconfig-sImz9k/vmmon-only'
make[1]: 'postbuild' is up to date.
make[1]: Leaving directory '/tmp/modconfig-sImz9k/vmmon-only'
cp -f vmmon.ko ./../vmmon.o
make: Leaving directory '/tmp/modconfig-sImz9k/vmmon-only'
make: Entering directory '/tmp/modconfig-sImz9k/vmnet-only'
Using kernel build system.
/usr/bin/make -C /lib/modules/4.16.0/build/include/.. SUBDIRS=$PWD
SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/media/exp/ext/linux-4.16'
+ /usr/bin/clang -print-file-name=include
  CC [M]  /tmp/modconfig-sImz9k/vmnet-only/driver.o
    .
    .
    .
++ /usr/bin/clang -Wp,-MD,/tmp/modconfig-sImz9k/vmnet-only/.bridge.o.d
-nostdinc -isystem /usr/lib/llvm-5.0/lib/clang/5.0.0/include
-I./arch/x86/include -I./arch/x86/include/generated -I./include
-I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi
-I./include/uapi -I./include/generated/uapi -include
./include/linux/kconfig.h -D__KERNEL__ -DCONFIG_CC_STACKPROTECTOR
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -fshort-wchar -Werror-implicit-function-declaration
-Wno-format-security -std=gnu89 -fno-PIE -mno-sse -mno-mmx -mno-sse2
-mno-3dnow -mno-avx -m64 -mno-80387 -mstack-alignment=8 -mtune=generic
-mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_X86_X32_ABI
-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
-DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1
-DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1
-DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -O2 -Wframe-larger-than=1024
-fstack-protector-strong -Wno-unused-const-variable -g -gdwarf-4 -pg
-mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fno-merge-all-constants
-fno-stack-check -Werror=implicit-int -Werror=strict-prototypes
-Werror=date-time -Werror=incompatible-pointer-types -Wall
-Wstrict-prototypes -DVMW_USING_KBUILD
-I/tmp/modconfig-sImz9k/vmnet-only/. -DVMW_NETIF_TRANS_UPDATE -DMODULE
'-DKBUILD_BASENAME="bridge"' '-DKBUILD_MODNAME="vmnet"' -c -o
/tmp/modconfig-sImz9k/vmnet-only/.tmp_bridge.o
/tmp/modconfig-sImz9k/vmnet-only/bridge.c
    .
    .
    .
    .
    .
    .
  LD [M]  /tmp/modconfig-sImz9k/vmnet-only/vmnet.ko
make[1]: Leaving directory '/media/exp/ext/linux-4.16'
/usr/bin/make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[1]: Entering directory '/tmp/modconfig-sImz9k/vmnet-only'
make[1]: 'postbuild' is up to date.
make[1]: Leaving directory '/tmp/modconfig-sImz9k/vmnet-only'
cp -f vmnet.ko ./../vmnet.o
make: Leaving directory '/tmp/modconfig-sImz9k/vmnet-only'
Starting VMware services:
   Virtual machine monitor                                             done
   Virtual machine communication interface                             done
   VM communication interface socket family                            done
   Blocking file system                                                done
   Virtual ethernet                                                    done
   VMware Authentication Daemon                                        done
   Shared Memory Available                                             done
.
.




exp at exp:~$
exp at exp:~$  ls -lrt /lib/modules/4.16.0/misc/vm*.ko
-rw-r--r-- 1 root root 2597952 Apr  7 01:55 /lib/modules/4.16.0/misc/vmmon.ko
-rw-r--r-- 1 root root 2614432 Apr  7 01:55 /lib/modules/4.16.0/misc/vmnet.ko
exp at exp:~$


exp at exp:~$
exp at exp:~$ ~/vmware_modules_compiler.sh
++ eclang /lib/modules/4.16.0/misc/vmmon.ko
++ head -1
+++ strings -a /lib/modules/4.16.0/misc/vmmon.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
++ eclang /lib/modules/4.16.0/misc/vmnet.ko
++ head -1
+++ strings -a /lib/modules/4.16.0/misc/vmnet.ko
+++ grep 'clang version'
clang version 5.0.0-3 (tags/RELEASE_500/final)
exp at exp:~$
exp at exp:~$


exp at exp:~$
exp at exp:~$ ~/vmware_modules_metadata.sh
++ strings -a /lib/modules/4.16.0/misc/vmnet.ko
++ grep VMware
author=VMware, Inc.
description=VMware Virtual Networking Driver.
++ strings -a /lib/modules/4.16.0/misc/vmmon.ko
++ grep VMware
author=VMware, Inc.
description=VMware Virtual Machine Monitor.
exp at exp:~$
exp at exp:~$


##
## Subsequent invocation of "vmplayer" as usual(without any root/sudo usage).
##


exp at exp:~$
exp at exp:~$ vmplayer
+ /usr/bin/vmware-modconfig '--appname=VMware Player' --icon=vmware-player
+ vmware_module_exists vmmon
+ modalias=vmmon
+ /sbin/modprobe -n vmmon
+ set +x


exp at exp:~$
exp at exp:~$ vmplayer --version
.
.
VMware Player 14.1.1 build-7528167
exp at exp:~$


exp at exp:~$
exp at exp:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.10
Release:    17.10
Codename:   artful
exp at exp:~$
exp at exp:~$


*Installed VMware Player version after all of the above steps :*
<https://i.stack.imgur.com/bAUyH.png>


*VMware Player guest - Ubuntu 17.10 x86_64 - Successfully running in thus
installed VMware Player :*
<https://i.stack.imgur.com/DlnHK.png>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180407/aa33ce85/attachment-0001.html>


More information about the llvm-dev mailing list