Messages in this thread | ![/](/images/icornerl.gif) | | Date | Sat, 19 Apr 2014 11:17:53 +0200 | From | "Michael Kerrisk (man-pages)" <> | Subject | Re: [PATCH] ipc/shm: Increase the defaults for SHMALL, SHMMAX to infinity |
| |
On 04/19/2014 10:37 AM, Manfred Spraul wrote: > On 04/19/2014 08:55 AM, Davidlohr Bueso wrote: >> On Fri, 2014-04-18 at 11:18 +0200, Manfred Spraul wrote: >>> - ULONG_MAX is not really infinity, but 18 Exabyte segment size and >>> 75 Zettabyte total size. This should be enough for the next few weeks. >>> (assuming a 64-bit system with 4k pages) > Note: I found three integer overflows, none of them critical. > I will send patches, I just must get a 32-bit test setup first. >>> Risks: >>> - The patch breaks installations that use "take current value and increase >>> it a bit". [seems to exist, http://marc.info/?l=linux-mm&m=139638334330127] >> This really scares me. The probability of occurrence is now much higher, >> and not just theoretical. It would legitimately break userspace. > That's why I mentioned it. > For shmmax, there is a simple answer: Use TASK_SIZE instead of ULONG_MAX. > - sufficiently far away from overflow. > - values beyond TASK_SIZE are useless anyway, you can't map such segments. > > I don't have a good answer for shmall. 1L<<(BITS_PER_LONG-1) is too ugly. > Any proposals?
If shmmax is TASK_SIZE, would not the existing #define SHMALL (SHMMAX/getpagesize()*(SHMMNI/16)) suffice?
-- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
| ![\](/images/icornerr.gif) |