Re: [PATCH 1/6] ksm: limiting the num of mem regions user can register per fd.

Izik Eidus
2009-05-03T09:10:07Z

Rik van Riel wrote:
> On Sun, 3 May 2009 01:16:07 +0300
> Izik Eidus <ieidus@redhat.com> wrote:
>
>
>> Right now user can open /dev/ksm fd and register unlimited number of
>> regions, such behavior may allocate unlimited amount of kernel memory
>> and get the whole host into out of memory situation.
>>
>
> How many times can a process open /dev/ksm?
>
> If a process can open /dev/ksm a thousand times and then
> register 1000 regions through each file descriptor, this
> patch does not help all that much...
>
>
The idea is that the limitation is now on the maximum file descriptors
user can open.
So for each such file descriptor user can open 1024 structures that are
just few bytes each.

The whole propose of this patch is to avoid while (1) {
IOCTL(REGISTER_MEMORY_REGION) } and oom the host.