Re: Non-Exec stack patches

From: David Mosberger
Date: Wed Mar 24 2004 - 14:19:07 EST


>>>>> On Wed, 24 Mar 2004 11:02:45 -0800, John Reiser <jreiser@xxxxxxxxxxxx> said:

>> Only one mprotect() call is needed to make the entire stack
>> executable.

John> mprotect() only works on the portion that is currently allocated.
John> If the stack grows, then another call is needed.

No, mprotect() on the entire stack will mark the vm_area with the
desired protection and VM_GROWSDOWN/VM_GROWSUP will expand
automatically with the new protection. And if you want to expand the
stack in user-level, e.g., by intercepting SIGSEGV, you'll either do
an mmap() or mprotect() at any rate so there is zero extra cost there.

--david
-
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/