openzfs / spl

A shim layer which adds the core interfaces required for OpenZFS.
https://zfsonlinux.org/
GNU General Public License v2.0
282 stars 181 forks source link

configure fails at "checking whether set_fs_pwd() requires const struct path *" #680

Closed voidzero closed 6 years ago

voidzero commented 6 years ago

System information

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

Hello, I'm currently trying to build the 4.14.17 kernel with the grsecurity stable patchset, and zfs built into the kernel. When trying to build spl, it fails during the ./configure step here:

checking whether set_fs_pwd() requires const struct path *... configure: error: unknown

In config.log:

configure:16574: checking whether set_fs_pwd() requires const struct path *
configure:16606: cp conftest.c build && make modules -C /usr/src/linux EXTRA_CFLAGS=-Werror-implicit-function-declaration -Werror  M=/usr/src/patches/spl/build modpost=true
In file included from ./arch/x86/include/asm/preempt.h:7:0,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from /usr/src/patches/spl/build/conftest.c:34:
./include/linux/thread_info.h:23:44: error: ‘current_thread_info’ declared ‘static’ but never defined [-Werror=unused-function]
 static __always_inline struct thread_info *current_thread_info(void);
                                            ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/usr/src/patches/spl/build/conftest.o] Error 1

I hope you can help me - although I understand that this may be considered unsupported. Still, maybe you can give me some hints.

behlendorf commented 6 years ago

Try adding -Wno-unused-function to EXTRA_CFLAGS in SPL_AC_SET_FS_PWD_WITH_CONST.

EXTRA_KCFLAGS="-Werror -Wno-unused-function"
voidzero commented 6 years ago

@behlendorf Thanks for that. I'm not entirely sure so just to retrace my steps - I've added -Wno-unused-function to the EXTRA_KCFLAGS line (not EXTRA_CFLAGS) in config/spl-build.m4, this was line 905. Then I re-ran ./autogen.sh.

I guess these were the right steps, because this time ./configure did run without any error.

Now I am running into another issue, this time with the zfs ./configure script:

configure:32353: checking whether xattr_handler->get() wants inode
configure:32392: cp conftest.c conftest.h build && make modules -C /usr/src/linux EXTRA_CFLAGS=-Werror   M=/usr/src/patches/zfs/build modpost=true
/usr/src/patches/zfs/build/conftest.c:95:14: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
       .get = get,
              ^~~
/usr/src/patches/zfs/build/conftest.c:95:14: note: (near initialization for ‘xops.get’)
In file included from ./arch/x86/include/asm/preempt.h:7:0,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:6,
                 from ./include/linux/slab.h:15,
                 from ./include/linux/xattr.h:15,
                 from /usr/src/patches/zfs/build/conftest.c:89:
./include/linux/thread_info.h:23:44: error: ‘current_thread_info’ declared ‘static’ but never defined [-Werror=unused-function]
 static __always_inline struct thread_info *current_thread_info(void);
                                            ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [/usr/src/patches/zfs/build/conftest.o] Error 1
make: *** [_module_/usr/src/patches/zfs/build] Error 2

Looks similar. Can you point me to the right direction?

behlendorf commented 6 years ago

It looks like you'll need to make a similar change in config/kernel-xattr-handler.m4. Alternately, you could do something like this to cover all the configure checks.

diff --git a/config/kernel.m4 b/config/kernel.m4
index f8d81cd..6c969e6 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -710,7 +710,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 -Wno-unused-function $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
                [$4],
                [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
        )
voidzero commented 6 years ago

I see, very useful. Thanks @behlendorf :+1:

Are there cases when you consider warnings/errors like these - when they happen with the grsec kernel, but not with the vanilla kernel - to be useful enough to merit issue reports? Perhaps they uncover bugs, or might provoke review of certain parts of the code etc.

behlendorf commented 6 years ago

In general yes, we do like to know about these kinds of issue since they can uncover bugs.