amd64-hook-ia32-table-20030521
authorDerrick Brashear <shadow@dementia.org>
Wed, 4 Jun 2003 17:11:55 +0000 (17:11 +0000)
committerDerrick Brashear <shadow@dementia.org>
Wed, 4 Jun 2003 17:11:55 +0000 (17:11 +0000)
keep track of the ia32 table separately. annoying but needed.

====================
This delta was composed from multiple commits as part of the CVS->Git migration.
The checkin message with each commit was inconsistent.
The following are the additional commit messages.
====================

provide the variables we need for ia32 sys call table if
sys_call_table is exported

src/afs/LINUX/osi_groups.c
src/afs/LINUX/osi_module.c

index b691403..ef957f9 100644 (file)
@@ -109,7 +109,7 @@ int setpag(cred_t **cr, afs_uint32 pagvalue, afs_uint32 *newpag, int change_pare
 }
 
 
-/* Intercept the standard system call. XXX take old_gid_t in new kernels */
+/* Intercept the standard system call. */
 extern long (*sys_setgroupsp)(int gidsetsize, gid_t *grouplist);
 asmlinkage long afs_xsetgroups(int gidsetsize, gid_t *grouplist)
 {
@@ -157,6 +157,7 @@ asmlinkage long afs_xsetgroups32(int gidsetsize, gid_t *grouplist)
     unlock_kernel();
 
     code = (*sys_setgroups32p)(gidsetsize, grouplist);
+
     if (code) {
        return code;
     }
@@ -175,12 +176,12 @@ asmlinkage long afs_xsetgroups32(int gidsetsize, gid_t *grouplist)
 }
 #endif
 
-#if defined(AFS_SPARC64_LINUX20_ENV)
+#if defined(AFS_SPARC64_LINUX20_ENV) || defined(AFS_AMD64_LINUX20_ENV)
 /* Intercept the uid16 system call as used by 32bit programs. */
-extern int (*sys32_setgroupsp)(int gidsetsize, __kernel_gid_t32 *grouplist);
-asmlinkage int afs32_xsetgroups(int gidsetsize, __kernel_gid_t32 *grouplist)
+extern long (*sys32_setgroupsp)(int gidsetsize, old_gid_t *grouplist);
+asmlinkage long afs32_xsetgroups(int gidsetsize, old_gid_t *grouplist)
 {
-    int code;
+    long code;
     cred_t *cr = crref();
     afs_uint32 junk;
     int old_pag;
@@ -209,10 +210,10 @@ asmlinkage int afs32_xsetgroups(int gidsetsize, __kernel_gid_t32 *grouplist)
 }
 #ifdef AFS_LINUX24_ENV
 /* Intercept the uid32 system call as used by 32bit programs. */
-extern int (*sys32_setgroups32p)(int gidsetsize, __kernel_gid_t32 *grouplist);
-asmlinkage int afs32_xsetgroups32(int gidsetsize, __kernel_gid_t32 *grouplist)
+extern long (*sys32_setgroups32p)(int gidsetsize, gid_t *grouplist);
+asmlinkage long afs32_xsetgroups32(int gidsetsize, gid_t *grouplist)
 {
-    int code;
+    long code;
     cred_t *cr = crref();
     afs_uint32 junk;
     int old_pag;
index c361ba5..a3a05f9 100644 (file)
@@ -82,19 +82,25 @@ extern void * ia32_sys_call_table[];
 #else
 static void **ia32_sys_call_table;
 #endif
-#endif
+
+static void *ia32_ni_syscall = 0;
+asmlinkage long (*sys32_setgroupsp)(int gidsetsize, old_gid_t *grouplist);
+#if defined(__NR_ia32_setgroups32)
+asmlinkage long (*sys32_setgroups32p)(int gidsetsize, gid_t *grouplist);
+#endif /* __NR_ia32_setgroups32 */
+#endif /* AFS_AMD64_LINUX20_ENV */
 
 #ifdef AFS_SPARC64_LINUX20_ENV
 static unsigned int afs_ni_syscall32 = 0;
 asmlinkage int (*sys32_setgroupsp)(int gidsetsize, __kernel_gid_t32 *grouplist);
 #if defined(__NR_setgroups32)
 asmlinkage int (*sys32_setgroups32p)(int gidsetsize, __kernel_gid_t32 *grouplist);
-#endif
+#endif /* __NR_setgroups32 */
 #ifdef EXPORTED_SYS_CALL_TABLE
 extern unsigned int sys_call_table32[];
-#else
+#else /* EXPORTED_SYS_CALL_TABLE */
 static unsigned int *sys_call_table32;
-#endif
+#endif /* EXPORTED_SYS_CALL_TABLE */
 
 asmlinkage int afs_syscall32(long syscall, long parm1, long parm2, long parm3,
                             long parm4, long parm5)
@@ -106,7 +112,7 @@ __asm__ __volatile__ ("srl %o4, 0, %o4\n\t"
                      "ret\n\t"
                       "nop");
 }
