aufs doesn't build with (non-standard) config w/o vserver or apparmor

Bug #327337 reported by Peter Cordes
This bug report is a duplicate of:  Bug #344370: imx51 AppArmor oops during bootup. Edit Remove
4
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
New
Undecided
Unassigned

Bug Description

I'm building a custom kernel, because I want Jaunty's 2.6.28 on Intrepid with a linux-headers-...deb that doesn't Depend: on jaunty's libc. (grrr.) So I figured I might as well customize it for my machine anyway, which is what I used to do back when the 1/2MB of RAM you could save felt like it mattered. :) I mostly followed the instructions at https://help.ubuntu.com/community/Kernel/Compile and
http://blog.avirtualhome.com/2008/10/28/how-to-compile-a-custom-kernel-for-ubuntu-intrepid-using-git/

 Anyway, with my custom .config (attached), trying to build 2.6.28-7.20 from the latest Jaunty git repo gives:

/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c: In function 'do_vfsub_mknod':
/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c:166: warning: passing argument 3 of 'vfs_mknod' makes pointer from integer without a cast
/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c:166: error: too few arguments to function 'vfs_mknod'
/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c: In function 'do_vfsub_link':
/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c:191: warning: passing argument 2 of 'vfs_link' from incompatible pointer type
/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c:191: warning: passing argument 3 of 'vfs_link' from incompatible pointer type
/usr/local/src/linux/ubuntu-jaunty/ubuntu/aufs/vfsub.c:191: error: too few arguments to function 'vfs_link'
...

 The problem seems to be that the #ifdefs select broken code for my config, but not for Ubuntu's default config. ubuntu/aufs/vfsub.c looks like:

        #ifdef CONFIG_VSERVER // line 160
        err = vfs_mknod(dir, dentry, mode, dev, NULL);
        #elif defined(CONFIG_SECURITY_APPARMOR)
        err = vfs_mknod(dir, dentry, NULL, mode, dev);
        #else
        err = vfs_mknod(dir, dentry, mode, dev);
        #endif // line 167

 My .config includes neither CONFIG_VSERVER nor CONFIG_SECURITY_APPARMOR. Ubuntu's kernels ship with a config that includes APPARMOR, but not VSERVER. I haven't figured out where vfs_mknod's prototype comes from, but it doesn't seem to be anywhere in plain text. Probably it's constructed from a macro... vfs_mknod() is defined in fs/namei.c.

 There are similar #ifdefs going on with calls to vfs_link, vfs_mkdir, vfs_unlink, etc. Some googling found a patch where someone had made vfs_mknod and so on into macros that added a NULL in the right place depending on what was #defined. That seems more sensible than scattering that extra NULL throughout the aufs code. Although perhaps that's not needed so much anymore, if there are too few arguments in the 4-arg call. Maybe now vfs_mkdir always takes 5 args? Or maybe it shouldn't be #ifdef CONFIG_VSERVER but rather if the vserver patch is applied, if that's how it works. Anyway, my idle speculation is probably not so useful to anyone who's seen this code before. :P

 Anyway, this is not strictly an Ubuntu bug, but this is the easiest way to report the bug. So I hope this gets passed along to the right upstream people.

Revision history for this message
Peter Cordes (peter-cordes) wrote :
Revision history for this message
Peter Cordes (peter-cordes) wrote :

unionfs is also broken w/o APPARMOR (or by something else in my .config)

/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c: In function 'get_hidden_parent':
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:489: error: invalid use of undefined type 'struct export_operations'
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c: In function 'do_get_dentry':
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:553: warning: passing argument 2 of 'vfs_readdir' from incompatible pointer type
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c: In function 'unionfs_encode_fh':
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:666: error: invalid use of undefined type 'struct export_operations'
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c: In function 'unionfs_decode_fh':
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:710: error: invalid use of undefined type 'struct export_operations'
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c: At top level:
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:728: error: variable 'unionfs_export_ops' has initializer but incomplete t
ype
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:729: error: unknown field 'decode_fh' specified in initializer
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:729: warning: excess elements in struct initializer
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:729: warning: (near initialization for 'unionfs_export_ops')
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:730: error: unknown field 'encode_fh' specified in initializer
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:731: warning: excess elements in struct initializer
/usr/local/src/linux/ubuntu-jaunty/ubuntu/unionfs/super.c:731: warning: (near initialization for 'unionfs_export_ops')

 umm, happy hacking. :)

Revision history for this message
Amit Kucheria (amitk) wrote :

I am not sure what you consider a bug - the fact that you can't compile AUFS without Apparmor in your config?

That is a choice that Ubuntu made. Apparmor changes the call parameters to VFS functions as you've right pointed out. The version of AUFS shipped in Ubuntu has been modified to use these new call parameters. So ofcourse it won't compile unless you revert changes in aufs to all the VFS functions.

Revision history for this message
Peter Cordes (peter-cordes) wrote :

 The code has #ifs on CONFIG_VSERVER and CONFIG_SECURITY_APPARMOR to select different parameter sets:

#ifdef CONFIG_VSERVER // line 160
        err = vfs_mknod(dir, dentry, mode, dev, NULL);
#elif defined(CONFIG_SECURITY_APPARMOR)
        err = vfs_mknod(dir, dentry, NULL, mode, dev);
#else
        err = vfs_mknod(dir, dentry, mode, dev);
#endif // line 167

 The bug is that only the code selected by defined(CONFIG_SECURITY_APPARMOR) works. If the code wasn't already full of #ifs to deal with this exact issue, I probably wouldn't have reported the bug. Since it is, I assumed it was supposed to work in all possible configurations. Otherwise, what's the point of cluttering the code with all the #ifs.

Revision history for this message
Amit Kucheria (amitk) wrote :

You are right!

The problem is identified in fs/namei.c

Marking this bug as a duplicate of the bug that is getting worked on.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.