Sat Jun 20 19:24:27 2009 UTC ()
add a workaround for drm:

for device mmap()'s, if the D_NEGOFFSAFE flag is set, do not check
if the offset is negative.

this should go away with the test itself when all drivers are audited
and checked to not fail with negative offsets.


(mrg)
diff -r1.134 -r1.135 src/sys/sys/conf.h
diff -r1.55 -r1.56 src/sys/uvm/uvm_device.c

cvs diff -r1.134 -r1.135 src/sys/sys/conf.h (expand / switch to context diff)
--- src/sys/sys/conf.h 2009/02/02 14:00:27 1.134
+++ src/sys/sys/conf.h 2009/06/20 19:24:27 1.135
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.h,v 1.134 2009/02/02 14:00:27 haad Exp $	*/
+/*	$NetBSD: conf.h,v 1.135 2009/06/20 19:24:27 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -61,6 +61,7 @@
 #define	D_TTY		0x0003
 #define	D_TYPEMASK	0x00ff
 #define	D_MPSAFE	0x0100
+#define	D_NEGOFFSAFE	0x0200
 
 /*
  * Block device switch table

cvs diff -r1.55 -r1.56 src/sys/uvm/uvm_device.c (expand / switch to context diff)
--- src/sys/uvm/uvm_device.c 2008/12/17 20:51:39 1.55
+++ src/sys/uvm/uvm_device.c 2009/06/20 19:24:27 1.56
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_device.c,v 1.55 2008/12/17 20:51:39 cegger Exp $	*/
+/*	$NetBSD: uvm_device.c,v 1.56 2009/06/20 19:24:27 mrg Exp $	*/
 
 /*
  *
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.55 2008/12/17 20:51:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.56 2009/06/20 19:24:27 mrg Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -143,7 +143,8 @@
 	 * Negative offsets on the object are not allowed.
 	 */
 
-	if (off != UVM_UNKNOWN_OFFSET && off < 0)
+	if ((cdev->d_flag & D_NEGOFFSAFE) == 0 &&
+	    off != UVM_UNKNOWN_OFFSET && off < 0)
 		return(NULL);
 
 	/*