On 10/01/2014 19:21, Giovanni Mariani wrote:
> On 10/01/14 14:13, Nicolò Costanza wrote:
>> Source:
>> VMware and Kernel issues, how to fix with kernel >= 3.12
>> http://mib.pianetalinux.org/forum/viewtopic.php?f=38&t=4339
>> Nowdays the Virtualization is very used in the professional and programming 
>> / testing software areas.
>> VMware is the greatest virtualization software producer, with a lot of 
>> different applications.
>> In the user field the most used software are: the commercial vmware 
>> Workstation and the free VMware Player.
>> The most recent version are: VMware Workstation 10 (10.0.1), VMware Player 6 
>> (6.0.1)
>> When a new kernel is prepared, I try to assure a full compatibility with 
>> these VMware products. 
>> Since Kernel 3.12, I have noticed that something should be wrong, vmware 
>> does not build properly its modules.
>> Me and GvM use vmplayer for our testing VMs, so we started immediately to 
>> search for the culprit and a solution / workaround.
>> After some reasearches we found the culprit in a new kernel option that is 
>> present since 3.12:
>> when CONFIG_UIDGID_STRICT_TYPE_CHECKS is enabled, VMware can not build 
>> modules
>> and here there is a topic:
>> https://communities.vmware.com/message/2328693
>> We discovered that since 3.12 enabling NAMESPACES automatically enables, in 
>> a mandatory way: CONFIG_UIDGID_STRICT_TYPE_CHECKS key,
>> so it's not more possible to disable it without disabling also the important 
>> NAMESPACES features.
>> We did not find any official and/or unofficial patch, coming from the VMware 
>> Community...
>> The first workaround attempt is preparing proper kernel with NAMESPACES and 
>> UIDGID disabled
>> Kernel 3.12.6: test version with fixes for VMware / VBox 
>> http://mib.pianetalinux.org/forum/viewtopic.php?f=38&t=4336
>> and from our test, this works, but so we must disable NAMESPACES, 
>> and we prefer to search for a different viable approach without disabling...
>> ------------------
>> Proposed MIB solution without any Kernel limitation (dropping none feature)
>> Finally GvM succeed to fix the problem directly into the
>>  VMware code:
>> http://mib.pianetalinux.org/MIB/rosa2012.1/others/vmware-kernel312/
>> and here you could download and replace fixed vmci.tar and vsock.tar
>> the path where to replace is > /usr/lib/vmware/modules/source/
>> it's safer to make a backup of the original /source folder contents
>> in our PCs, were we tested the patches, this solution works fine.
>> Try now to rebuild VMware modules, let us know if everything is fine also 
>> for You!
> FYI, here is what I did to try to fix the sources...
>
> The build error was caused by a couple of calls to the current_uid
> function in vmci and vsock sources (located rispectively in
> vmci-only/linux/driver.c and vsock-only/linux/af_vsock.c source files):
> when the kernel is built with the CONFIG_UIDGID_STRICT_TYPE_CHECKS
> option enabled, current_uid does not return an "int" as the source was
> expecting, hence the error "incompatible types when assigning to type
> XXX to type YYY".
>
> To avoid this, I "stole" from a patch I found on the Net the lines
> below: they allow to use the right function to retrieve the desired
> "int" value even in the case current_uid returns a structure and not an
> "int"...
> ***********************************************
> #ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
> #define CURRENT_UID() (__kuid_val(current_uid()))
> #define CURRENT_GID() (__kgid_val(current_gid()))
> #else
> #define CURRENT_UID() (current_uid())
> #define CURRENT_GID() (current_gid())
> #endif
> ***********************************************
> I added them to the shared/compat_cred.h file for both vmmi and vsock;
> and then I included the above header in the two source files calling the
> function "current_uid" and replaced in them the two occurrences of it
> with the new defined "CURRENT_UID"...
> voilà the two modules build with CONFIG_UIDGID_STRICT_TYPE_CHECKS.
>
> Perhaps this is enough to make Vmware work well with a kernel >= 3.12...
>
> However, at least in the vmci sources, "uid_t" is still defined as "int"
> (see: shared/vm_basic_defs.h) and then that is used to define a
> "VMCIHostUSer" custom type (see shared/vmci_kernel_if.h) used in many
> places in the source files; there are also a couple of functions (in
> linux/vmciKernelIf.c and common/vmciContext.c) using the VMCIHostUSer
> type with pointers and making comparisons between a couple of them.
> All the above should work fine with my patch, but I cannot tell it for
> sure, because I'm not so experienced in programming languages.
>
> Cheers.
>
> GvM
>
Indeed could be used this alternative patchin attach.

Bye.
Giuseppe.

BTW, have you noticed that kernel contains native vmci module, it's
called vmw_vmci.ko.

diff -u vmci.tar/vmci-only/linux/driver.c vmci-orig.tar/vmci-only/linux/driver.c
--- vmci.tar/vmci-only/linux/driver.c Fri Jan 10 00:55:14 2014
+++ vmci-orig.tar/vmci-only/linux/driver.c Fri Oct 18 19:56:11 2013
@@ -737,12 +737,7 @@
          goto init_release;
       }
 
-#ifdef CONFIG_UIDGID_STRICT_TYPE_CHECKS
-      user = (__kuid_val(current_uid()));
-#else
       user = current_uid();
-#endif
-
       retval = VMCIContext_InitContext(initBlock.cid, initBlock.flags,
                                        0 /* Unused */, vmciLinux->userVersion,
                                        &user, &vmciLinux->context);


Reply via email to