Module Name:    src
Committed By:   ryo
Date:           Sat Apr 30 19:20:47 UTC 2016

Modified Files:
        src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
* fix checking physical address range. on some arm devices, physical memory 
doesn't start from 0x00000000.
* allow /dev/mem to read/write memory mapped I/O area depending on kauth.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/arm/arm32/arm32_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.109 src/sys/arch/arm/arm32/arm32_machdep.c:1.110
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.109	Sat Apr 11 13:37:59 2015
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Sat Apr 30 19:20:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.109 2015/04/11 13:37:59 bouyer Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.110 2016/04/30 19:20:47 ryo Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.109 2015/04/11 13:37:59 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.110 2016/04/30 19:20:47 ryo Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -680,8 +680,11 @@ module_init_md(void)
 int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
+	if (pa >= physical_start && pa < physical_end)
+		return 0;
 
-	return (pa < ctob(physmem)) ? 0 : EFAULT;
+	return kauth_authorize_machdep(kauth_cred_get(),
+	    KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL);
 }
 
 #ifdef __HAVE_CPU_UAREA_ALLOC_IDLELWP

Reply via email to