~ubuntu-branches/ubuntu/feisty/openafs/feisty

« back to all changes in this revision

Viewing changes to src/afs/LINUX/osi_syscall.c

  • Committer: Package Import Robot
  • Author(s): Russ Allbery
  • Date: 2007-03-26 18:56:55 UTC
  • Revision ID: package-import@ubuntu.com-20070326185655-osce8n0y0dptgurh
* New upstream release.  (Closes: #415699)
  - Support newer Linux kernels.  (Closes: #409797, #410120)
  - Add aklog fallbacks for null realms to support the referral
    capability in MIT Kerberos 1.6 and later.  (Closes: #410314)
* Apply patch from Thomas Sesselmann to support setting options to pass
  to bosserver in /etc/default/openafs-fileserver.  (Closes: #409357)
* Remove the rx_Init calls in the PAM module.  The internal counters
  that had to be initialized that way have been removed.
* Now that we're running regen.sh as part of the build process, only
  patch the Autoconf source files and not the generated output to make
  the diff easier to audit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include "afs/param.h"
16
16
 
17
17
RCSID
18
 
    ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.1.2.7 2005/11/02 00:28:17 shadow Exp $");
 
18
    ("$Header: /cvs/openafs/src/afs/LINUX/osi_syscall.c,v 1.1.2.8 2006/12/01 18:49:28 shadow Exp $");
19
19
 
20
20
#ifdef AFS_LINUX24_ENV
21
21
#include <linux/module.h> /* early to avoid printf->printk mapping */
54
54
#define SYSCALL2POINTER (void *)
55
55
#endif
56
56
 
 
57
#if defined(AFS_S390X_LINUX24_ENV) 
 
58
#define INSERT_SYSCALL(SLOT, TMPPAGE, FUNC) \
 
59
        if (POINTER2SYSCALL FUNC > 0x7fffffff) { \
 
60
            TMPPAGE = kmalloc ( PAGE_SIZE, GFP_DMA|GFP_KERNEL );        \
 
61
            if (POINTER2SYSCALL TMPPAGE > 0x7fffffff) { \
 
62
                printf("Cannot allocate page for FUNC syscall jump vector\n"); \
 
63
                return EINVAL; \
 
64
            } \
 
65
            memcpy(TMPPAGE, syscall_jump_code, sizeof(syscall_jump_code)); \
 
66
            *(void **)(TMPPAGE + 0x0c) = &FUNC; \
 
67
            afs_sys_call_table[_S(SLOT)] = POINTER2SYSCALL TMPPAGE; \
 
68
        } else \
 
69
            afs_sys_call_table[_S(SLOT)] = POINTER2SYSCALL FUNC;
 
70
#else
 
71
#define INSERT_SYSCALL(SLOT, TMPPAGE, FUNC) \
 
72
    afs_sys_call_table[_S(SLOT)] = POINTER2SYSCALL FUNC;
 
73
#endif 
 
74
 
57
75
#if defined(AFS_S390X_LINUX24_ENV) && !defined(AFS_LINUX26_ENV)
58
76
#define _S(x) ((x)<<1)
59
77
#elif defined(AFS_IA64_LINUX20_ENV)
70
88
static SYSCALLTYPE *afs_sys_call_table;
71
89
static SYSCALLTYPE afs_ni_syscall = 0;
72
90
 
 
91
#ifdef AFS_S390X_LINUX24_ENV
 
92
static void *afs_sys_setgroups_page = 0;
 
93
static void *afs_sys_setgroups32_page = 0;
 
94
static void *afs_syscall_page = 0;
 
95
 
 
96
/* Because of how the syscall table is handled, we need to ensure our 
 
97
   syscalls are within the first 2gb of address space. This means we need
 
98
   self-modifying code we can inject to call our handlers if the module 
 
99
   is loaded high. If keyrings had advanced as fast as false protection
 
100
   this would be unnecessary. */
 
101
 
 
102
uint32_t syscall_jump_code[] = {
 
103
  0xe3d0f030, 0x00240dd0, 0xa7f40006, 0xffffffff, 0xffffffff, 0xe310d004, 
 
104
  0x0004e3d0, 0xf0300004, 0x07f10000, 
 
105
};
 
106
#endif
 
107
 
73
108
extern long afs_xsetgroups();
74
109
asmlinkage long (*sys_setgroupsp) (int gidsetsize, gid_t * grouplist);
75
110
 
483
518
 
484
519
        /* setup AFS entry point */
485
520
        afs_ni_syscall = afs_sys_call_table[_S(__NR_afs_syscall)];
486
 
        afs_sys_call_table[_S(__NR_afs_syscall)] = POINTER2SYSCALL afs_syscall;
 
521
 
 
522
        INSERT_SYSCALL(__NR_afs_syscall, afs_syscall_page, afs_syscall)
487
523
 
488
524
        /* setup setgroups */
489
525
        sys_setgroupsp = SYSCALL2POINTER afs_sys_call_table[_S(__NR_setgroups)];
490
 
        afs_sys_call_table[_S(__NR_setgroups)] = POINTER2SYSCALL afs_xsetgroups;
 
526
        INSERT_SYSCALL(__NR_setgroups, afs_sys_setgroups_page, afs_xsetgroups)
491
527
 
492
528
#if defined(__NR_setgroups32)
493
529
        /* setup setgroups32 */
494
530
        sys_setgroups32p = SYSCALL2POINTER afs_sys_call_table[__NR_setgroups32];
495
 
        afs_sys_call_table[__NR_setgroups32] = POINTER2SYSCALL afs_xsetgroups32;
 
531
        INSERT_SYSCALL(__NR_setgroups32, afs_sys_setgroups32_page, afs_xsetgroups32)
496
532
#endif
497
533
    }
498
534
#endif /* !AFS_IA64_LINUX20_ENV */
580
616
        /* put back setgroups32 */
581
617
        afs_sys_call_table[__NR_setgroups32] = POINTER2SYSCALL sys_setgroups32p;
582
618
#endif
 
619
#if defined(AFS_S390X_LINUX24_ENV)
 
620
#if defined(__NR_setgroups32) && !defined(AFS_IA64_LINUX20_ENV)
 
621
        if (afs_sys_setgroups32_page)
 
622
            kfree(afs_sys_setgroups32_page);
 
623
#endif
 
624
        if (afs_sys_setgroups_page)
 
625
            kfree(afs_sys_setgroups_page);
 
626
        if (afs_syscall_page)
 
627
            kfree(afs_syscall_page);
 
628
#endif
583
629
    }
584
630
 
585
631