On Thu, Aug 31, 2017 at 06:27:31PM -0700, Linus Torvalds wrote:
Why? That's no different from the case statement for the mmu case,
just written differently.
Yes.
You *want* existing kernels to fail, since they don't test the bits
you want to test.
So you just want to rewrite these all as
switch (flags & MAP_TYPE) {
case MAP_SHARED_VALIDATE:
.. validate the other bits...
/* fallhtough */
case MAP_SHARED:
.. do the shared case ..
case MAP_PRIVATE:
.. do the private case ..
default:
return -EINVAL;
}
Btw, at least my original idea was to make MAP_VALIDATE a flag
instead of another mapping type, that is take it out of MAP_TYPE.
That being said this version is ok with me too - the chances of
needing a new type of private mappings probably isn't too big.