diff options
Diffstat (limited to 'ipc/shm.c')
-rw-r--r-- | ipc/shm.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -126,6 +126,8 @@ found: return (unsigned int) shp->u.shm_perm.seq * SHMMNI + id; } +int shmmax = SHMMAX; + asmlinkage int sys_shmget (key_t key, int size, int shmflg) { struct shmid_kernel *shp; @@ -133,7 +135,7 @@ asmlinkage int sys_shmget (key_t key, int size, int shmflg) down(¤t->mm->mmap_sem); lock_kernel(); - if (size < 0 || size > SHMMAX) { + if (size < 0 || size > shmmax) { err = -EINVAL; } else if (key == IPC_PRIVATE) { err = newseg(key, shmflg, size); @@ -228,7 +230,7 @@ asmlinkage int sys_shmctl (int shmid, int cmd, struct shmid_ds *buf) if (!buf) goto out; shminfo.shmmni = SHMMNI; - shminfo.shmmax = SHMMAX; + shminfo.shmmax = shmmax; shminfo.shmmin = SHMMIN; shminfo.shmall = SHMALL; shminfo.shmseg = SHMSEG; @@ -622,6 +624,7 @@ static pte_t shm_swap_in(struct vm_area_struct * shmd, unsigned long offset, uns unsigned int id, idx; id = SWP_OFFSET(code) & SHM_ID_MASK; +#ifdef DEBUG_SHM if (id != (SWP_OFFSET(shmd->vm_pte) & SHM_ID_MASK)) { printk ("shm_swap_in: code id = %d and shmd id = %ld differ\n", id, SWP_OFFSET(shmd->vm_pte) & SHM_ID_MASK); @@ -631,12 +634,17 @@ static pte_t shm_swap_in(struct vm_area_struct * shmd, unsigned long offset, uns printk ("shm_swap_in: id=%d too big. proc mem corrupted\n", id); return BAD_PAGE; } +#endif shp = shm_segs[id]; + +#ifdef DEBUG_SHM if (shp == IPC_UNUSED || shp == IPC_NOID) { printk ("shm_swap_in: id=%d invalid. Race.\n", id); return BAD_PAGE; } +#endif idx = (SWP_OFFSET(code) >> SHM_IDX_SHIFT) & SHM_IDX_MASK; +#ifdef DEBUG_SHM if (idx != (offset >> PAGE_SHIFT)) { printk ("shm_swap_in: code idx = %u and shmd idx = %lu differ\n", idx, offset >> PAGE_SHIFT); @@ -646,6 +654,7 @@ static pte_t shm_swap_in(struct vm_area_struct * shmd, unsigned long offset, uns printk ("shm_swap_in : too large page index. id=%d\n", id); return BAD_PAGE; } +#endif pte = __pte(shp->shm_pages[idx]); if (!pte_present(pte)) { |