Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 fixed to keep PROT_EXECUTE when wri...



details:   https://anonhg.NetBSD.org/src/rev/f1527a975979
branches:  trunk
changeset: 433461:f1527a975979
user:      ryo <ryo%NetBSD.org@localhost>
date:      Sat Sep 15 23:03:27 2018 +0000

description:
fixed to keep PROT_EXECUTE when writing the page/block.
this is required when the L2 block to which the target address belongs
 and the L2 block to which this function itself belongs are the same.

diffstat:

 sys/arch/aarch64/aarch64/db_interface.c |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 9344872ebe96 -r f1527a975979 sys/arch/aarch64/aarch64/db_interface.c
--- a/sys/arch/aarch64/aarch64/db_interface.c   Sat Sep 15 19:47:48 2018 +0000
+++ b/sys/arch/aarch64/aarch64/db_interface.c   Sat Sep 15 23:03:27 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_interface.c,v 1.5 2018/08/06 12:50:56 ryo Exp $ */
+/* $NetBSD: db_interface.c,v 1.6 2018/09/15 23:03:27 ryo Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.5 2018/08/06 12:50:56 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.6 2018/09/15 23:03:27 ryo Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -114,8 +114,13 @@
                /* save pte */
                pte = *ptep;
 
-               /* change to writable */
-               pmap_kvattr(addr, VM_PROT_READ|VM_PROT_WRITE);
+               /*
+                * change to writable. require to keep execute permission.
+                * because if the block/page to which the target address belongs and
+                * the block/page to which this function itself belongs are the same,
+                * if drop PROT_EXECUTE and TLB invalidate, the program stop...
+                */
+               pmap_kvattr(addr, VM_PROT_EXECUTE|VM_PROT_READ|VM_PROT_WRITE);
                aarch64_tlbi_all();
 
                s = size;



Home | Main Index | Thread Index | Old Index