VirtualBox

Opened 5 years ago

Closed 4 years ago

#19112 closed defect (worksforme)

vboxsf (Guest Additions 6.0.14) fails to compile on Linux 3.16

Reported by: eposse Owned by:
Component: shared folders Version: VirtualBox 6.0.14
Keywords: ubuntu 14.04.02 linux mint 17.02 Cc: eposse@…
Guest type: Linux Host type: Mac OS X

Description

As the title says, vboxsf from Guest Additions 6.0.14 fails to compile on Linux 3.16. More precisely, I'm running VirtualBox 6.0.14, with guest lubuntu 14.04 (kernel 3.16.0-30), 64 bits, on a macOS 10.15 (Catalina) host. The vboxguest module is successfully compiled and loaded (verified with lsmod), but not vboxsf.

I have searched the forum and see similar problems reported, and even a ticket (#18238: vboxsf module (6.0.0) does not compile for kernel 3.10 -> fixed after (not in) 5.2.22/6.0.0 or in test builds) but none of those are the same as the error I'm seeing.

I noticed the problem when I noticed that my share folders were not working. After using lsmod and modprobe I found that vboxguest was loaded, but vboxsf was not. Furthermore, looking into the modules directory at /lib/modules/3.16.0-30-generic/misc shows only vboxguest.ko, but not vboxsf.ko.

So I went to the guest additions source folder and tried to build it manually (running /opt/VBoxGuestAdditions-6.0.14/src/vboxguest-6.0.14/build_in_tmp --module-source vboxsf). This results in the following compilation error:

  gcc -Wp,-MD,/tmp/vbox.1/.regops.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include  -I./arch/x86/include -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -Iubuntu/include  -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -m64 -mno-mmx -mno-sse -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -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_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -fno-delete-null-pointer-checks -O2 -Wframe-larger-than=1024 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO -Wno-declaration-after-statement -fno-pie -include /tmp/vbox.1//include/VBox/VBoxGuestMangling.h -fshort-wchar -O2 -I./include -I/tmp/vbox.1/ -I/tmp/vbox.1/include -I/tmp/vbox.1/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DIN_MODULE -DIN_GUEST -DIN_GUEST_R0 -DRT_NO_EXPORT_SYMBOL -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_AMD64  -DMODULE  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(regops)"  -D"KBUILD_MODNAME=KBUILD_STR(vboxsf)" -c -o /tmp/vbox.1/.tmp_regops.o /tmp/vbox.1/regops.c
/tmp/vbox.1/regops.c: In function ‘vbsf_iov_iter_get_pages_3_16’:
/tmp/vbox.1/regops.c:314:5: warning: passing argument 4 of ‘iov_iter_get_pages’ makes integer from pointer without a cast [enabled by default]
     return iov_iter_get_pages(iter, papPages, cbMax, poffPg0);
     ^
In file included from /tmp/vbox.1/regops.c:36:0:
include/linux/uio.h:86:9: note: expected ‘unsigned int’ but argument is of type ‘size_t *’
 ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
         ^
/tmp/vbox.1/regops.c:314:5: error: too few arguments to function ‘iov_iter_get_pages’
     return iov_iter_get_pages(iter, papPages, cbMax, poffPg0);
     ^
In file included from /tmp/vbox.1/regops.c:36:0:
include/linux/uio.h:86:9: note: declared here
 ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
         ^
/tmp/vbox.1/regops.c:315:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make[2]: *** [/tmp/vbox.1/regops.o] Error 1
make[1]: *** [_module_/tmp/vbox.1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.16.0-30-generic'
make: *** [vboxsf] Error 2

So I looked for the problematic function signature and I found the "uio.h" header under /lib/modules/3.16.0-30-generic/build/include/linux, and surely enough, the signature for that function is

ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
                size_t maxsize, unsigned maxpages, size_t *start);

and in regops.c, it is called in the following function:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 35)

/** This is for implementing cMaxPage on 3.16 which doesn't have it. */
static ssize_t vbsf_iov_iter_get_pages_3_16(struct iov_iter *iter, struct page **papPages,
                                            size_t cbMax, unsigned cMaxPages, size_t *poffPg0)
{
    if (!(iter->type & ITER_BVEC)) {
        size_t const offPg0     = iter->iov_offset & PAGE_OFFSET_MASK;
        size_t const cbMaxPages = ((size_t)cMaxPages << PAGE_SHIFT) - offPg0;
        if (cbMax > cbMaxPages)
            cbMax = cbMaxPages;
    }
    /* else: BVEC works a page at a time and shouldn't have much of a problem here. */
    return iov_iter_get_pages(iter, papPages, cbMax, poffPg0);
}

Note that this function is defined explicitly for kernel version 3.16.0, but the function declared in uio.h has five parameters and it is being called with four arguments.

Change History (11)

comment:1 by Frank Batschulat (Oracle), 5 years ago

Owner: set to Frank Batschulat (Oracle)
Status: newaccepted

comment:2 by Frank Batschulat (Oracle), 5 years ago

thanks for the excellent bug report!

comment:3 by Frank Batschulat (Oracle), 5 years ago

Component: guest additionsshared folders

comment:5 by Frank Batschulat (Oracle), 5 years ago

