From owner-freebsd-bugs Thu Oct 12 21:10: 7 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 9239837B66C for ; Thu, 12 Oct 2000 21:10:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id VAA32835; Thu, 12 Oct 2000 21:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from tsp.korea.ac.kr (tsp.korea.ac.kr [163.152.18.252]) by hub.freebsd.org (Postfix) with ESMTP id ACB0F37B66C; Thu, 12 Oct 2000 21:08:49 -0700 (PDT) Received: from localhost (smcho@localhost) by tsp.korea.ac.kr (8.9.3/8.9.3) with ESMTP id NAA30630; Fri, 13 Oct 2000 13:04:39 +0900 (KST) Message-Id: Date: Fri, 13 Oct 2000 13:04:39 +0900 (KST) From: To: FreeBSD-gnats-submit@freebsd.org Cc: freebsd-bugs@freebsd.org Subject: kern/21947: smget(2) assumes the size in pages Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 21947 >Category: kern >Synopsis: shmget(2) takes 'size' in pages as opposed to bytes. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 12 21:10:01 PDT 2000 >Closed-Date: >Last-Modified: >Originator: smcho@tsp.korea.ac.kr >Release: FreeBSD 3.5.1-RELEASE i386 >Organization: >Environment: All branches supporting SYSV shared memory. >Description: shmget(2) is described to take the second argument as 'the desired size of the new segment in bytes', but in reality, it takes the second argument as the size in _pages_. >How-To-Repeat: Read the source: sys/kern/sysv_shm.c lib/libc/gen/shmget.c >Fix: Attached is a patch to lib/libc/gen/shmget.c *** /usr/src/lib/libc/gen/shmget.c.orig Thu Oct 12 20:43:52 2000 --- /usr/src/lib/libc/gen/shmget.c Thu Oct 12 20:47:36 2000 *************** *** 5,10 **** --- 5,11 ---- #include #include #include + #include #if __STDC__ int shmget(key_t key, int size, int shmflg) *************** *** 15,19 **** int shmflg; #endif { ! return (shmsys(3, key, size, shmflg)); } --- 16,25 ---- int shmflg; #endif { ! int page = size / PAGE_SIZE; ! ! if (size % PAGE_SIZE > 0) ! page++; ! ! return (shmsys(3, key, page, shmflg)); } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message