Re: [PATCH] Alternate futex non-page-pinning and COW fix

From: Jamie Lokier
Date: Thu Sep 04 2003 - 12:20:26 EST


Linus Torvalds wrote:
> Actually: the VM_SHARED flag will never change, so testing VM_SHARED is
> actually the _right_ thing from a mm perspective.

Yes it can. See sys_mprotect(). If that's not intended, it's a bug
in mprotect(). What does PROT_SEM mean for Linux, btw?

See:
if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM))
return -EINVAL;

and:
newflags = prot | (vma->vm_flags & ~(PROT_READ | PROT_WRITE | PROT_EXEC));
if ((newflags & ~(newflags >> 4)) & 0xf) {
error = -EACCES;
goto out;
}

newflags is than used to index protection_map[], like this:
newprot = protection_map[newflags & 0xf];

and that is stored in the page tables.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/