vbsf_iov_iter_get_pages_3_16() is a function to deal with the function signature of iov_iter_get_pages() in the Linux kernel between versions 3.16.0:

https://elixir.bootlin.com/linux/v3.16/source/include/linux/uio.h#L86

ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
			size_t maxsize, size_t *start);

and version 3.16.35:
https://elixir.bootlin.com/linux/v3.16.35/source/include/linux/uio.h

ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
			size_t maxsize, unsigned maxpages, size_t *start);

The 3.17-rc7 and thus the 3.17.0 kernel had this change:

https://elixir.bootlin.com/linux/v3.17-rc7/source/include/linux/uio.h

which was also backported to the 3.16.35 kernel because 3.16 is an LTS kernel:
https://www.kernel.org/

https://elixir.bootlin.com/linux/v3.16.35/source/include/linux/uio.h

Now apparently it happened that Ubuntu backported this changeset to the Ubuntu specific 3.16.0 release tree starting at least with the 3.16.0-30 Ubuntu specific kernel version. Probably more likely Ubuntu kernel revision -26:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1393401
https://linuxlists.cc/l/1/linux-kernel/t/1281059/(3.16.y-ckt_stable)_linux_3.16.7-ckt1_stable_review
https://lists.launchpad.net/kernel-packages/msg95075.html

Which may also come from Debian itself in Debian linux (3.16.7-1) https://tracker.debian.org/media/packages/l/linux/changelog-3.16.51-3deb8u1

The following Ubuntu versions where initally released with the 3.16 kernel series:

The Ubuntu 14.04.2 point release has the 3.16.0-30 kernel.
https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes/14.04.2#Updated_Packages

14.04.3 and above do not use the 3.16 kernel train anymore. https://wiki.ubuntu.com/TrustyTahr/ReleaseNotes/14.04.3#Updated_Packages

So in summary, every Distro that decided to base itself on the 14.04.2 Ubuntu point release are possible victims like Ubuntu 14.04.2 itself, lubuntu 14.04 but also Linux Mint 17.2:
https://www.linuxmint.com/rel_rafaela_mate.php

Linux Mint 17.2 features MATE 1.10, MDM 2.0,
a Linux kernel 3.16 and an Ubuntu 14.04 package base.

Linux Mint 17.3 does not have it as that one already uses the 3.19 kernel series:
https://www.linuxmint.com/rel_rosa_mate_whatsnew.php

Linux Mint 17.3 features MATE 1.12, MDM 2.0, a 
Linux kernel 3.19 and an Ubuntu 14.04 package base.

which is: 3.16.0-38-generic

https://news.softpedia.com/news/linux-mint-17-reached-end-of-life-users-urged-to-upgrade-to-linux-mint-18-or-19-525900.shtml

Last edited 5 years ago by Frank Batschulat (Oracle) (previous) (diff)

comment:6 by Frank Batschulat (Oracle), 5 years ago

WORKAROUND:

Upgrade to Ubuntu 14.04.03 and above or the equivalent for the distros based on Ubuntu like Linux Mint, from 17.2 to 17.3.

Last edited 5 years ago by Frank Batschulat (Oracle) (previous) (diff)

comment:7 by Frank Batschulat (Oracle), 5 years ago

Keywords: ubuntu 14.04.02 linux mint 17.02 added

comment:8 by divB, 5 years ago

What exactly is the kernel package (linux-image-...) that should be installed? I have 14.04.6 LTS but it still does not work

in reply to:  8 comment:9 by Frank Batschulat (Oracle), 4 years ago

Replying to divB:

What exactly is the kernel package (linux-image-...) that should be installed? I have 14.04.6 LTS but it still does not work

So I went ahead and tested again and this is what works:

$ uname -a
Linux fbatschu-VirtualBox 4.4.0-148-generic #174~14.04.1-Ubuntu SMP Thu
May 9 08:17:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="14.04.6 LTS, Trusty Tahr"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 14.04.6 LTS"
VERSION_ID="14.04"
 
$ apt search linux-image |grep installed
linux-image-4.4.0-142-generic/trusty-updates,trusty-security,now
4.4.0-142.168~14.04.1 amd64 [installed,automatic]
linux-image-4.4.0-148-generic/trusty-updates,trusty-security,now
4.4.0-148.174~14.04.1 amd64 [installed,automatic]
linux-image-extra-4.4.0-142-generic/trusty-updates,trusty-security,now
4.4.0-142.168~14.04.1 amd64 [installed,automatic]
linux-image-generic-lts-xenial/trusty-updates,trusty-security,now
4.4.0.148.130 amd64 [installed,automatic]

If that does not work for you, you may want to add your /var/log/vboxadd-setup.log file from the failing GA installation or otherwise describe your problem better.

comment:10 by Frank Batschulat (Oracle), 4 years ago

Owner: Frank Batschulat (Oracle) removed
Status: acceptedassigned

comment:11 by Frank Batschulat (Oracle), 4 years ago

Resolution: worksforme
Status: assignedclosed

Upgrade to Ubuntu 14.04.03 and above or the equivalent for the distros based on Ubuntu like Linux Mint, from 17.2 to 17.3.

Note: See TracTickets for help on using tickets.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette