From 6f6c10c0bc0de9d92ff608828ecd9aef46a645c4 Mon Sep 17 00:00:00 2001 From: Chris Dunlop Date: Thu, 15 Feb 2018 16:07:43 +1100 Subject: [PATCH] Fix config issues: frame size and headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. With various (debug and/or tracing?) kernel options enabled it's possible for 'struct inode' and 'struct super_block' to exceed the default frame size, leaving errors like this in config.log: build/conftest.c:116:1: error: the frame size of 1048 bytes is larger than 1024 bytes [-Werror=frame-larger-than=] Fix this by removing the frame size warning for config checks 2. Without the correct headers included, it's possible for declarations to be missed, leaving errors like this in the config.log: build/conftest.c:131:14: error: ‘struct nameidata’ declared inside parameter list [-Werror] Fix this by adding appropriate headers. Note: Both these issues can result in silent config failures because the compile failure is taken to mean "this option is not supported by this kernel" rather than "there's something wrong with the config test". This can lead to something merely annoying (compile failures) to something potentially serious (miscompiled or misused kernel primitives or functions). E.g. the fixes included here resulted in these additional defines in zfs_config.h with linux v4.14.19: Also, drive-by whitespace fixes in config/* files which don't mention "GNU" (those ones look to be imported from elsewhere so leave them alone). Signed-off-by: Chris Dunlop diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4 index 3114843..02cc020 100644 --- a/config/kernel-acl.m4 +++ b/config/kernel-acl.m4 @@ -184,6 +184,7 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->permission() wants nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include int permission_fn(struct inode *inode, int mask, struct nameidata *nd) { return 0; } diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4 index a71490a..d4c155c 100644 --- a/config/kernel-create-nameidata.m4 +++ b/config/kernel-create-nameidata.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->create() passes nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include #ifdef HAVE_MKDIR_UMODE_T int inode_create(struct inode *inode ,struct dentry *dentry, diff --git a/config/kernel-current-time.m4 b/config/kernel-current-time.m4 index 2ede9ff..aec6a5b 100644 --- a/config/kernel-current-time.m4 +++ b/config/kernel-current-time.m4 @@ -5,8 +5,8 @@ AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME], [AC_MSG_CHECKING([whether current_time() exists]) ZFS_LINUX_TRY_COMPILE_SYMBOL([ #include - ], [ struct inode ip; + ], [ struct timespec now __attribute__ ((unused)); now = current_time(&ip); diff --git a/config/kernel-dentry-operations.m4 b/config/kernel-dentry-operations.m4 index 3182490..61f5a27 100644 --- a/config/kernel-dentry-operations.m4 +++ b/config/kernel-dentry-operations.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [ AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include int revalidate (struct dentry *dentry, struct nameidata *nidata) { return 0; } diff --git a/config/kernel-inode-set-flags.m4 b/config/kernel-inode-set-flags.m4 index e0ad267..287317b 100644 --- a/config/kernel-inode-set-flags.m4 +++ b/config/kernel-inode-set-flags.m4 @@ -6,8 +6,8 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_SET_FLAGS], [ AC_MSG_CHECKING([whether inode_set_flags() exists]) ZFS_LINUX_TRY_COMPILE([ #include - ],[ struct inode inode; + ],[ inode_set_flags(&inode, S_IMMUTABLE, S_IMMUTABLE); ],[ AC_MSG_RESULT(yes) diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4 index 43f5fb4..5453be5 100644 --- a/config/kernel-lookup-nameidata.m4 +++ b/config/kernel-lookup-nameidata.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->lookup() passes nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include struct dentry *inode_lookup(struct inode *inode, struct dentry *dentry, struct nameidata *nidata) diff --git a/config/kernel-set-nlink.m4 b/config/kernel-set-nlink.m4 index f7ffc0d..07a2ac8 100644 --- a/config/kernel-set-nlink.m4 +++ b/config/kernel-set-nlink.m4 @@ -6,8 +6,8 @@ AC_DEFUN([ZFS_AC_KERNEL_SET_NLINK], [ AC_MSG_CHECKING([whether set_nlink() is available]) ZFS_LINUX_TRY_COMPILE([ #include - ],[ struct inode node; + ],[ unsigned int link = 0; (void) set_nlink(&node, link); ],[ diff --git a/config/kernel-shrink.m4 b/config/kernel-shrink.m4 index a57c2af..4feb499 100644 --- a/config/kernel-shrink.m4 +++ b/config/kernel-shrink.m4 @@ -54,8 +54,8 @@ AC_DEFUN([ZFS_AC_KERNEL_S_INSTANCES_LIST_HEAD], [ AC_MSG_CHECKING([whether super_block has s_instances list_head]) ZFS_LINUX_TRY_COMPILE([ #include - ],[ struct super_block sb __attribute__ ((unused)); + ],[ INIT_LIST_HEAD(&sb.s_instances); ],[ --- config/deb.am | 8 ++++---- config/kernel-acl.m4 | 1 + config/kernel-create-nameidata.m4 | 1 + config/kernel-dentry-operations.m4 | 1 + config/kernel-get-link.m4 | 2 +- config/kernel-lookup-nameidata.m4 | 1 + config/kernel-vm_node_stat.m4 | 2 +- config/kernel.m4 | 2 +- config/tgz.am | 4 ++-- config/user-libblkid.m4 | 2 +- config/user-libssl.m4 | 2 +- 11 files changed, 15 insertions(+), 11 deletions(-) diff --git a/config/deb.am b/config/deb.am index 1b51f93163a0..58ab96e186ad 100644 --- a/config/deb.am +++ b/config/deb.am @@ -2,16 +2,16 @@ deb-local: @(if test "${HAVE_DPKGBUILD}" = "no"; then \ echo -e "\n" \ "*** Required util ${DPKGBUILD} missing. Please install the\n" \ - "*** package for your distribution which provides ${DPKGBUILD},\n" \ + "*** package for your distribution which provides ${DPKGBUILD},\n" \ "*** re-run configure, and try again.\n"; \ - exit 1; \ + exit 1; \ fi; \ if test "${HAVE_ALIEN}" = "no"; then \ echo -e "\n" \ "*** Required util ${ALIEN} missing. Please install the\n" \ - "*** package for your distribution which provides ${ALIEN},\n" \ + "*** package for your distribution which provides ${ALIEN},\n" \ "*** re-run configure, and try again.\n"; \ - exit 1; \ + exit 1; \ fi) deb-kmod: deb-local rpm-kmod diff --git a/config/kernel-acl.m4 b/config/kernel-acl.m4 index 311484349d4a..02cc020e5c90 100644 --- a/config/kernel-acl.m4 +++ b/config/kernel-acl.m4 @@ -184,6 +184,7 @@ AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->permission() wants nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include int permission_fn(struct inode *inode, int mask, struct nameidata *nd) { return 0; } diff --git a/config/kernel-create-nameidata.m4 b/config/kernel-create-nameidata.m4 index a71490a004a6..d4c155c57fc9 100644 --- a/config/kernel-create-nameidata.m4 +++ b/config/kernel-create-nameidata.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_CREATE_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->create() passes nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include #ifdef HAVE_MKDIR_UMODE_T int inode_create(struct inode *inode ,struct dentry *dentry, diff --git a/config/kernel-dentry-operations.m4 b/config/kernel-dentry-operations.m4 index 3182490c908c..61f5a27af5a7 100644 --- a/config/kernel-dentry-operations.m4 +++ b/config/kernel-dentry-operations.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_D_REVALIDATE_NAMEIDATA], [ AC_MSG_CHECKING([whether dops->d_revalidate() takes struct nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include int revalidate (struct dentry *dentry, struct nameidata *nidata) { return 0; } diff --git a/config/kernel-get-link.m4 b/config/kernel-get-link.m4 index 022c49c54de7..3cda08c1b4d5 100644 --- a/config/kernel-get-link.m4 +++ b/config/kernel-get-link.m4 @@ -41,7 +41,7 @@ AC_DEFUN([ZFS_AC_KERNEL_FOLLOW_LINK], [ AC_DEFINE(HAVE_FOLLOW_LINK_NAMEIDATA, 1, [iops->follow_link() nameidata]) ],[ - AC_MSG_ERROR(no; please file a bug report) + AC_MSG_ERROR(no; please file a bug report) ]) ]) ]) diff --git a/config/kernel-lookup-nameidata.m4 b/config/kernel-lookup-nameidata.m4 index 43f5fb4cbc7b..5453be5e8e38 100644 --- a/config/kernel-lookup-nameidata.m4 +++ b/config/kernel-lookup-nameidata.m4 @@ -5,6 +5,7 @@ AC_DEFUN([ZFS_AC_KERNEL_LOOKUP_NAMEIDATA], [ AC_MSG_CHECKING([whether iops->lookup() passes nameidata]) ZFS_LINUX_TRY_COMPILE([ #include + #include struct dentry *inode_lookup(struct inode *inode, struct dentry *dentry, struct nameidata *nidata) diff --git a/config/kernel-vm_node_stat.m4 b/config/kernel-vm_node_stat.m4 index e1c42f884b0b..5dcd9d8275f2 100644 --- a/config/kernel-vm_node_stat.m4 +++ b/config/kernel-vm_node_stat.m4 @@ -7,7 +7,7 @@ AC_DEFUN([ZFS_AC_KERNEL_VM_NODE_STAT], [ ZFS_LINUX_TRY_COMPILE([ #include #include - ],[ + ],[ int a __attribute__ ((unused)) = NR_VM_NODE_STAT_ITEMS; long x __attribute__ ((unused)) = atomic_long_read(&vm_node_stat[0]); diff --git a/config/kernel.m4 b/config/kernel.m4 index 805ec60a1483..e9eec70d44a2 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -711,7 +711,7 @@ AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ modpost_flag='' test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage AS_IF( - [AC_TRY_COMMAND(cp conftest.c conftest.h build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])], + [AC_TRY_COMMAND(cp conftest.c conftest.h build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror $FRAME_LARGER_THAN $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])], [$4], [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])] ) diff --git a/config/tgz.am b/config/tgz.am index 2997b1de2306..0657d045d164 100644 --- a/config/tgz.am +++ b/config/tgz.am @@ -2,9 +2,9 @@ tgz-local: @(if test "${HAVE_ALIEN}" = "no"; then \ echo -e "\n" \ "*** Required util ${ALIEN} missing. Please install the\n" \ - "*** package for your distribution which provides ${ALIEN},\n" \ + "*** package for your distribution which provides ${ALIEN},\n" \ "*** re-run configure, and try again.\n"; \ - exit 1; \ + exit 1; \ fi) tgz-kmod: tgz-local rpm-kmod diff --git a/config/user-libblkid.m4 b/config/user-libblkid.m4 index 5bc7f466ae7a..88e6f990b74a 100644 --- a/config/user-libblkid.m4 +++ b/config/user-libblkid.m4 @@ -6,7 +6,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [ LIBBLKID= AC_CHECK_HEADER([blkid/blkid.h], [], [AC_MSG_FAILURE([ - *** blkid.h missing, libblkid-devel package required])]) + *** blkid.h missing, libblkid-devel package required])]) AC_SUBST([LIBBLKID], ["-lblkid"]) AC_DEFINE([HAVE_LIBBLKID], 1, [Define if you have libblkid]) diff --git a/config/user-libssl.m4 b/config/user-libssl.m4 index b65a51400a92..f6824510fd41 100644 --- a/config/user-libssl.m4 +++ b/config/user-libssl.m4 @@ -5,7 +5,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER_LIBSSL], [ LIBSSL= AC_CHECK_HEADER([openssl/evp.h], [], [AC_MSG_FAILURE([ - *** evp.h missing, libssl-devel package required])]) + *** evp.h missing, libssl-devel package required])]) AC_SUBST([LIBSSL], ["-lssl -lcrypto"]) AC_DEFINE([HAVE_LIBSSL], 1, [Define if you have libssl])