[openib-general] Re: [PATCH] fork support

Michael S. Tsirkin mst at mellanox.co.il
Mon Jul 18 21:53:59 PDT 2005


Quoting r. Roland Dreier <rolandd at cisco.com>:
>     Roland> - This patch allows userspace to remove VM_DONTCOPY from
>     Roland> vmas even if the kernel set it.
> 
>     Michael> Well, we'll need it to deregister stuff, wont we?
> 
> Right -- I wasn't very clear about the problem.  It's fine for
> userspace to remove the VM_DONTCOPY if it was set by userspace.  But
> the kernel may have some reason for setting VM_DONTCOPY on a vma, and
> may not want userspace be able to remove the flag.

You were clear enough. I expect this not to be a problem though.

>     Michael> Do you think the above a good idea?
> 
> Yes.

So, instead of the patch as I posted it, we want new flags to mprotect that
will let it touch only one flag at a time, leaving all the rest alone?
Something along the lines of:

#define PROT_SET 0x80000000
#define PROT_CLR 0x40000000

And now:
mprotect(..., PROT_SET | PROT_DONTCOPY)
to set
mprotect(..., PROT_CLR | PROT_DONTCOPY)
to clear

And PROT_DONTCOPY will be editable only when PROT_SET or PROT_CLR is set?

-- 
MST



More information about the general mailing list