kern/113218: Overflow in shmget's memory size check

Vasim V vasim at resume-bank.ru
Fri Jun 1 11:40:05 UTC 2007


>Number:         113218
>Category:       kern
>Synopsis:       Overflow in shmget's memory size check
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 01 11:40:03 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Vasim V
>Release:        FreeBSD 7.0-CURRENT amd64
>Organization:
Resume Bank ltd
>Environment:
System: FreeBSD hunter.resume-bank.ru 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Wed May 30 15:59:46 MSD 2007 vasim at hunter.resume-bank.ru:/usr/src/sys/amd64/compile/NEWHUNTER amd64
>Description:
I've got ENOMEM error when tried to allocate SYSV's shared memory buffer greater than 1G on machine with 16G RAM. Some investigation did show that there is small error in sys/kern/sysv_shm.c file - variable "size" has "int" type that may overflow on big values. 
>How-To-Repeat:
	Just try to allocate big shared memory buffer
>Fix:

*** sys/kern/sysv_shm.c.orig    Fri Jun  1 14:49:47 2007
--- sys/kern/sysv_shm.c Fri Jun  1 14:50:50 2007
***************
*** 717,723 ****
        struct shmget_args *uap;
        int mode;
  {
!       int i, segnum, shmid, size;
        struct ucred *cred = td->td_ucred;
        struct shmid_kernel *shmseg;
        vm_object_t shm_object;
--- 717,724 ----
        struct shmget_args *uap;
        int mode;
  {
!       int i, segnum, shmid;
!       size_t size;
        struct ucred *cred = td->td_ucred;
        struct shmid_kernel *shmseg;
        vm_object_t shm_object;



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list