abbbi / nullfsvfs

a virtual black hole file system that behaves like /dev/null
GNU General Public License v3.0
290 stars 12 forks source link

Doesnt build with kernel 5.12: too few arguments to function ‘inode_init_owner’ #6

Closed dreirund closed 3 years ago

dreirund commented 3 years ago

I get a lot warnings, treated as errors, about incompatible pointer types:

DKMS make.log for nullfs-0.3.r2.g802930f for kernel 5.12.2-153-tkg-MuQSS (x86_64)
Mon May 17 20:06:31 CEST 2021
make: Entering directory '/usr/lib/modules/5.12.2-153-tkg-MuQSS/build'
  CC [M]  /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.o
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: In function ‘nullfs_getattr’:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:86:19: error: passing argument 1 of ‘generic_fillattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   86 |  generic_fillattr(inode, stat);
      |                   ^~~~~
      |                   |
      |                   struct inode *
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:3212:23: note: expected ‘struct user_namespace *’ but argument is of type ‘struct inode *’
 3212 | void generic_fillattr(struct user_namespace *, struct inode *, struct kstat *);
      |                       ^~~~~~~~~~~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:86:26: error: passing argument 2 of ‘generic_fillattr’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   86 |  generic_fillattr(inode, stat);
      |                          ^~~~
      |                          |
      |                          struct kstat *
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:3212:48: note: expected ‘struct inode *’ but argument is of type ‘struct kstat *’
 3212 | void generic_fillattr(struct user_namespace *, struct inode *, struct kstat *);
      |                                                ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:86:2: error: too few arguments to function ‘generic_fillattr’
   86 |  generic_fillattr(inode, stat);
      |  ^~~~~~~~~~~~~~~~
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:3212:6: note: declared here
 3212 | void generic_fillattr(struct user_namespace *, struct inode *, struct kstat *);
      |      ^~~~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: At top level:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:144:19: error: initialization of ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, u32,  unsigned int)’ {ak
a ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, unsigned int,  unsigned int)’} from incompatible pointer type ‘int (*)(const struct path *, struct kstat *,
 u32,  unsigned int)’ {aka ‘int (*)(const struct path *, struct kstat *, unsigned int,  unsigned int)’} [-Werror=incompatible-pointer-types]
  144 |     .getattr    = nullfs_getattr,
      |                   ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:144:19: note: (near initialization for ‘nullfs_file_inode_operations.getattr’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: In function ‘nullfs_get_inode’:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:26: error: passing argument 1 of ‘inode_init_owner’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  264 |         inode_init_owner(inode, dir, mode);
      |                          ^~~~~
      |                          |
      |                          struct inode *
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1829:46: note: expected ‘struct user_namespace *’ but argument is of type ‘struct inode *’
 1829 | void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
      |                       ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:33: warning: passing argument 2 of ‘inode_init_owner’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  264 |         inode_init_owner(inode, dir, mode);
      |                                 ^~~
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1829:72: note: expected ‘struct inode *’ but argument is of type ‘const struct inode *’
 1829 | void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
      |                                                          ~~~~~~~~~~~~~~^~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:38: warning: passing argument 3 of ‘inode_init_owner’ makes pointer from integer without a cast [-Wint-conversion]
  264 |         inode_init_owner(inode, dir, mode);
      |                                      ^~~~
      |                                      |
      |                                      umode_t {aka short unsigned int}
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1830:29: note: expected ‘const struct inode *’ but argument is of type ‘umode_t’ {aka ‘short unsigned int’}
 1830 |         const struct inode *dir, umode_t mode);
      |         ~~~~~~~~~~~~~~~~~~~~^~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:264:9: error: too few arguments to function ‘inode_init_owner’
  264 |         inode_init_owner(inode, dir, mode);
      |         ^~~~~~~~~~~~~~~~
In file included from ./include/linux/seq_file.h:11,
                 from /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:16:
