Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error kernel 4.14.13 and zfs 0.7-release #7069

Closed
voidzero opened this issue Jan 19, 2018 · 15 comments
Closed

Compilation error kernel 4.14.13 and zfs 0.7-release #7069

voidzero opened this issue Jan 19, 2018 · 15 comments
Projects

Comments

@voidzero
Copy link

voidzero commented Jan 19, 2018

System information

Type Version/Name
Distribution Name Funtoo Linux (Gentoo derivative)
Linux Kernel 4.14.13
Architecture x86_64
ZFS Version 0.7-release
SPL Version 0.7-release
GCC version 7.1.0

Compilation output:

fs/zfs/zfs/metaslab.c:1052:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_create,
  ^~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1052:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1052:2: error: invalid initializer
fs/zfs/zfs/metaslab.c:1052:2: note: (near initialization for ‘metaslab_rt_ops.<anonymous>’)
fs/zfs/zfs/metaslab.c:1053:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_destroy,
  ^~~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1053:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1053:2: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
fs/zfs/zfs/metaslab.c:1053:2: note: (near initialization for ‘metaslab_rt_ops.rtop_add’)
fs/zfs/zfs/metaslab.c:1054:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_add,
  ^~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1054:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_remove,
  ^~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1055:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1055:2: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
fs/zfs/zfs/metaslab.c:1055:2: note: (near initialization for ‘metaslab_rt_ops.rtop_destroy’)
fs/zfs/zfs/metaslab.c:1056:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_vacate
  ^~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1056:2: note: (near initialization for ‘metaslab_rt_ops’)
@voidzero
Copy link
Author

Ok, might be a gcc version issue. Trying 6.3.0 now.

@voidzero
Copy link
Author

gcc 6.3.0 also fails. Same output. Note: I am building zfs into the kernel - not as separate modules.

@maxximino
Copy link
Contributor

@voidzero I believe you have:
General setup > GCC plugins > Randomize layout of sensitive kernel structures (CONFIG_GCC_PLUGIN_RANDSTRUCT) set to Y .
Without it, it should build.
Thanks for filing the bug.

@rincebrain
Copy link
Contributor

@maxximino openzfs/spl#654 is a similar bug, you could probably examine that to see if a similar correction is needed for this to build here.

@voidzero
Copy link
Author

@maxximino I did indeed have that enabled, and it compiles now that I disabled it. Thank you. Is this something that will be supported in the future? Any idea?

@osti
Copy link

osti commented Jan 21, 2018

This might get more problematic if stock kernels include more and more of meltdown mitigation.

Btw. same here on Gentoo, kernel 4.14.14, ZFS 0.7.5-r1 (-r1 is gentoo-specific); CONFIG_GCC_PLUGIN_RANDSTRUCT=Y gives error; “N” lets zfs compile. But “N” reduces kernel security.

@prometheanfire
Copy link
Contributor

I've been running with the following for about a year just fine. I build from git master though...

CONFIG_GCC_PLUGIN_RANDSTRUCT=y
CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE=y

@twoertwein
Copy link
Contributor

I also encounter the same issue when trying to compile zfs into the kernel (ZFS 0.7.7 into 4.14.28 with GCC 7.3.1). Disabling CONFIG_GCC_PLUGIN_RANDSTRUCT 'solves' the issue but that is not a real solution to this problem!

@behlendorf
Copy link
Contributor

Sorry, we lost track of this one. We'll sort it out in the next point release, it was incidentally addressed is master by commit d4a72f2.

@behlendorf behlendorf added this to TODO in 0.7.9 Mar 21, 2018
@tonyhutter
Copy link
Contributor

Can you try rebuilding with 0.7.9? (just released today)

@twoertwein
Copy link
Contributor

sorry, it still doesn't seem to work with 0.7.9 (gcc 7.3.1, linux 4.14.40)

fs/zfs/zfs/metaslab.c:1052:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_create,
  ^~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1052:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1052:2: error: invalid initializer
fs/zfs/zfs/metaslab.c:1052:2: note: (near initialization for ‘metaslab_rt_ops.<anonymous>’)
fs/zfs/zfs/metaslab.c:1053:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_destroy,
  ^~~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1053:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1053:2: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
fs/zfs/zfs/metaslab.c:1053:2: note: (near initialization for ‘metaslab_rt_ops.rtop_add’)
fs/zfs/zfs/metaslab.c:1054:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_add,
  ^~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1054:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1054:2: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
fs/zfs/zfs/metaslab.c:1054:2: note: (near initialization for ‘metaslab_rt_ops.rtop_create’)
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_remove,
  ^~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1055:2: note: (near initialization for ‘metaslab_rt_ops’)
fs/zfs/zfs/metaslab.c:1055:2: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
fs/zfs/zfs/metaslab.c:1055:2: note: (near initialization for ‘metaslab_rt_ops.rtop_vacate’)
fs/zfs/zfs/metaslab.c:1056:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_vacate
  ^~~~~~~~~~~~~~~~~~
