diff --git a/acinclude.m4 b/acinclude.m4 index 7edc2909e4..1f4d2c5a18 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -941,6 +941,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 diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 959a92b700..3efa339e6b 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -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; @@ -678,6 +676,7 @@ void osi_keyring_init(void) rcu_read_unlock(); # endif } +#endif #endif register_key_type(&key_type_afs_pag); diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 0b28ce1be6..866f7af04e 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -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 +#endif +#include ], +[ +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]) +