-#endif
+#endif /* AFS_SPARC64_LINUX20_ENV */
 
 #ifdef AFS_IA64_LINUX20_ENV
 
@@ -184,7 +190,7 @@ struct fptr
 
 #ifdef AFS_LINUX24_ENV
 asmlinkage int (*sys_setgroups32p)(int gidsetsize, __kernel_gid32_t *grouplist);
-#endif 
+#endif /* AFS_LINUX24_ENV */
 
 #ifdef AFS_SPARC64_LINUX20_ENV
 #define POINTER2SYSCALL (unsigned int)(unsigned long)
@@ -206,17 +212,20 @@ int init_module(void)
 #endif
     extern int afs_syscall();
     extern long afs_xsetgroups();
-#if defined(__NR_setgroups32) || defined(__NR_ia32_setgroups32)
+#if defined(__NR_setgroups32)
     extern int afs_xsetgroups32();
-#endif
-#ifdef AFS_SPARC64_LINUX20_ENV
+#endif /* __NR_setgroups32 */
+#if defined(AFS_SPARC64_LINUX20_ENV) || defined (AFS_AMD64_LINUX20_ENV)
     extern int afs32_xsetgroups();
-#if defined(__NR_setgroups32)
+#if (defined(__NR_setgroups32) && defined(AFS_SPARC64_LINUX20_ENV))
     extern int afs32_xsetgroups32();
 #endif
+#if (defined(__NR_ia32_setgroups32) && defined(AFS_AMD64_LINUX20_ENV))
+    extern int afs32_xsetgroups32();
 #endif
+#endif /* AFS_SPARC64_LINUX20_ENV || AFS_AMD64_LINUX20_ENV */
 
-#ifndef EXPORTED_SYS_CALL_TABLE
+#if !defined(EXPORTED_SYS_CALL_TABLE) || (defined(AFS_AMD64_LINUX20_ENV) && !defined(EXPORTED_IA32_SYS_CALL_TABLE))
     unsigned long *ptr;
     unsigned long offset;
     unsigned long datalen;
@@ -231,7 +240,7 @@ int init_module(void)
     char      *sym_name;
     unsigned long    sym_start;
     unsigned long    sym_end;
-#endif
+#endif /* EXPORTED_SYS_CALL_TABLE */
 
     RWLOCK_INIT(&afs_xosi, "afs_xosi");
 
@@ -436,9 +445,10 @@ int init_module(void)
 #endif /* AFS_IA64_LINUX20_ENV */
 #ifdef AFS_AMD64_LINUX20_ENV
     if (ia32_sys_call_table) {
-      ia32_sys_call_table[__NR_ia32_afs_syscall] = POINTER2SYSCALL afs_syscall;
+       ia32_ni_syscall = ia32_sys_call_table[__NR_ia32_afs_syscall];
+       ia32_sys_call_table[__NR_ia32_afs_syscall] = POINTER2SYSCALL afs_syscall;
     }
