[openib-general] ibv_reg_mr/ memory locking

Roland Dreier roland at topspin.com
Mon Jan 24 10:37:45 PST 2005


    Michael> Specifically, if it exposes to the user the ability to
    Michael> lock raw physical memory, how do you plan to prevent a
    Michael> DOS by locking all memory?

    Michael> The architecture document says it is done with mlock from
    Michael> userspace, so I thought for a bit that driver may simply
    Michael> require that user mlocks the relevant memory, but then I
    Michael> understood that its easy to bypass by munlocking the
    Michael> registered memory.

This is a good question.  Userspace does need to do mlock() to get
correct results (otherwise the kernel may map new pages at a given
virtual address, even if the old pages are locked).  However the
kernel side will do get_user_pages() to keep the pages present.  So if
a rogue process does munlock(), the only problem it can cause is to
screw itself up.

There is a possibility of userspace possibly pinning a lot of pages
this way, but it would have to allocate the memory first.  I think
there are a lot of local DOS attacks like this that people just don't
worry about too much.

 - R.



More information about the general mailing list