aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <miklos@szeredi.hu>2005-11-23 13:35:54 +0000
committerGravatar Miklos Szeredi <miklos@szeredi.hu>2005-11-23 13:35:54 +0000
commitbac4c77aad6314ec44a917492a45834ba5575c5c (patch)
tree1778c40c82b2cbfe072b4b9f9d4fd749966d0e90
parent8393e3d2285533a77d38cfe6713bbe2223802594 (diff)
fix
-rw-r--r--ChangeLog5
-rw-r--r--kernel/configure.ac166
2 files changed, 105 insertions, 66 deletions
diff --git a/ChangeLog b/ChangeLog
index 710b4f8..c153818 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-11-22 Miklos Szeredi <miklos@szeredi.hu>
+
+ * Add detection of mainline FUSE code in running kernel
+
2005-11-21 Miklos Szeredi <miklos@szeredi.hu>
* Don't use async cancelation in multithreaded loop. This makes
@@ -14,6 +18,7 @@
* fusermount: don't allow mountpoints with '\n', '\t', or '\\' in
them, because it corrupts /etc/mtab. Found by Thomas Biege
+ CVE-2005-3531
* libfuse: don't use system() to invoke 'fusermount -u ...'
because it breaks mountpoints with spaces in them into multiple
diff --git a/kernel/configure.ac b/kernel/configure.ac
index 40f0725..dfe7b67 100644
--- a/kernel/configure.ac
+++ b/kernel/configure.ac
@@ -3,6 +3,9 @@ AC_CONFIG_HEADERS([config.h])
AC_PROG_INSTALL
+runver=`uname -r`
+ENABLE_FUSE_MODULE=y
+
kernelsrc=
kernelbuild=
AC_ARG_WITH(kernel,
@@ -11,84 +14,115 @@ AC_ARG_WITH(kernel,
AC_ARG_WITH(kernel-build,
[ --with-kernel-build=PATH Specify location of kernel build ],
[kernelbuild="$withval"])
+AC_ARG_ENABLE(kernel-module,
+ [ --enable-kernel-module Compile kernel module ])
-AC_MSG_CHECKING([kernel source directory])
-if test -z "$kernelsrc"; then
- kernelbuild=
- runver=`uname -r`
- sourcelink=/lib/modules/${runver}/source
- buildlink=/lib/modules/${runver}/build
-
- if test -e $sourcelink; then
- kernelsrc=`(cd $sourcelink; /bin/pwd)`
+if test -z "$enable_kernel_module" -a -z "$kernelbuild" && echo "$runver" | grep -q "^2.6"; then
+ checkmodule=no
+ AC_MSG_CHECKING([if FUSE is loaded as a module])
+ if cat /proc/modules | grep -q "^fuse "; then
+ AC_MSG_RESULT([yes])
+ checkmodule=yes
+ else
+ AC_MSG_RESULT([no])
+ AC_MSG_CHECKING([if FUSE module is built into the kernel])
+ if test -e /sys/class/misc/fuse; then
+ AC_MSG_RESULT([yes])
+ ENABLE_FUSE_MODULE=n
+ else
+ AC_MSG_RESULT([no])
+ checkmodule=yes
+ fi
fi
- if test -e $buildlink; then
- kernelbuild=`(cd $buildlink; /bin/pwd)`
+ if test "$checkmodule" = yes; then
+ AC_MSG_CHECKING([if FUSE module is from official kernel])
+ if fgrep -q "fuse distribution version: " /lib/modules/${runver}/kernel/fs/fuse/fuse.ko 2> /dev/null; then
+ AC_MSG_RESULT([no])
+ else
+ AC_MSG_RESULT([yes])
+ ENABLE_FUSE_MODULE=n
+ fi
fi
+fi
+
+if test "$ENABLE_FUSE_MODULE" = y; then
+ AC_MSG_CHECKING([kernel source directory])
if test -z "$kernelsrc"; then
- kernelsrc=$kernelbuild
+ kernelbuild=
+ sourcelink=/lib/modules/${runver}/source
+ buildlink=/lib/modules/${runver}/build
+
+ if test -e $sourcelink; then
+ kernelsrc=`(cd $sourcelink; /bin/pwd)`
+ fi
+ if test -e $buildlink; then
+ kernelbuild=`(cd $buildlink; /bin/pwd)`
+ fi
+ if test -z "$kernelsrc"; then
+ kernelsrc=$kernelbuild
+ fi
+ if test -z "$kernelsrc" -o -z "$kernelbuild"; then
+ AC_MSG_RESULT([Not found])
+ AC_MSG_ERROR([
+ *** Please specify the location of the kernel source with
+ *** the '--with-kernel=SRCDIR' option])
+ fi
+ fi
+ AC_MSG_RESULT([$kernelsrc])
+ AC_MSG_CHECKING([kernel build directory])
+ AC_MSG_RESULT([$kernelbuild])
+
+ AC_MSG_CHECKING([kernel source version])
+ if test -r $kernelbuild/include/linux/version.h; then
+ kernsrcver=`(echo "#include <linux/version.h>"; echo "kernsrcver=UTS_RELEASE") | cpp -I $kernelbuild/include | grep "^kernsrcver=" | cut -d \" -f 2`
fi
- if test -z "$kernelsrc" -o -z "$kernelbuild"; then
+ if test -z "$kernsrcver"; then
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([
-*** Please specify the location of the kernel source with
-*** the '--with-kernel=SRCDIR' option])
+ *** Cannot determine the version of the linux kernel source. Please
+ *** prepare the kernel before running this script])
fi
-fi
-AC_MSG_RESULT([$kernelsrc])
-AC_MSG_CHECKING([kernel build directory])
-AC_MSG_RESULT([$kernelbuild])
+ AC_MSG_RESULT([$kernsrcver])
+ majver=`echo "$kernsrcver" | cut -f-2 -d.`
+ kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
+ AC_SUBST(kernelsrc)
+ AC_SUBST(majver)
+ AC_SUBST(kmoduledir)
-AC_ARG_ENABLE(kernel-module,
- [ --enable-kernel-module Compile kernel module ])
-
-AC_MSG_CHECKING([kernel source version])
-if test -r $kernelbuild/include/linux/version.h; then
- kernsrcver=`(echo "#include <linux/version.h>"; echo "kernsrcver=UTS_RELEASE") | cpp -I $kernelbuild/include | grep "^kernsrcver=" | cut -d \" -f 2`
-fi
-if test -z "$kernsrcver"; then
- AC_MSG_RESULT([Not found])
- AC_MSG_ERROR([
-*** Cannot determine the version of the linux kernel source. Please
-*** prepare the kernel before running this script])
-fi
-AC_MSG_RESULT([$kernsrcver])
-majver=`echo "$kernsrcver" | cut -f-2 -d.`
-kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
-AC_SUBST(kernelsrc)
-AC_SUBST(majver)
-AC_SUBST(kmoduledir)
-
-ENABLE_FUSE_MODULE=y
-if echo "$kernsrcver" | grep -q "^2.4"; then
- old_cflags="$CFLAGS"
- CFLAGS="-I${kernelsrc}/include -Wall -O2 -fno-strict-aliasing -D__KERNEL__"
- AC_CHECK_DECL(i_size_read,
- AC_DEFINE(HAVE_I_SIZE_FUNC, 1,
- [Kernel has i_size_read() and i_size_write() functions]),,
- [#include <linux/fs.h>])
- AC_CHECK_DECL(recalc_sigpending_tsk,
- AC_DEFINE(HAVE_RECALC_SIGPENDING_TSK, 1,
- [Kernel has recalc_sigpending_tsk() function]),,
- [#include <linux/sched.h>])
- CFLAGS="$old_cflags"
-else
- fuse_configured=no
- kernel_autoconf=$kernelbuild/include/linux/autoconf.h
- AC_MSG_CHECKING([if FUSE is configured in the kernel])
- if test -f $kernel_autoconf; then
- if grep -q "^#define CONFIG_FUSE_FS 1" $kernel_autoconf || grep -q "^#define CONFIG_FUSE_FS_MODULE 1" $kernel_autoconf; then
- fuse_configured=yes
+ if echo "$kernsrcver" | grep -q "^2.4"; then
+ old_cflags="$CFLAGS"
+ CFLAGS="-I${kernelsrc}/include -Wall -O2 -fno-strict-aliasing -D__KERNEL__"
+ AC_CHECK_DECL(i_size_read,
+ AC_DEFINE(HAVE_I_SIZE_FUNC, 1,
+ [Kernel has i_size_read() and i_size_write() functions]),,
+ [#include <linux/fs.h>])
+ AC_CHECK_DECL(recalc_sigpending_tsk,
+ AC_DEFINE(HAVE_RECALC_SIGPENDING_TSK, 1,
+ [Kernel has recalc_sigpending_tsk() function]),,
+ [#include <linux/sched.h>])
+ CFLAGS="$old_cflags"
+ else
+ fuse_configured=no
+ kernel_autoconf=$kernelbuild/include/linux/autoconf.h
+ AC_MSG_CHECKING([if FUSE is configured in the kernel])
+ if test -f $kernel_autoconf; then
+ if grep -q "^#define CONFIG_FUSE_FS 1" $kernel_autoconf || grep -q "^#define CONFIG_FUSE_FS_MODULE 1" $kernel_autoconf; then
+ fuse_configured=yes
+ fi
+ fi
+ AC_MSG_RESULT([$fuse_configured])
+ if test -z "$enable_kernel_module" -a "$fuse_configured" = yes; then
+ ENABLE_FUSE_MODULE=n
fi
fi
- AC_MSG_RESULT([$fuse_configured])
- if test -z "$enable_kernel_module" -a "$fuse_configured" = yes; then
- ENABLE_FUSE_MODULE=n
- AC_MSG_NOTICE([NOTE: Detected that FUSE is already present in the kernel, so])
- AC_MSG_NOTICE([NOTE: building of kernel module is disabled. To force building])
- AC_MSG_NOTICE([NOTE: of kernel module use the '--enable-kernel-module' option.])
- fi
fi
+
+if test "$ENABLE_FUSE_MODULE" = n; then
+ AC_MSG_NOTICE([NOTE: Detected that FUSE is already present in the kernel, so])
+ AC_MSG_NOTICE([NOTE: building of kernel module is disabled. To force building])
+ AC_MSG_NOTICE([NOTE: of kernel module use the '--enable-kernel-module' option.])
+fi
+
if test "$enable_kernel_module" = no; then
ENABLE_FUSE_MODULE=n
fi