[OpenAFS] FC6-T2 openafs
chas williams - CONTRACTOR
chas@cmf.nrl.navy.mil
Sun, 13 Aug 2006 12:19:29 -0400
In message <0FE9EAB0D2B197CC6DA289A8@sirius.fac.cs.cmu.edu>,Jeffrey Hutzelman w
rites:
>In any case, what he does or doesn't care about doesn't change the fact
>that the code is there. This is a known problem, BTW, though I don't
>recall offhand what fix we came up with.
most of the necessary tests were already in autoconf (apparently used
for something when osi_probe.c wasn't around?). they just needed a few
changes like building with MODULE_LICENSE() so modpost can tell
when we use a gpl symbol which wont properly weak link. i am not sure
if all the tests should be done this way but i guess it isnt harmful.
autoconf now successfully tests for this condition:
configure:10150: checking for exported sys_open
configure:10182: make -C $LINUX_KERNEL_PATH M=`pwd`/conftest.dir modules > /dev/null
FATAL: modpost: GPL-incompatible module conftest.ko uses GPL-only symbol 'sys_open'
make[1]: *** [__modpost] Error 1
make: *** [modules] Error 2
configure:10185: $? = 2
configure:10248: result: no
i havent seen a kernel with sys_chdir gpl'ed but i believe it
exists so this patch also attempts to handle that case.
Index: acinclude.m4
===================================================================
RCS file: /cvs/openafs/acinclude.m4,v
retrieving revision 1.173.2.5
diff -u -u -r1.173.2.5 acinclude.m4
--- acinclude.m4 11 Aug 2006 21:40:54 -0000 1.173.2.5
+++ acinclude.m4 13 Aug 2006 16:17:18 -0000
@@ -619,6 +619,10 @@
LINUX_REFRIGERATOR
LINUX_LINUX_KEYRING_SUPPORT
LINUX_KEY_ALLOC_NEEDS_STRUCT_TASK
+ LINUX_EXPORTS_SYS_CHDIR
+ LINUX_EXPORTS_SYS_CLOSE
+ LINUX_EXPORTS_SYS_OPEN
+ LINUX_EXPORTS_SYS_WAIT4
LINUX_WHICH_MODULES
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])
@@ -632,9 +636,6 @@
LINUX_EXPORTS_KALLSYMS_SYMBOL
LINUX_EXPORTS_SYS_CALL_TABLE
LINUX_EXPORTS_IA32_SYS_CALL_TABLE
- LINUX_EXPORTS_SYS_CHDIR
- LINUX_EXPORTS_SYS_CLOSE
- LINUX_EXPORTS_SYS_WAIT4
if test "x$ac_cv_linux_exports_sys_call_table" = "xno"; then
linux_syscall_method=none
if test "x$ac_cv_linux_exports_init_mm" = "xyes"; then
@@ -664,6 +665,9 @@
if test "x$ac_cv_linux_exports_sys_chdir" = "xyes" ; then
AC_DEFINE(EXPORTED_SYS_CHDIR, 1, [define if your linux kernel exports sys_chdir])
fi
+ if test "x$ac_cv_linux_exports_sys_open" = "xyes" ; then
+ AC_DEFINE(EXPORTED_SYS_OPEN, 1, [define if your linux kernel exports sys_open])
+ fi
if test "x$ac_cv_linux_exports_sys_close" = "xyes" ; then
AC_DEFINE(EXPORTED_SYS_CLOSE, 1, [define if your linux kernel exports sys_close])
fi
Index: src/afs/LINUX/osi_probe.c
===================================================================
RCS file: /cvs/openafs/src/afs/LINUX/osi_probe.c,v
retrieving revision 1.11
diff -u -u -r1.11 osi_probe.c
--- src/afs/LINUX/osi_probe.c 26 Apr 2006 15:40:43 -0000 1.11
+++ src/afs/LINUX/osi_probe.c 13 Aug 2006 16:17:18 -0000
@@ -231,7 +231,9 @@
extern asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) __attribute__((weak));
extern asmlinkage long sys_close(unsigned int) __attribute__((weak));
+#if defined(EXPORTED_SYS_CHDIR)
extern asmlinkage long sys_chdir(const char *) __attribute__((weak));
+#endif
extern asmlinkage ssize_t sys_write(unsigned int, const char *, size_t) __attribute__((weak));
#ifdef AFS_LINUX26_ENV
extern asmlinkage long sys_wait4(pid_t, int *, int, struct rusage *) __attribute__((weak));
@@ -239,7 +241,9 @@
extern asmlinkage long sys_wait4(pid_t, unsigned int *, int, struct rusage *) __attribute__((weak));
#endif
extern asmlinkage long sys_exit (int) __attribute__((weak));
+#if defined(EXPORTED_SYS_OPEN)
extern asmlinkage long sys_open (const char *, int, int) __attribute__((weak));
+#endif
extern asmlinkage long sys_ioctl(unsigned int, unsigned int, unsigned long) __attribute__((weak));
@@ -300,14 +304,20 @@
/* On PPC64 and SPARC64, we need to omit the ones that might match both tables */
static tryctl main_try[] = {
#if !defined(AFS_PPC64_LINUX20_ENV) && !defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(EXPORTED_SYS_CHDIR)
{ "scan: close+chdir+write", __NR_close, &sys_close, __NR_chdir, &sys_chdir, __NR_write, &sys_write },
#endif
+#endif
{ "scan: close+wait4", __NR_close, &sys_close, __NR_wait4, &sys_wait4, -1, 0 },
#if !defined(AFS_PPC64_LINUX20_ENV) && !defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(EXPORTED_SYS_CHDIR)
{ "scan: close+chdir", __NR_close, &sys_close, __NR_chdir, &sys_chdir, -1, 0 },
#endif
+#endif
{ "scan: close+ioctl", __NR_close, &sys_close, __NR_ioctl, &sys_ioctl, -1, 0 },
+#if defined(EXPORTED_SYS_OPEN)
{ "scan: exit+open", __NR_exit, &sys_exit, __NR_open, &sys_open, -1, 0 },
+#endif
{ 0 }
};
@@ -590,8 +600,10 @@
/* syscall pairs/triplets to probe */
static tryctl ia32_try[] = {
+#if defined(EXPORTED_SYS_CHDIR)
{ "scan: close+chdir+write", __NR_ia32_close, &sys_close, __NR_ia32_chdir, &sys_chdir, __NR_ia32_write, &sys_write },
{ "scan: close+chdir", __NR_ia32_close, &sys_close, __NR_ia32_chdir, &sys_chdir, -1, 0 },
+#endif
{ 0 }
};
Index: src/cf/linux-test1.m4
===================================================================
RCS file: /cvs/openafs/src/cf/linux-test1.m4,v
retrieving revision 1.6.4.1
diff -u -u -r1.6.4.1 linux-test1.m4
--- src/cf/linux-test1.m4 4 Aug 2006 15:45:33 -0000 1.6.4.1
+++ src/cf/linux-test1.m4 13 Aug 2006 16:17:18 -0000
@@ -11,12 +11,15 @@
obj-m += conftest.o
_ACEOF
cat >conftest.c <<\_ACEOF
+#include <linux/module.h>
$1
void conftest(void)
{
$2
}
+
+MODULE_LICENSE("http://www.openafs.org/dl/license10.html");
_ACEOF
cd ..
fi
Index: src/cf/linux-test4.m4
===================================================================
RCS file: /cvs/openafs/src/cf/linux-test4.m4,v
retrieving revision 1.29.2.4
diff -u -u -r1.29.2.4 linux-test4.m4
--- src/cf/linux-test4.m4 11 Aug 2006 21:40:56 -0000 1.29.2.4
+++ src/cf/linux-test4.m4 13 Aug 2006 16:17:18 -0000
@@ -107,10 +107,9 @@
AC_MSG_CHECKING([for exported sys_chdir])
AC_CACHE_VAL([ac_cv_linux_exports_sys_chdir], [
AC_TRY_KBUILD(
-[#include <linux/modversions.h>],
-[#ifndef __ver_sys_chdir
-#error sys_chdir not exported
-#endif],
+[extern asmlinkage long sys_chdir(void) __attribute__((weak));],
+[void *address = &sys_chdir;
+printk("%p\n", address);],
ac_cv_linux_exports_sys_chdir=yes,
ac_cv_linux_exports_sys_chdir=no)])
AC_MSG_RESULT($ac_cv_linux_exports_sys_chdir)])
@@ -120,23 +119,33 @@
AC_MSG_CHECKING([for exported sys_close])
AC_CACHE_VAL([ac_cv_linux_exports_sys_close], [
AC_TRY_KBUILD(
-[#include <linux/modversions.h>],
-[#ifndef __ver_sys_close
-#error sys_close not exported
-#endif],
+[extern asmlinkage long sys_close(void) __attribute__((weak));],
+[void *address = &sys_close;
+printk("%p\n", address);],
ac_cv_linux_exports_sys_close=yes,
ac_cv_linux_exports_sys_close=no)])
AC_MSG_RESULT($ac_cv_linux_exports_sys_close)])
+AC_DEFUN([LINUX_EXPORTS_SYS_OPEN], [
+ AC_MSG_CHECKING([for exported sys_open])
+ AC_CACHE_VAL([ac_cv_linux_exports_sys_open], [
+ AC_TRY_KBUILD(
+[extern asmlinkage long sys_open(void) __attribute__((weak));],
+[void *address = &sys_open;
+printk("%p\n", address);],
+ ac_cv_linux_exports_sys_open=yes,
+ ac_cv_linux_exports_sys_open=no)])
+ AC_MSG_RESULT($ac_cv_linux_exports_sys_open)])
+
+
AC_DEFUN([LINUX_EXPORTS_SYS_WAIT4], [
AC_MSG_CHECKING([for exported sys_wait4])
AC_CACHE_VAL([ac_cv_linux_exports_sys_wait4], [
AC_TRY_KBUILD(
-[#include <linux/modversions.h>],
-[#ifndef __ver_sys_wait4
-#error sys_wait4 not exported
-#endif],
+[extern asmlinkage long sys_wait4(void) __attribute__((weak));],
+[void *address = &sys_wait4;
+printk("%p\n", address);],
ac_cv_linux_exports_sys_wait4=yes,
ac_cv_linux_exports_sys_wait4=no)])
AC_MSG_RESULT($ac_cv_linux_exports_sys_wait4)])