From e0cac680593fb85a34bb8d9d15c173446dc2511a Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Fri, 6 Apr 2001 19:08:09 +0000 Subject: [PATCH] linux24-new-afs-xsetgroups32-implementation-20010406 afs_xsetgroups32 is now a copy of afs_xsetgroups, with the call to sys_setgroupsp changed to sys_setgroups32p no change to sparc64 port stuff --- src/afs/LINUX/osi_groups.c | 36 ++++++++++++++++++++++++++++++++---- src/afs/LINUX/osi_module.c | 6 +++--- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c index 9e1706ddf..760e8a533 100644 --- a/src/afs/LINUX/osi_groups.c +++ b/src/afs/LINUX/osi_groups.c @@ -126,12 +126,40 @@ asmlinkage int afs_xsetgroups(int gidsetsize, gid_t *grouplist) return code; } -#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_LINUX24_ENV) +#if defined(AFS_LINUX24_ENV) +/* Intercept the standard uid32 system call. */ +extern int (*sys_setgroups32p)(int gidsetsize, gid_t *grouplist); +asmlinkage int afs_xsetgroups32(int gidsetsize, gid_t *grouplist) +{ + int code; + cred_t *cr = crref(); + afs_uint32 junk; + int old_pag; + + lock_kernel(); + old_pag = PagInCred(cr); + crfree(cr); + unlock_kernel(); + + code = (*sys_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(); + + return code; +} +#endif #if defined(AFS_SPARC64_LINUX20_ENV) asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist) -#else -asmlinkage int afs_xsetgroups32(int gidsetsize, __kernel_gid32_t *grouplist) -#endif { gid_t gl[NGROUPS]; int ret, i; diff --git a/src/afs/LINUX/osi_module.c b/src/afs/LINUX/osi_module.c index aab88bcdf..e2652e2d4 100644 --- a/src/afs/LINUX/osi_module.c +++ b/src/afs/LINUX/osi_module.c @@ -74,7 +74,7 @@ __asm__ __volatile__ (" #endif #if defined(AFS_LINUX24_ENV) -asmlinkage int (*sys_setgroupsp32)(int gidsetsize, __kernel_gid32_t *grouplist); +asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist); #endif #ifdef AFS_SPARC64_LINUX20_ENV @@ -136,7 +136,7 @@ int init_module(void) sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups32; #endif #if defined(AFS_LINUX24_ENV) - sys_setgroupsp32 = SYSCALL2POINTER sys_call_table[__NR_setgroups32]; + sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32]; sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32; #endif @@ -154,7 +154,7 @@ void cleanup_module(void) sys_call_table32[__NR_afs_syscall] = afs_ni_syscall32; #endif #if defined(AFS_LINUX24_ENV) - sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroupsp32; + sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p; #endif unregister_filesystem(&afs_file_system); -- 2.39.5