./include/linux/fs.h:1829:6: note: declared here
 1829 | void inode_init_owner(struct user_namespace *mnt_userns, struct inode *inode,
      |      ^~~~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c: At top level:
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:374:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t,  bool)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int,  _Bool)’} from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, umode_t,  bool)’ {aka ‘int (*)(struct inode *, struct dentry *, short unsigned int,  _Bool)’} [-Werror=incompatible-pointer-types]
  374 |     .create     = nullfs_create,
      |                   ^~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:374:19: note: (near initialization for ‘nullfs_dir_inode_operations.create’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:378:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, const char *)’ from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, const char *)’ [-Werror=incompatible-pointer-types]
  378 |     .symlink    = nullfs_symlink,
      |                   ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:378:19: note: (near initialization for ‘nullfs_dir_inode_operations.symlink’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:379:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int)’} from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, umode_t)’ {aka ‘int (*)(struct inode *, struct dentry *, short unsigned int)’} [-Werror=incompatible-pointer-types]
  379 |     .mkdir      = nullfs_mkdir,
      |                   ^~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:379:19: note: (near initialization for ‘nullfs_dir_inode_operations.mkdir’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:381:19: error: initialization of ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, umode_t,  dev_t)’ {aka ‘int (*)(struct user_namespace *, struct inode *, struct dentry *, short unsigned int,  unsigned int)’} from incompatible pointer type ‘int (*)(struct inode *, struct dentry *, umode_t,  dev_t)’ {aka ‘int (*)(struct inode *, struct dentry *, short unsigned int,  unsigned int)’} [-Werror=incompatible-pointer-types]
  381 |     .mknod      = nullfs_mknod,
      |                   ^~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:381:19: note: (near initialization for ‘nullfs_dir_inode_operations.mknod’)
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:383:19: error: initialization of ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, u32,  unsigned int)’ {aka ‘int (*)(struct user_namespace *, const struct path *, struct kstat *, unsigned int,  unsigned int)’} from incompatible pointer type ‘int (*)(const struct path *, struct kstat *, u32,  unsigned int)’ {aka ‘int (*)(const struct path *, struct kstat *, unsigned int,  unsigned int)’} [-Werror=incompatible-pointer-types]
  383 |     .getattr    = nullfs_getattr,
      |                   ^~~~~~~~~~~~~~
/var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.c:383:19: note: (near initialization for ‘nullfs_dir_inode_operations.getattr’)
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:271: /var/lib/dkms/nullfs/0.3.r2.g802930f/build/nullfs.o] Error 1
make: *** [Makefile:1854: /var/lib/dkms/nullfs/0.3.r2.g802930f/build] Error 2
make: Leaving directory '/usr/lib/modules/5.12.2-153-tkg-MuQSS/build'
abbbi commented 3 years ago

looks more like some incompatibility with kernel 5.12:

nullfs.c:264:9: error: too few arguments to function ‘inode_init_owner’

seems like it now needs another argument with newer kernels:

https://elixir.bootlin.com/linux/latest/source/include/linux/fs.h#L1828

other fs modules have been adopted in more recent kernel versions, too as it seems:

https://elixir.bootlin.com/linux/latest/source/fs/ramfs/inode.c#L70

I dont have any newer kernels around for trying fixing this atm.

Probably easy to fix, if looking at the other related commits:

https://github.com/torvalds/linux/commit/21cb47be6fb9ece7e6ee63f6780986faa384a77c#diff-bc01782c59ccf73a17d3f288079a33e1058450ddddcae8dc4dd3f9a5f741c45c

requires some #if LINUX_VERSION_CODE >= KERNEL_VERSION fun again :)

dreirund commented 3 years ago

*On Mon, 17 May 2021 14:34:18 -0700, Michael Ablassmeier @.**> wrote about "Re: [abbbi/nullfsvfs] Warnings/errors about "Incompatible pointer types.". (#6)":

looks more like some incompatibility with kernel 5.12:

nullfs.c:264:9: error: too few arguments to function ‘inode_init_owner’

gcc version used? Build fine with kernel 5.10/cc 10.2 on Debian bullseye here.

gcc 10.2.0 on Artix.

Soon gcc 11.1.

Build works for kernel versions

Problem exists for kernel versions

-- Mamihlapinatapai:

"Der Blick zwischen zwei Personen, von denen jede wünschte, die andere würde etwas initiieren, was beide begehren, aber keine wagt den ersten Schritt zu tun."

"The look shared by two people, each wishing that the other will initiate something that they both desire, but are unwilling to suggest or start themselves."

(Ein Wort aus der Sprache der "Yaghan" / A word from the language of the "Yaghan").

abbbi commented 3 years ago

Please checkout branch kernel_512, with changes applied:

https://github.com/abbbi/nullfsvfs/commit/96a6e1f3e688f0d5f346fe7f716d09984c400949

it compiles on kernel 5.12, loads and mounts. Please verify then ill merge, thanks.

dreirund commented 3 years ago

*On Tue, 18 May 2021 07:46:16 -0700, Michael Ablassmeier @.***> wrote about "Re: [abbbi/nullfsvfs] Doesnt build with kernel 5.12: too few arguments to function ‘inode_init_owner’ (#6)":

Please checkout branch kernel_512, with changes applied:

https://github.com/abbbi/nullfsvfs/commit/96a6e1f3e688f0d5f346fe7f716d09984c400949

[...] Please verify then ill merge, thanks.

Seems to work for me, too.

-- Wählt man eine der Antworten zu dieser Frage zufällig aus, wie hoch ist die Wahrscheinlichkeit, dass sie korrekt ist?

a) 1/3 b) 1/3 c) sonstige, und zwar: ____