NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/38889



Just in case - patch to disable mmap'ing bdevs.

Index: sys/uvm/uvm_mmap.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_mmap.c,v
retrieving revision 1.144
diff -u -r1.144 uvm_mmap.c
--- sys/uvm/uvm_mmap.c  27 Jan 2012 19:48:41 -0000      1.144
+++ sys/uvm/uvm_mmap.c  24 May 2012 02:30:56 -0000
@@ -386,10 +386,9 @@
                        return (ENODEV);                /* only mmap vnodes! */
                }
                vp = fp->f_data;                /* convert to vnode */
-               if (vp->v_type != VREG && vp->v_type != VCHR &&
-                   vp->v_type != VBLK) {
+               if (vp->v_type != VREG && vp->v_type != VCHR) {
                        fd_putfile(fd);
-                       return (ENODEV);  /* only REG/CHR/BLK support mmap */
+                       return (ENODEV);  /* only REG/CHR support mmap */
                }
                if (vp->v_type != VCHR && pos < 0) {
                        fd_putfile(fd);
Index: tests/lib/libc/sys/t_mmap.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/sys/t_mmap.c,v
retrieving revision 1.5
diff -u -r1.5 t_mmap.c
--- tests/lib/libc/sys/t_mmap.c 16 May 2012 19:12:59 -0000      1.5
+++ tests/lib/libc/sys/t_mmap.c 24 May 2012 02:30:56 -0000
@@ -170,8 +170,6 @@
        size_t len;
        int fd = -1;
 
-       atf_tc_skip("The test case causes a panic (PR kern/38889)");
-
        ATF_REQUIRE(sysctl(mib, miblen, NULL, &len, NULL, 0) == 0);
        drives = malloc(len);
        ATF_REQUIRE(drives != NULL);
@@ -191,13 +189,9 @@
                atf_tc_skip("failed to find suitable block device");
 
        map = mmap(NULL, 4096, PROT_READ, MAP_FILE, fd, 0);
-       ATF_REQUIRE(map != MAP_FAILED);
+       ATF_REQUIRE(map == MAP_FAILED);
 
-       (void)fprintf(stderr, "first byte %x\n", *map);
        ATF_REQUIRE(close(fd) == 0);
-       (void)fprintf(stderr, "first byte %x\n", *map);
-
-       ATF_REQUIRE(munmap(map, 4096) == 0);
 }
 
 ATF_TC(mmap_err);


Home | Main Index | Thread Index | Old Index