tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
mmap RW then mprotect RWX
Hello
I try to fix unoconv, which currently requires paxctl +m ${PYTHONBIN}
to work. The problem is in allocExec() from
libreoffice/bridges/source/cpp_uno/shared/vtablefactory.cxx
It attempts a mmap() with RW protection, and immediatly a mprotect()
with RWX protection. That chokes with PaX mprotect.
A simple fix seems to just call mmap() with RWX protection and forget
the mprotect(). A simple C program (see below) shows that it works well
with NetBSD-10.0/amd64 and PaX mprotect enabled.
I wonder if there are other environments (other NetBSD setups, perhaps?)
where mmap() RW then mprotect() RWX would be required.
#include <stdio.h>
#include <err.h>
#include <sys/mman.h>
int
main(void)
{
void *p;
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_ANON, -1, 0);
if (p == NULL)
err(1, "mmap RWX failed");
return 0;
}
--
Emmanuel Dreyfus
manu%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index