linux-keyring-export-check-20090701
authorMarc Dionne <marc.c.dionne@gmail.com>
Wed, 1 Jul 2009 21:56:48 +0000 (21:56 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 1 Jul 2009 21:56:48 +0000 (21:56 +0000)
LICENSE IPL10
FIXES 125001

check for key_type_keyring being exported; only use it if so

acinclude.m4
src/afs/LINUX/osi_groups.c
src/cf/linux-test4.m4

index 5c508e5..0812e86 100644 (file)
@@ -911,6 +911,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_KERNEL_PAGE_FOLLOW_LINK
                 LINUX_KERNEL_HLIST_UNHASHED
                  LINUX_KEY_TYPE_H_EXISTS
+                LINUX_EXPORTS_KEY_TYPE_KEYRING
                 LINUX_NEED_RHCONFIG
                 LINUX_RECALC_SIGPENDING_ARG_TYPE
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_PARENT
index 959a92b..3efa339 100644 (file)
@@ -637,6 +637,7 @@ extern rwlock_t tasklist_lock __attribute__((weak));
 
 void osi_keyring_init(void)
 {
+#if !defined(EXPORTED_KEY_TYPE_KEYRING)
     struct task_struct *p;
 
     /* If we can't lock the tasklist, either with its explicit lock,
@@ -660,10 +661,7 @@ void osi_keyring_init(void)
 #if defined(EXPORTED_FIND_TASK_BY_PID)
        p = find_task_by_pid(1);
 #else
-       p = pid_task(1, PIDTYPE_PID);
-/*
        p = find_task_by_vpid(1);
-*/
 #endif
        if (p && task_user(p)->session_keyring)
            __key_type_keyring = task_user(p)->session_keyring->type;
@@ -679,6 +677,7 @@ void osi_keyring_init(void)
 # endif
     }
 #endif
+#endif
 
     register_key_type(&key_type_afs_pag);
 }
index 0b28ce1..866f7af 100644 (file)
@@ -1245,3 +1245,22 @@ AC_DEFUN([LINUX_POSIX_TEST_LOCK_CONFLICT_ARG], [
     AC_DEFINE([POSIX_TEST_LOCK_CONFLICT_ARG], 1, [define if posix_test_lock takes a conflict argument])
   fi])
 
+AC_DEFUN([LINUX_EXPORTS_KEY_TYPE_KEYRING], [
+  AC_MSG_CHECKING([for exported key_type_keyring])
+  AC_CACHE_VAL([ac_cv_linux_exports_key_type_keyring], [
+    AC_TRY_KBUILD(
+[
+#ifdef KEY_TYPE_H_EXISTS
+#include <linux/key-type.h>
+#endif
+#include <linux/key.h>],
+[
+printk("%s", key_type_keyring.name);
+],
+      ac_cv_linux_exports_key_type_keyring=yes,
+      ac_cv_linux_exports_key_type_keyring=no)])
+  AC_MSG_RESULT($ac_cv_linux_exports_key_type_keyring)
+  if test "x$ac_cv_linux_exports_key_type_keyring" = "xyes"; then
+    AC_DEFINE([EXPORTED_KEY_TYPE_KEYRING], 1, [define if key_type_keyring is exported])
+  fi])
+