Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm32 * fix checking physical address range. on...



details:   https://anonhg.NetBSD.org/src/rev/f5259156d375
branches:  trunk
changeset: 344981:f5259156d375
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sat Apr 30 19:20:47 2016 +0000

description:
* 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.

diffstat:

 sys/arch/arm/arm32/arm32_machdep.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r c8acca5bdf63 -r f5259156d375 sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c        Sat Apr 30 18:40:26 2016 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c        Sat Apr 30 19:20:47 2016 +0000
@@ -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 @@
 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



Home | Main Index | Thread Index | Old Index