fs/zfs/zfs/metaslab.c:1056:2: note: (near initialization for ‘metaslab_rt_ops’)
cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:328: fs/zfs/zfs/metaslab.o] Error 1
make[2]: *** [scripts/Makefile.build:587: fs/zfs/zfs] Error 2
make[1]: *** [scripts/Makefile.build:587: fs/zfs] Error 2
make: *** [Makefile:1040: fs] Error 2
make: *** Waiting for unfinished jobs....

@gyakovlev
Copy link
Contributor

I confirm.
Still broken
4.16.8
zfs-kmod-0.7.9
CONFIG_GCC_PLUGIN_RANDSTRUCT=y
CONFIG_GCC_PLUGIN_RANDSTRUCT_PERFORMANCE=y

/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1052:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]                                                                                                                                                                                     
  metaslab_rt_create,                                                                                                                                                                          
  ^~~~~~~~~~~~~~~~~~                                                                                                                                                                           
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1052:2: note: (near initialization for ‘metaslab_rt_ops’)                                                              
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1052:2: error: invalid initializer                                                                                     
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1052:2: note: (near initialization for ‘metaslab_rt_ops.<anonymous>’)                                                  
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1053:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]                                                                                                                                                                                     
  metaslab_rt_destroy,                                                                                                                                                                         
  ^~~~~~~~~~~~~~~~~~~
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1053:2: note: (near initialization for ‘metaslab_rt_ops’)                                                             
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1054:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_add,
  ^~~~~~~~~~~~~~~
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1054:2: note: (near initialization for ‘metaslab_rt_ops’)                                                             
/tmp/portage/sys-fs/zfs-kmod-0.7.9/work/zfs-0.7.9/module/zfs/metaslab.c:1055:2: error: positional initialization of field in ‘struct’ declared with ‘designated_init’ attribute [-Werror=designated-init]
  metaslab_rt_remove,
  ^~~~~~~~~~~~~~~~~~``` 

@gyakovlev
Copy link
Contributor

Compiles and works with the following patch.
Use at your own risk, I don't really know what I'm doing =)

diff --git a/module/zfs/metaslab.c b/module/zfs/metaslab.c
index 5e413c0..209b685 100644
--- a/module/zfs/metaslab.c
+++ b/module/zfs/metaslab.c
@@ -1049,11 +1049,11 @@ metaslab_rt_vacate(range_tree_t *rt, void *arg)
 }
 
 static range_tree_ops_t metaslab_rt_ops = {
-       metaslab_rt_create,
-       metaslab_rt_destroy,
-       metaslab_rt_add,
-       metaslab_rt_remove,
-       metaslab_rt_vacate
+       .rtop_create = metaslab_rt_create,
+       .rtop_destroy = metaslab_rt_destroy,
+       .rtop_add = metaslab_rt_add,
+       .rtop_remove = metaslab_rt_remove,
+       .rtop_vacate = metaslab_rt_vacate
 };
 
 /*

gyakovlev added a commit to gyakovlev/zfs that referenced this issue May 11, 2018
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field
in ‘struct’ declared with ‘designated_init’ attribute
[-Werror=designated-init]
  metaslab_rt_remove,

Closes: openzfs#7069
Signed-off-by: Georgy Yakovlev <ya@sysdump.net>
gyakovlev added a commit to gyakovlev/zfs that referenced this issue May 11, 2018
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field
in ‘struct’ declared with ‘designated_init’ attribute
[-Werror=designated-init]
  metaslab_rt_remove,

Closes: openzfs#7069

Signed-off-by: Georgy Yakovlev <ya@sysdump.net>
Requires-spl: spl-0.7-release
gyakovlev added a commit to gyakovlev/zfs that referenced this issue May 12, 2018
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field
in ‘struct’ declared with ‘designated_init’ attribute
[-Werror=designated-init]
  metaslab_rt_remove,

Signed-off-by: Georgy Yakovlev <ya@sysdump.net>
Requires-spl: spl-0.7-release
Closes: openzfs#7069
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Aug 31, 2018
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field
in ‘struct’ declared with ‘designated_init’ attribute
[-Werror=designated-init]
  metaslab_rt_remove,

Signed-off-by: Georgy Yakovlev <ya@sysdump.net>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes: openzfs#7069

Requires-spl: refs/pull/707/head
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Sep 4, 2018
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field
in ‘struct’ declared with ‘designated_init’ attribute
[-Werror=designated-init]
  metaslab_rt_remove,

Signed-off-by: Georgy Yakovlev <ya@sysdump.net>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes: openzfs#7069
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Sep 5, 2018
fs/zfs/zfs/metaslab.c:1055:2: error: positional initialization of field
in ‘struct’ declared with ‘designated_init’ attribute
[-Werror=designated-init]
  metaslab_rt_remove,

Signed-off-by: Georgy Yakovlev <ya@sysdump.net>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes: openzfs#7069
@loli10K
Copy link
Contributor

loli10K commented Nov 18, 2019

This should be fixed by 30d8b85, closing.

@loli10K loli10K closed this as completed Nov 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
0.7.9
  
TODO
Development

No branches or pull requests

11 participants