#include <linux/smp_lock.h>
+#if defined(LINUX_KEYRING_SUPPORT)
+# include <linux/rwsem.h>
+# include <linux/key.h>
+# if defined(HAVE_LINUX_KEY_TYPE_H)
+# include <linux/key-type.h>
+# endif
+# ifndef KEY_ALLOC_IN_QUOTA
+# define KEY_ALLOC_IN_QUOTA 1
+# endif
+#endif
+
#ifdef AFS_LINUX26_ONEGROUP_ENV
# define NUMPAGGROUPS 1
crset(*cr);
-#if defined(STRUCT_TASK_STRUCT_HAS_PARENT) && !defined(STRUCT_TASK_HAS_CRED)
+#if defined(STRUCT_TASK_STRUCT_HAS_PARENT) && !defined(STRUCT_TASK_STRUCT_HAS_CRED)
if (change_parent) {
old_info = current->parent->group_info;
get_group_info(group_info);
struct key *old;
char desc[20];
int code = -EINVAL;
- int flags;
+ unsigned long flags;
if (!__key_type_keyring)
return code;
afs_uint32 junk;
int old_pag;
- lock_kernel();
old_pag = PagInCred(cr);
crfree(cr);
- unlock_kernel();
code = (*sys_setgroupsp) (gidsetsize, grouplist);
if (code) {
return code;
}
- lock_kernel();
cr = crref();
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
/* re-install old pag if there's room. */
code = __setpag(&cr, old_pag, &junk, 0);
}
crfree(cr);
- unlock_kernel();
/* Linux syscall ABI returns errno as negative */
return (-code);
}
/* Intercept the standard uid32 system call. */
-extern asmlinkage long (*sys_setgroups32p) (int gidsetsize, gid_t * grouplist);
+extern asmlinkage int (*sys_setgroups32p) (int gidsetsize,
+ __kernel_gid32_t * grouplist);
asmlinkage long
afs_xsetgroups32(int gidsetsize, gid_t * grouplist)
{
afs_uint32 junk;
int old_pag;
- lock_kernel();
old_pag = PagInCred(cr);
crfree(cr);
- unlock_kernel();
code = (*sys_setgroups32p) (gidsetsize, grouplist);
return code;
}
- lock_kernel();
cr = crref();
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
/* re-install old pag if there's room. */
code = __setpag(&cr, old_pag, &junk, 0);
}
crfree(cr);
- unlock_kernel();
/* Linux syscall ABI returns errno as negative */
return (-code);
#if defined(AFS_PPC64_LINUX20_ENV)
/* Intercept the uid16 system call as used by 32bit programs. */
-extern long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist);
+extern asmlinkage long (*sys32_setgroupsp)(int gidsetsize, gid_t *grouplist);
asmlinkage long afs32_xsetgroups(int gidsetsize, gid_t *grouplist)
{
long code;
afs_uint32 junk;
int old_pag;
- lock_kernel();
old_pag = PagInCred(cr);
crfree(cr);
- unlock_kernel();
code = (*sys32_setgroupsp)(gidsetsize, grouplist);
if (code) {
return code;
}
- lock_kernel();
cr = crref();
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
/* re-install old pag if there's room. */
code = __setpag(&cr, old_pag, &junk, 0);
}
crfree(cr);
- unlock_kernel();
/* Linux syscall ABI returns errno as negative */
return (-code);
#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_AMD64_LINUX20_ENV)
/* Intercept the uid16 system call as used by 32bit programs. */
-extern long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist);
+#ifdef AFS_AMD64_LINUX20_ENV
+extern asmlinkage long (*sys32_setgroupsp) (int gidsetsize, u16 * grouplist);
+#endif /* AFS_AMD64_LINUX20_ENV */
+#ifdef AFS_SPARC64_LINUX26_ENV
+extern asmlinkage int (*sys32_setgroupsp) (int gidsetsize,
+ __kernel_gid32_t * grouplist);
+#endif /* AFS_SPARC64_LINUX26_ENV */
asmlinkage long
afs32_xsetgroups(int gidsetsize, u16 * grouplist)
{
afs_uint32 junk;
int old_pag;
- lock_kernel();
old_pag = PagInCred(cr);
crfree(cr);
- unlock_kernel();
code = (*sys32_setgroupsp) (gidsetsize, grouplist);
if (code) {
return code;
}
- lock_kernel();
cr = crref();
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
/* re-install old pag if there's room. */
code = __setpag(&cr, old_pag, &junk, 0);
}
crfree(cr);
- unlock_kernel();
/* Linux syscall ABI returns errno as negative */
return (-code);
}
/* Intercept the uid32 system call as used by 32bit programs. */
-extern long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist);
+#ifdef AFS_AMD64_LINUX20_ENV
+extern asmlinkage long (*sys32_setgroups32p) (int gidsetsize, gid_t * grouplist);
+#endif /* AFS_AMD64_LINUX20_ENV */
+#ifdef AFS_SPARC64_LINUX26_ENV
+extern asmlinkage int (*sys32_setgroups32p) (int gidsetsize,
+ __kernel_gid32_t * grouplist);
+#endif /* AFS_SPARC64_LINUX26_ENV */
asmlinkage long
afs32_xsetgroups32(int gidsetsize, gid_t * grouplist)
{
afs_uint32 junk;
int old_pag;
- lock_kernel();
old_pag = PagInCred(cr);
crfree(cr);
- unlock_kernel();
code = (*sys32_setgroups32p) (gidsetsize, grouplist);
if (code) {
return code;
}
- lock_kernel();
cr = crref();
if (old_pag != NOPAG && PagInCred(cr) == NOPAG) {
/* re-install old pag if there's room. */
code = __setpag(&cr, old_pag, &junk, 0);
}
crfree(cr);
- unlock_kernel();
/* Linux syscall ABI returns errno as negative */
return (-code);
* If that's not available, then keyring based PAGs won't work.
*/
-#if defined(EXPORTED_TASKLIST_LOCK) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(EXPORTED_RCU_READ_LOCK))
+#if defined(EXPORTED_TASKLIST_LOCK) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(HAVE_LINUX_RCU_READ_LOCK))
if (__key_type_keyring == NULL) {
# ifdef EXPORTED_TASKLIST_LOCK
if (&tasklist_lock)
read_lock(&tasklist_lock);
# endif
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(EXPORTED_RCU_READ_LOCK))
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(HAVE_LINUX_RCU_READ_LOCK))
# ifdef EXPORTED_TASKLIST_LOCK
else
# endif
rcu_read_lock();
# endif
-#if defined(EXPORTED_FIND_TASK_BY_PID)
+#if defined(HAVE_LINUX_FIND_TASK_BY_PID)
p = find_task_by_pid(1);
#else
p = find_task_by_vpid(1);
if (&tasklist_lock)
read_unlock(&tasklist_lock);
# endif
-# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(EXPORTED_RCU_READ_LOCK))
+# if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) && defined(HAVE_LINUX_RCU_READ_LOCK))
# ifdef EXPORTED_TASKLIST_LOCK
else
# endif