-#endif
+#endif /* AFS_S390_LINUX22_ENV */
 
     osi_Init();
     register_filesystem(&afs_file_system);
@@ -455,28 +465,34 @@ int init_module(void)
 #else /* AFS_IA64_LINUX20_ENV */
     sys_setgroupsp = SYSCALL2POINTER sys_call_table[__NR_setgroups];
     sys_call_table[__NR_setgroups] = POINTER2SYSCALL afs_xsetgroups;
-# ifdef AFS_SPARC64_LINUX20_ENV
+#ifdef AFS_SPARC64_LINUX20_ENV
     sys32_setgroupsp = SYSCALL2POINTER sys_call_table32[__NR_setgroups];
     sys_call_table32[__NR_setgroups] = POINTER2SYSCALL afs32_xsetgroups;
-# endif
-# if defined(__NR_setgroups32)
+#endif /* AFS_SPARC64_LINUX20_ENV */
+#if defined(__NR_setgroups32)
     sys_setgroups32p = SYSCALL2POINTER sys_call_table[__NR_setgroups32];
     sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
-# ifdef AFS_SPARC64_LINUX20_ENV
+#ifdef AFS_SPARC64_LINUX20_ENV
     sys32_setgroups32p = SYSCALL2POINTER sys_call_table32[__NR_setgroups32];
     sys_call_table32[__NR_setgroups32] = POINTER2SYSCALL afs32_xsetgroups32;
-# endif
-# endif
-#endif /* AFS_IA64_LINUX20_ENV */
-
-#ifdef AFS_AMD64_LINUX20_ENV
+#endif /* AFS_SPARC64_LINUX20_ENV */
+#endif /* __NR_setgroups32 */
+#ifdef AFS_AMD64_LINUX20_ENV 
     if (ia32_sys_call_table) {
-      ia32_sys_call_table[__NR_ia32_setgroups] = POINTER2SYSCALL afs_xsetgroups;
-# if defined(__NR_ia32_setgroups32)
-      ia32_sys_call_table[__NR_ia32_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
-# endif
+       sys32_setgroupsp = 
+           SYSCALL2POINTER ia32_sys_call_table[__NR_ia32_setgroups];
+       ia32_sys_call_table[__NR_ia32_setgroups] = 
+           POINTER2SYSCALL afs32_xsetgroups;
+#if defined(__NR_ia32_setgroups32)
+       sys32_setgroups32p = 
+           SYSCALL2POINTER ia32_sys_call_table[__NR_ia32_setgroups32];
+       ia32_sys_call_table[__NR_ia32_setgroups32] = 
+           POINTER2SYSCALL afs32_xsetgroups32;
+#endif /* __NR_ia32_setgroups32 */
     }
-#endif
+#endif /* AFS_AMD64_LINUX20_ENV */
+#endif /* AFS_IA64_LINUX20_ENV */
+
     osi_sysctl_init();
 
     return 0;
@@ -511,10 +527,13 @@ void cleanup_module(void)
 #endif /* AFS_IA64_LINUX20_ENV */
 #ifdef AFS_AMD64_LINUX20_ENV
     if (ia32_sys_call_table) {
-      ia32_sys_call_table[__NR_ia32_setgroups] = POINTER2SYSCALL sys_setgroupsp;
-      ia32_sys_call_table[__NR_ia32_afs_syscall] = afs_ni_syscall;
+       ia32_sys_call_table[__NR_ia32_setgroups] = 
+           POINTER2SYSCALL sys32_setgroupsp;
+       ia32_sys_call_table[__NR_ia32_afs_syscall] = 
+           POINTER2SYSCALL ia32_ni_syscall;
 # if defined(__NR_setgroups32)
-    ia32_sys_call_table[__NR_ia32_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
+       ia32_sys_call_table[__NR_ia32_setgroups32] = 
+           POINTER2SYSCALL sys32_setgroups32p;
 #endif
     }
 #endif