DEVEL15-linux-keyring-export-check-20090701

LICENSE IPL10
FIXES 125001

check for key_type_keyring being exported; only use it if so


(cherry picked from commit 4ca66112c2)
This commit is contained in:
Marc Dionne 2009-07-01 21:57:00 +00:00 committed by Derrick Brashear
parent c02f9d1d30
commit 8f71815c74
3 changed files with 22 additions and 3 deletions

View File

@ -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

View 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;
@ -678,6 +676,7 @@ void osi_keyring_init(void)
rcu_read_unlock();
# endif
}
#endif
#endif
register_key_type(&key_type_afs_pag);

View 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])