netbsd-bugs@netbsd.org
[Top] [All Lists]

Re: kern/38109: Shared memory code can't handle > 4GB of memory

Subject: Re: kern/38109: Shared memory code can't handle > 4GB of memory
From: David Holland
Date: Thu, 03 Apr 2008 03:09:45 UTC
Newsgroups: fa.netbsd.bugs

On Tue, Feb 26, 2008 at 09:40:00PM +0000, cbrand@xxxxxxxxxxx wrote:
 > The shared memory code stores the total number of bytes available
 > for use as shared memory in shminfo.shmmax. This is a uint32_t, so
 > it overflows at 4GB (note that it's initially set to the max number
 > of pages, but this is the multiplied by PAGE_SIZE).
 >
 > Index: sys/kern/sysv_shm.c
 > ===================================================================
 > RCS file: /cvsroot/pkt/sw/netbsd300/usr/src/sys/kern/Attic/sysv_shm.c,v
                                                        ^^^^^
 > [...]

All that stuff got ripped out in -current and replaced with new code
that doesn't have such silly limits.

FWIW.

I don't know what the prospects are for getting the new code in 3.x;
but maybe the simple fix will do.

 > <       int32_t shmmax;         /* max shared memory segment size (bytes) */
 > ---
 > >       int64_t shmmax;         /* max shared memory segment size (bytes) */

..it should be size_t (or ssize_t if it really needs to be signed for
some reason), not either int32_t or int64_t.

(Also, in general, when sending diffs please use diff -u or diff -up.)

-- 
David A. Holland
dholland@xxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>