Add bounds checking prior to IOs in vldb_check
[openafs.git] / acinclude.m4
index 189ee95..e65c0cd 100644 (file)
@@ -255,11 +255,10 @@ AC_ARG_ENABLE([optimize-pam],
     ,
     [enable_optimize_pam="yes"])
 AC_ARG_ENABLE([linux-syscall-probing],
-    [AS_HELP_STRING([--disable-linux-syscall-probing],
-       [disabling Linux syscall probing (defaults to enabled)])],
+    [AS_HELP_STRING([--enable-linux-syscall-probing],
+       [enable Linux syscall probing (defaults to autodetect)])],
     ,
-    [AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1, 
-       [define to enable syscall table probes])])
+    [enable_linux_syscall_probing="maybe"])
     
 
 AC_ARG_WITH([xslt-processor],
@@ -781,6 +780,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                                       [write_begin], [fs.h])
                 AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
                                       [backing-dev.h])
+                AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [fs.h])
                 AC_CHECK_LINUX_STRUCT([inode], [i_blksize], [fs.h])
@@ -820,7 +820,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 #include <linux/page-flags.h>],
                                     [struct page *_page;
                                       int bchecked = PageFsMisc(_page);])
-                AC_CHECK_LINUX_FUNC([ctl_table], [ctl_name], [sysctl.h])
                 AC_CHECK_LINUX_FUNC([current_kernel_time],
                                     [#include <linux/time.h>],
                                     [struct timespec s;
@@ -898,6 +897,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_IOP_I_PUT_LINK_TAKES_COOKIE
                 LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA
                 LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T
+                LINUX_FOP_F_FSYNC_TAKES_DENTRY
                 LINUX_AOP_WRITEBACK_CONTROL
                 LINUX_FS_STRUCT_FOP_HAS_SPLICE
                 LINUX_KERNEL_POSIX_LOCK_FILE_WAIT_ARG
@@ -918,9 +918,32 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_KEY_ALLOC_NEEDS_CRED
                 LINUX_INIT_WORK_HAS_DATA
                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
-                LINUX_EXPORTS_INIT_MM
-                 LINUX_EXPORTS_SYS_CHDIR
-                 LINUX_EXPORTS_SYS_OPEN
+
+                dnl If we are guaranteed that keyrings will work - that is
+                dnl  a) The kernel has keyrings enabled
+                dnl  b) The code is new enough to give us a key_type_keyring
+                dnl then we just disable syscall probing unless we've been
+                dnl told otherwise
+
+                AS_IF([test "$enable_linux_syscall_probing" = "maybe"],
+                  [AS_IF([test "$ac_cv_linux_keyring_support" = "yes" -a "$ac_cv_linux_exports_key_type_keyring" = "yes"],
+                         [enable_linux_syscall_probing="no"],
+                         [enable_linux_syscall_probing="yes"])
+                 ])
+
+                dnl Syscall probing needs a few tests of its own, and just
+                dnl won't work if the kernel doesn't export init_mm
+                AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
+                   LINUX_EXPORTS_INIT_MM
+                  AS_IF([test "$ac_cv_linux_exports_init_mm" = "no"], [
+                     AC_MSG_ERROR(
+                      [Can't do syscall probing without exported init_mm])
+                   ])
+                  LINUX_EXPORTS_SYS_CHDIR
+                  LINUX_EXPORTS_SYS_OPEN
+                  AC_DEFINE(ENABLE_LINUX_SYSCALL_PROBING, 1,
+                            [define to enable syscall table probes])
+                ])
 
                 dnl Packaging and SMP build
                 if test "x$with_linux_kernel_packaging" = "xno" ; then
@@ -931,7 +954,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
 
                 dnl Syscall probing
                  if test "x$ac_cv_linux_config_modversions" = "xno" -o $AFS_SYSKVERS -ge 26; then
-                   AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
+                  AS_IF([test "$enable_linux_syscall_probing" = "yes"], [
+                     AC_MSG_WARN([Cannot determine sys_call_table status. assuming it isn't exported])
+                  ])
                    ac_cv_linux_exports_sys_call_table=no
                   if test -f "$LINUX_KERNEL_PATH/include/asm/ia32_unistd.h"; then
                     ac_cv_linux_exports_ia32_sys_call_table=yes
@@ -1285,11 +1310,15 @@ AC_CHECK_SIZEOF(unsigned long)
 AC_CHECK_SIZEOF(unsigned int)
 AC_TYPE_INTPTR_T
 AC_TYPE_UINTPTR_T
-AC_CHECK_TYPES([ssize_t])
-AC_CHECK_TYPES([sig_atomic_t],[],[],
+AC_TYPE_SSIZE_T
+AC_CHECK_TYPE([sig_atomic_t],[],
+    [AC_DEFINE([sig_atomic_t], [int],
+        [Define to int if <signal.h> does not define.])],
 [#include <sys/types.h>
 #include <signal.h>])
-AC_CHECK_TYPES([socklen_t],[],[],
+AC_CHECK_TYPE([socklen_t],[],
+    [AC_DEFINE([socklen_t], [int],
+        [Define to int if <sys/socket.h> does not define.])],
 [#include <sys/types.h>
 #include <sys/socket.h>])
 AC_SIZEOF_TYPE(long)