Date: Sat, 5 Jan 2008 02:10:04 GMT From: "Zachary Loafman" <zachary.loafman@isilon.com> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/93396: dlopen crash with locked page Message-ID: <200801050210.m052A4xI041213@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/93396; it has been noted by GNATS. From: "Zachary Loafman" <zachary.loafman@isilon.com> To: <bug-followup@FreeBSD.org>, <fabien.thomas@netasq.com> Cc: Subject: Re: kern/93396: dlopen crash with locked page Date: Fri, 4 Jan 2008 17:59:57 -0800 Testcase that takes out any RTLD interaction, demonstrates the problem quickly, and works just fine if you take out the mlockall: -- #include <sys/mman.h> #include <sys/param.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #define EXIT_IF(__cond, __str) do { if (__cond) { perror(__str); exit(-1); } } while(0) int main() { char name[] =3D "/tmp/pr93396.XXXXXX"; char buf[PAGE_SIZE]; int rc, fd; char *map; fd =3D mkstemp(name); EXIT_IF(fd < 0, "mkstemp"); rc =3D write(fd, buf, PAGE_SIZE); EXIT_IF(rc < PAGE_SIZE, "write"); rc =3D mlockall(MCL_CURRENT | MCL_FUTURE); EXIT_IF(rc, "mlockall"); map =3D mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE, fd, 0); EXIT_IF(!map, "mmap"); rc =3D mprotect(map, PAGE_SIZE, PROT_READ|PROT_WRITE); EXIT_IF(rc, "mprotect"); *map =3D 'a'; =09 return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801050210.m052A4xI041213>